Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/package/contents/ui/ConfigEntries.qml
Context not available. | |||||
38 | property var cfg_hiddenItems: [] | 38 | property var cfg_hiddenItems: [] | ||
---|---|---|---|---|---|
39 | property alias cfg_showAllItems: showAllCheckBox.checked | 39 | property alias cfg_showAllItems: showAllCheckBox.checked | ||
40 | 40 | | |||
41 | function saveConfig () { | | |||
42 | for (var i in tableView.model) { | | |||
43 | //tableView.model[i].applet.globalShortcut = tableView.model[i].shortcut | | |||
44 | } | | |||
45 | } | | |||
46 | | ||||
47 | PlasmaCore.DataSource { | | |||
48 | id: statusNotifierSource | | |||
49 | engine: "statusnotifieritem" | | |||
50 | interval: 0 | | |||
51 | onSourceAdded: { | | |||
52 | connectSource(source) | | |||
53 | } | | |||
54 | Component.onCompleted: { | | |||
55 | connectedSources = sources | | |||
56 | } | | |||
57 | } | | |||
58 | | ||||
59 | PlasmaCore.SortFilterModel { | 41 | PlasmaCore.SortFilterModel { | ||
60 | id: statusNotifierModel | 42 | id: systemTrayModel | ||
61 | sourceModel: PlasmaCore.DataModel { | 43 | sourceModel: plasmoid.nativeInterface.systemTrayModel | ||
62 | dataSource: statusNotifierSource | | |||
63 | } | | |||
64 | } | 44 | } | ||
65 | 45 | | |||
66 | | ||||
67 | Kirigami.FormLayout { | 46 | Kirigami.FormLayout { | ||
68 | 47 | | |||
69 | QQC2.CheckBox { | 48 | QQC2.CheckBox { | ||
Context not available. | |||||
85 | } | 64 | } | ||
86 | } | 65 | } | ||
87 | 66 | | |||
88 | 67 | // convert to QtObjects compatible with TableView | |||
89 | function retrieveAllItems() { | 68 | function retrieveAllItems() { | ||
90 | var list = []; | 69 | var list = []; | ||
91 | for (var i = 0; i < statusNotifierModel.count; ++i) { | 70 | for (var i = 0; i < systemTrayModel.count; i++) { | ||
92 | var item = statusNotifierModel.get(i); | 71 | var item = systemTrayModel.get(i); | ||
93 | list.push({ | 72 | if (item.itemType === "Plasmoid" && !item.hasApplet) { | ||
94 | "index": i, | 73 | continue; | ||
95 | "taskId": item.Id, | 74 | } | ||
96 | "name": item.Title, | | |||
97 | "iconName": item.IconName, | | |||
98 | "icon": item.Icon | | |||
99 | }); | | |||
100 | } | | |||
101 | var lastIndex = list.length; | | |||
102 | for (var i = 0; i < plasmoid.applets.length; ++i) { | | |||
103 | var item = plasmoid.applets[i] | | |||
104 | list.push({ | 75 | list.push({ | ||
105 | "index": (i + lastIndex), | 76 | "taskId": item.itemId, | ||
106 | "applet": item, | 77 | "name": item.display, | ||
107 | "taskId": item.pluginName, | 78 | "icon": item.decoration, | ||
108 | "name": item.title, | 79 | "applet": item.applet | ||
109 | "iconName": item.icon, | | |||
110 | "shortcut": item.globalShortcut | | |||
111 | }); | 80 | }); | ||
112 | } | 81 | } | ||
113 | list.sort(function(a, b) { | 82 | list.sort(function(a, b) { | ||
Context not available. | |||||
156 | QIconItem { | 125 | QIconItem { | ||
157 | width: units.iconSizes.small | 126 | width: units.iconSizes.small | ||
158 | height: width | 127 | height: width | ||
159 | icon: modelData.iconName || modelData.icon || "" | 128 | icon: modelData.icon | ||
160 | } | 129 | } | ||
161 | 130 | | |||
162 | QQC2.Label { | 131 | QQC2.Label { | ||
Context not available. | |||||
243 | id: keySequenceItem | 212 | id: keySequenceItem | ||
244 | anchors.right: parent.right | 213 | anchors.right: parent.right | ||
245 | 214 | | |||
246 | keySequence: modelData.shortcut | 215 | keySequence: modelData.applet ? modelData.applet.globalShortcut : "" | ||
247 | // only Plasmoids have that | 216 | // only Plasmoids have that | ||
248 | visible: modelData.hasOwnProperty("shortcut") | 217 | visible: modelData.hasOwnProperty("applet") | ||
249 | onKeySequenceChanged: { | 218 | onKeySequenceChanged: { | ||
250 | if (keySequence !== modelData.shortcut) { | 219 | if (modelData.applet && keySequence !== modelData.applet.globalShortcut) { | ||
251 | // both SNIs and plasmoids are listed in the same TableView | 220 | modelData.applet.globalShortcut = keySequence | ||
252 | // but they come from two separate models, so we need to subtract | | |||
253 | // the SNI model count to get the actual plasmoid index | | |||
254 | var index = modelData.index - statusNotifierModel.count | | |||
255 | plasmoid.applets[index].globalShortcut = keySequence | | |||
256 | 221 | | |||
257 | iconsPage.configurationChanged() | 222 | iconsPage.configurationChanged() | ||
258 | } | 223 | } | ||
Context not available. |