Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/package/contents/ui/ConfigEntries.qml
Show All 38 Lines | 30 | QtLayouts.GridLayout { | |||
---|---|---|---|---|---|
39 | columns: 2 // so we can indent the entries below... | 39 | columns: 2 // so we can indent the entries below... | ||
40 | 40 | | |||
41 | function saveConfig () { | 41 | function saveConfig () { | ||
42 | for (var i in tableView.model) { | 42 | for (var i in tableView.model) { | ||
43 | //tableView.model[i].applet.globalShortcut = tableView.model[i].shortcut | 43 | //tableView.model[i].applet.globalShortcut = tableView.model[i].shortcut | ||
44 | } | 44 | } | ||
45 | } | 45 | } | ||
46 | 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 { | ||||
60 | id: statusNotifierModel | ||||
61 | sourceModel: PlasmaCore.DataModel { | ||||
62 | dataSource: statusNotifierSource | ||||
63 | } | ||||
64 | } | ||||
65 | | ||||
47 | QtControls.CheckBox { | 66 | QtControls.CheckBox { | ||
48 | id: showAllCheckBox | 67 | id: showAllCheckBox | ||
49 | QtLayouts.Layout.fillWidth: true | 68 | QtLayouts.Layout.fillWidth: true | ||
50 | QtLayouts.Layout.columnSpan: iconsPage.columns | 69 | QtLayouts.Layout.columnSpan: iconsPage.columns | ||
51 | QtLayouts.Layout.row: 1 | 70 | QtLayouts.Layout.row: 1 | ||
52 | text: i18n("Always show all entries") | 71 | text: i18n("Always show all entries") | ||
53 | } | 72 | } | ||
54 | 73 | | |||
55 | QtControls.Button { // just for measurement | 74 | QtControls.Button { // just for measurement | ||
56 | id: measureButton | 75 | id: measureButton | ||
57 | text: "measureButton" | 76 | text: "measureButton" | ||
58 | visible: false | 77 | visible: false | ||
59 | } | 78 | } | ||
60 | 79 | | |||
61 | // resizeToContents does not take into account the heading | 80 | // resizeToContents does not take into account the heading | ||
62 | QtControls.Label { | 81 | QtControls.Label { | ||
63 | id: shortcutColumnMeasureLabel | 82 | id: shortcutColumnMeasureLabel | ||
64 | text: shortcutColumn.title | 83 | text: shortcutColumn.title | ||
65 | visible: false | 84 | visible: false | ||
66 | } | 85 | } | ||
67 | 86 | | |||
68 | function retrieveAllItems() { | 87 | function retrieveAllItems() { | ||
69 | print(plasmoid) | | |||
70 | print(plasmoid.rootItem.statusNotifierModel) | | |||
71 | var list = []; | 88 | var list = []; | ||
72 | for (var i = 0; i < plasmoid.rootItem.statusNotifierModel.count; ++i) { | 89 | for (var i = 0; i < statusNotifierModel.count; ++i) { | ||
73 | var item = plasmoid.rootItem.statusNotifierModel.get(i); | 90 | var item = statusNotifierModel.get(i); | ||
74 | list.push({ | 91 | list.push({ | ||
75 | "index": i, | 92 | "index": i, | ||
76 | "taskId": item.Id, | 93 | "taskId": item.Id, | ||
77 | "name": item.Title, | 94 | "name": item.Title, | ||
78 | "iconName": item.IconName, | 95 | "iconName": item.IconName, | ||
79 | "icon": item.Icon | 96 | "icon": item.Icon | ||
80 | }); | 97 | }); | ||
81 | } | 98 | } | ||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Line(s) | 241 | KQC.KeySequenceItem { | |||
228 | keySequence: modelData.shortcut | 245 | keySequence: modelData.shortcut | ||
229 | // only Plasmoids have that | 246 | // only Plasmoids have that | ||
230 | visible: modelData.hasOwnProperty("shortcut") | 247 | visible: modelData.hasOwnProperty("shortcut") | ||
231 | onKeySequenceChanged: { | 248 | onKeySequenceChanged: { | ||
232 | if (keySequence != modelData.shortcut) { | 249 | if (keySequence != modelData.shortcut) { | ||
233 | // both SNIs and plasmoids are listed in the same TableView | 250 | // both SNIs and plasmoids are listed in the same TableView | ||
234 | // but they come from two separate models, so we need to subtract | 251 | // but they come from two separate models, so we need to subtract | ||
235 | // the SNI model count to get the actual plasmoid index | 252 | // the SNI model count to get the actual plasmoid index | ||
236 | var index = modelData.index - plasmoid.rootItem.statusNotifierModel.count | 253 | var index = modelData.index - statusNotifierModel.count | ||
237 | plasmoid.applets[index].globalShortcut = keySequence | 254 | plasmoid.applets[index].globalShortcut = keySequence | ||
238 | 255 | | |||
239 | iconsPage.configurationChanged() | 256 | iconsPage.configurationChanged() | ||
240 | } | 257 | } | ||
241 | 258 | | |||
242 | shortcutColumn.resizeToContents() | 259 | shortcutColumn.resizeToContents() | ||
243 | } | 260 | } | ||
244 | } | 261 | } | ||
245 | } | 262 | } | ||
246 | } | 263 | } | ||
247 | } | 264 | } | ||
248 | } | 265 | } |