File: ConfigGeneral.qml

package info (click to toggle)
plasma-workspace 4%3A5.8.6-2.1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 54,996 kB
  • sloc: cpp: 70,006; sh: 868; xml: 867; python: 46; makefile: 16
file content (140 lines) | stat: -rw-r--r-- 4,736 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
 *  Copyright 2013 Sebastian Kügler <sebas@kde.org>
 *  Copyright 2014 Marco Martin <mart@kde.org>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  2.010-1301, USA.
 */

import QtQuick 2.0
import QtQuick.Controls 1.0 as QtControls
import QtQuick.Layouts 1.0 as QtLayouts

import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kquickcontrolsaddons 2.0

Item {
    id: iconsPage

    signal configurationChanged

    width: childrenRect.width
    height: childrenRect.height
    implicitWidth: mainColumn.implicitWidth
    implicitHeight: pageColumn.implicitHeight

    property alias cfg_applicationStatusShown: applicationStatus.checked
    property alias cfg_communicationsShown: communications.checked
    property alias cfg_systemServicesShown: systemServices.checked
    property alias cfg_hardwareControlShown: hardwareControl.checked
    property alias cfg_miscellaneousShown: miscellaneous.checked
    property var cfg_extraItems: []

    SystemPalette {
        id: palette
    }

    QtLayouts.ColumnLayout {
        id: pageColumn
        anchors.left: parent.left

        PlasmaExtras.Heading {
            level: 2
            text: i18n("Categories")
            color: palette.text
        }
        Item {
            width: height
            height: units.gridUnit / 2
        }
        QtLayouts.ColumnLayout {
            spacing: units.smallSpacing * 2
            QtControls.CheckBox {
                id: applicationStatus
                text: i18n("Application Status")
            }
            QtControls.CheckBox {
                id: communications
                text: i18n("Communications")
            }
            QtControls.CheckBox {
                id: systemServices
                text: i18n("System Services")
            }
            QtControls.CheckBox {
                id: hardwareControl
                text: i18n("Hardware Control")
            }
            QtControls.CheckBox {
                id: miscellaneous
                text: i18n("Miscellaneous")
            }
        }

        Item {
            width: height
            height: units.gridUnit
        }
        PlasmaExtras.Heading {
            level: 2
            text: i18n("Extra Items")
            color: palette.text
        }
        Item {
            width: height
            height: units.gridUnit / 2
        }
        QtLayouts.ColumnLayout {
            spacing: units.smallSpacing * 2
            QtControls.CheckBox {
                id: dummyCheckbox
                visible: false
            }
            Repeater {
                model: plasmoid.nativeInterface.availablePlasmoids
                delegate: QtControls.CheckBox {
                    QtLayouts.Layout.minimumWidth: childrenRect.width
                    checked: cfg_extraItems.indexOf(plugin) != -1
                    onCheckedChanged: {
                        var index = cfg_extraItems.indexOf(plugin);
                        if (checked) {
                            if (index == -1) {
                                cfg_extraItems.push(plugin);
                            }
                        } else {
                            if (index > -1) {
                                cfg_extraItems.splice(index, 1);
                            }
                        }
                        configurationChanged() // qml cannot detect changes inside an Array
                    }
                    QtLayouts.RowLayout {
                        anchors.verticalCenter: parent.verticalCenter
                        x: dummyCheckbox.width
                        QIconItem {
                            icon: decoration
                            width: units.iconSizes.small
                            height: width
                        }
                        QtControls.Label {
                            text: display
                        }
                    }
                }
            }
        }
    }
}