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 { | ||
53 | 54 | left: parent.left | |||
54 | PlasmaExtras.Heading { | 55 | right: parent.right | ||
55 | level: 2 | | |||
56 | text: i18n("Categories") | | |||
57 | color: palette.text | | |||
58 | } | 56 | } | ||
57 | | ||||
59 | Item { | 58 | Item { | ||
60 | width: height | 59 | Kirigami.FormData.isSection: true | ||
61 | height: units.gridUnit / 2 | 60 | Kirigami.FormData.label: i18n("Categories") | ||
62 | } | 61 | } | ||
63 | QtLayouts.ColumnLayout { | 62 | | ||
64 | spacing: units.smallSpacing * 2 | | |||
65 | QtControls.CheckBox { | 63 | QtControls.CheckBox { | ||
66 | id: applicationStatus | 64 | id: applicationStatus | ||
67 | text: i18n("Application Status") | 65 | text: i18n("Application Status") | ||
68 | } | 66 | } | ||
69 | QtControls.CheckBox { | 67 | QtControls.CheckBox { | ||
70 | id: communications | 68 | id: communications | ||
71 | text: i18n("Communications") | 69 | text: i18n("Communications") | ||
72 | } | 70 | } | ||
73 | QtControls.CheckBox { | 71 | QtControls.CheckBox { | ||
74 | id: systemServices | 72 | id: systemServices | ||
75 | text: i18n("System Services") | 73 | text: i18n("System Services") | ||
76 | } | 74 | } | ||
77 | QtControls.CheckBox { | 75 | QtControls.CheckBox { | ||
78 | id: hardwareControl | 76 | id: hardwareControl | ||
79 | text: i18n("Hardware Control") | 77 | text: i18n("Hardware Control") | ||
80 | } | 78 | } | ||
81 | QtControls.CheckBox { | 79 | QtControls.CheckBox { | ||
82 | id: miscellaneous | 80 | id: miscellaneous | ||
83 | text: i18n("Miscellaneous") | 81 | text: i18n("Miscellaneous") | ||
84 | } | 82 | } | ||
85 | } | 83 | | ||
86 | 84 | | |||
87 | Item { | 85 | Item { | ||
88 | width: height | 86 | Kirigami.FormData.isSection: true | ||
89 | height: units.gridUnit | 87 | 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 | } | 88 | } | ||
89 | | ||||
106 | Repeater { | 90 | Repeater { | ||
107 | model: plasmoid.nativeInterface.availablePlasmoids | 91 | model: plasmoid.nativeInterface.availablePlasmoids | ||
108 | delegate: QtControls.CheckBox { | 92 | delegate: QtControls.CheckBox { | ||
109 | QtLayouts.Layout.minimumWidth: childrenRect.width | 93 | QtLayouts.Layout.minimumWidth: childrenRect.width | ||
110 | checked: cfg_extraItems.indexOf(plugin) != -1 | 94 | checked: cfg_extraItems.indexOf(plugin) != -1 | ||
95 | implicitWidth: itemLayout.width + itemLayout.x | ||||
111 | onCheckedChanged: { | 96 | onCheckedChanged: { | ||
112 | var index = cfg_extraItems.indexOf(plugin); | 97 | var index = cfg_extraItems.indexOf(plugin); | ||
113 | if (checked) { | 98 | if (checked) { | ||
114 | if (index == -1) { | 99 | if (index == -1) { | ||
115 | cfg_extraItems.push(plugin); | 100 | cfg_extraItems.push(plugin); | ||
116 | } | 101 | } | ||
117 | } else { | 102 | } else { | ||
118 | if (index > -1) { | 103 | if (index > -1) { | ||
119 | cfg_extraItems.splice(index, 1); | 104 | cfg_extraItems.splice(index, 1); | ||
120 | } | 105 | } | ||
121 | } | 106 | } | ||
122 | configurationChanged() // qml cannot detect changes inside an Array | 107 | configurationChanged() // qml cannot detect changes inside an Array | ||
123 | } | 108 | } | ||
124 | QtLayouts.RowLayout { | 109 | QtLayouts.RowLayout { | ||
110 | id: itemLayout | ||||
125 | anchors.verticalCenter: parent.verticalCenter | 111 | anchors.verticalCenter: parent.verticalCenter | ||
126 | x: dummyCheckbox.width | 112 | x: dummyCheckbox.width | ||
127 | QIconItem { | 113 | QIconItem { | ||
128 | icon: decoration | 114 | icon: model.decoration | ||
129 | width: units.iconSizes.small | 115 | width: units.iconSizes.small | ||
130 | height: width | 116 | height: width | ||
131 | } | 117 | } | ||
132 | QtControls.Label { | 118 | QtControls.Label { | ||
133 | text: display | 119 | text: model.display | ||
134 | } | | |||
135 | } | 120 | } | ||
136 | } | 121 | } | ||
137 | } | 122 | } | ||
138 | } | 123 | } | ||
139 | } | 124 | } | ||
140 | } | 125 | } |