Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/package/contents/ui/ConfigGeneral.qml
Show All 12 Lines | |||||
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. | ||
14 | * | 14 | * | ||
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.0 | 20 | import QtQuick 2.0 | ||
21 | import QtQuick.Controls 1.0 as QtControls | 21 | import QtQuick.Controls 2.3 as QtControls | ||
22 | import QtQuick.Layouts 1.0 as QtLayouts | 22 | import QtQuick.Layouts 1.0 as QtLayouts | ||
23 | 23 | | |||
24 | import org.kde.plasma.core 2.0 as PlasmaCore | 24 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
25 | import org.kde.plasma.components 2.0 as PlasmaComponents | 25 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
26 | import org.kde.plasma.extras 2.0 as PlasmaExtras | | |||
27 | import org.kde.kquickcontrolsaddons 2.0 | 26 | import org.kde.kquickcontrolsaddons 2.0 | ||
27 | import org.kde.kirigami 2.5 as Kirigami | ||||
28 | 28 | | |||
29 | Item { | 29 | Item { | ||
30 | id: iconsPage | 30 | id: iconsPage | ||
31 | 31 | | |||
32 | signal configurationChanged | 32 | signal configurationChanged | ||
33 | 33 | | |||
34 | width: childrenRect.width | 34 | width: childrenRect.width | ||
35 | height: childrenRect.height | 35 | height: childrenRect.height | ||
36 | implicitWidth: mainColumn.implicitWidth | 36 | implicitWidth: mainColumn.implicitWidth | ||
37 | implicitHeight: pageColumn.implicitHeight | 37 | implicitHeight: pageColumn.implicitHeight | ||
38 | 38 | | |||
39 | property alias cfg_applicationStatusShown: applicationStatus.checked | 39 | property alias cfg_applicationStatusShown: applicationStatus.checked | ||
40 | property alias cfg_communicationsShown: communications.checked | 40 | property alias cfg_communicationsShown: communications.checked | ||
41 | property alias cfg_systemServicesShown: systemServices.checked | 41 | property alias cfg_systemServicesShown: systemServices.checked | ||
42 | property alias cfg_hardwareControlShown: hardwareControl.checked | 42 | property alias cfg_hardwareControlShown: hardwareControl.checked | ||
43 | property alias cfg_miscellaneousShown: miscellaneous.checked | 43 | property alias cfg_miscellaneousShown: miscellaneous.checked | ||
44 | property var cfg_extraItems: [] | 44 | property var cfg_extraItems: [] | ||
45 | 45 | | |||
46 | SystemPalette { | 46 | QtControls.CheckBox { | ||
47 | id: palette | 47 | id: dummyCheckbox | ||
48 | visible: false | ||||
48 | } | 49 | } | ||
49 | 50 | | |||
50 | QtLayouts.ColumnLayout { | 51 | Kirigami.FormLayout { | ||
51 | id: pageColumn | 52 | id: pageColumn | ||
52 | anchors.left: parent.left | 53 | anchors.left: parent.left | ||
53 | 54 | | |||
54 | PlasmaExtras.Heading { | | |||
55 | level: 2 | | |||
56 | text: i18n("Categories") | | |||
57 | color: palette.text | | |||
58 | } | | |||
59 | Item { | 55 | Item { | ||
60 | width: height | 56 | Kirigami.FormData.isSection: true | ||
61 | height: units.gridUnit / 2 | 57 | Kirigami.FormData.label: i18n("Categories") | ||
62 | } | 58 | } | ||
63 | QtLayouts.ColumnLayout { | 59 | | ||
64 | spacing: units.smallSpacing * 2 | | |||
65 | QtControls.CheckBox { | 60 | QtControls.CheckBox { | ||
66 | id: applicationStatus | 61 | id: applicationStatus | ||
67 | text: i18n("Application Status") | 62 | text: i18n("Application Status") | ||
68 | } | 63 | } | ||
69 | QtControls.CheckBox { | 64 | QtControls.CheckBox { | ||
70 | id: communications | 65 | id: communications | ||
71 | text: i18n("Communications") | 66 | text: i18n("Communications") | ||
72 | } | 67 | } | ||
73 | QtControls.CheckBox { | 68 | QtControls.CheckBox { | ||
74 | id: systemServices | 69 | id: systemServices | ||
75 | text: i18n("System Services") | 70 | text: i18n("System Services") | ||
76 | } | 71 | } | ||
77 | QtControls.CheckBox { | 72 | QtControls.CheckBox { | ||
78 | id: hardwareControl | 73 | id: hardwareControl | ||
79 | text: i18n("Hardware Control") | 74 | text: i18n("Hardware Control") | ||
80 | } | 75 | } | ||
81 | QtControls.CheckBox { | 76 | QtControls.CheckBox { | ||
82 | id: miscellaneous | 77 | id: miscellaneous | ||
83 | text: i18n("Miscellaneous") | 78 | text: i18n("Miscellaneous") | ||
84 | } | 79 | } | ||
85 | } | 80 | | ||
86 | 81 | | |||
87 | Item { | 82 | Item { | ||
88 | width: height | 83 | Kirigami.FormData.isSection: true | ||
89 | height: units.gridUnit | 84 | Kirigami.FormData.label: i18n("Extra Items") | ||
90 | } | | |||
91 | PlasmaExtras.Heading { | | |||
92 | level: 2 | | |||
93 | text: i18n("Extra Items") | | |||
94 | color: palette.text | | |||
95 | } | | |||
96 | Item { | | |||
97 | width: height | | |||
98 | height: units.gridUnit / 2 | | |||
99 | } | | |||
100 | QtLayouts.ColumnLayout { | | |||
101 | spacing: units.smallSpacing * 2 | | |||
102 | QtControls.CheckBox { | | |||
103 | id: dummyCheckbox | | |||
104 | visible: false | | |||
105 | } | 85 | } | ||
86 | | ||||
106 | Repeater { | 87 | Repeater { | ||
107 | model: plasmoid.nativeInterface.availablePlasmoids | 88 | model: plasmoid.nativeInterface.availablePlasmoids | ||
108 | delegate: QtControls.CheckBox { | 89 | delegate: QtControls.CheckBox { | ||
109 | QtLayouts.Layout.minimumWidth: childrenRect.width | 90 | QtLayouts.Layout.minimumWidth: childrenRect.width | ||
110 | checked: cfg_extraItems.indexOf(plugin) != -1 | 91 | checked: cfg_extraItems.indexOf(plugin) != -1 | ||
111 | onCheckedChanged: { | 92 | onCheckedChanged: { | ||
112 | var index = cfg_extraItems.indexOf(plugin); | 93 | var index = cfg_extraItems.indexOf(plugin); | ||
113 | if (checked) { | 94 | if (checked) { | ||
114 | if (index == -1) { | 95 | if (index == -1) { | ||
115 | cfg_extraItems.push(plugin); | 96 | cfg_extraItems.push(plugin); | ||
116 | } | 97 | } | ||
117 | } else { | 98 | } else { | ||
118 | if (index > -1) { | 99 | if (index > -1) { | ||
119 | cfg_extraItems.splice(index, 1); | 100 | cfg_extraItems.splice(index, 1); | ||
120 | } | 101 | } | ||
121 | } | 102 | } | ||
122 | configurationChanged() // qml cannot detect changes inside an Array | 103 | configurationChanged() // qml cannot detect changes inside an Array | ||
123 | } | 104 | } | ||
124 | QtLayouts.RowLayout { | 105 | QtLayouts.RowLayout { | ||
125 | anchors.verticalCenter: parent.verticalCenter | 106 | anchors.verticalCenter: parent.verticalCenter | ||
126 | x: dummyCheckbox.width | 107 | x: dummyCheckbox.width | ||
127 | QIconItem { | 108 | QIconItem { | ||
128 | icon: decoration | 109 | icon: model.decoration | ||
129 | width: units.iconSizes.small | 110 | width: units.iconSizes.small | ||
130 | height: width | 111 | height: width | ||
131 | } | 112 | } | ||
132 | QtControls.Label { | 113 | QtControls.Label { | ||
133 | text: display | 114 | text: model.display | ||
134 | } | | |||
135 | } | 115 | } | ||
136 | } | 116 | } | ||
137 | } | 117 | } | ||
138 | } | 118 | } | ||
139 | } | 119 | } | ||
140 | } | 120 | } |