Changeset View
Changeset View
Standalone View
Standalone View
applets/systemmonitor/common/contents/ui/ConfigGeneral.qml
Show All 25 Lines | |||||
26 | Item { | 26 | Item { | ||
27 | id: iconsPage | 27 | id: iconsPage | ||
28 | width: childrenRect.width | 28 | width: childrenRect.width | ||
29 | height: childrenRect.height | 29 | height: childrenRect.height | ||
30 | implicitWidth: mainColumn.implicitWidth | 30 | implicitWidth: mainColumn.implicitWidth | ||
31 | implicitHeight: mainColumn.implicitHeight | 31 | implicitHeight: mainColumn.implicitHeight | ||
32 | 32 | | |||
33 | property var cfg_sources: [] | 33 | property var cfg_sources: [] | ||
34 | onCfg_sourcesChanged: { | 34 | | ||
35 | function sourcesChanged() { | ||||
35 | if (! cfg_sources) { cfg_sources = [] } | 36 | if (! cfg_sources) { cfg_sources = [] } | ||
36 | if (cfg_sources.length == 0) { | 37 | if (cfg_sources.length == 0) { | ||
37 | for (var i in mainColumn.children) { | 38 | for (var i in mainColumn.children) { | ||
38 | var child = mainColumn.children[i]; | 39 | var child = mainColumn.children[i]; | ||
39 | if (child.checked !== undefined) { | 40 | if (child.checked !== undefined) { | ||
40 | child.checked = true; | 41 | child.checked = true; | ||
41 | } | 42 | } | ||
42 | } | 43 | } | ||
43 | } else { | 44 | } else { | ||
44 | for (var i in mainColumn.children) { | 45 | for (var i in mainColumn.children) { | ||
45 | var child = mainColumn.children[i]; | 46 | var child = mainColumn.children[i]; | ||
46 | if (child.checked !== undefined) { | 47 | if (child.checked !== undefined) { | ||
47 | child.checked = cfg_sources.indexOf(child.source) !== -1; | 48 | child.checked = cfg_sources.indexOf(child.source) !== -1; | ||
48 | } | 49 | } | ||
49 | } | 50 | } | ||
50 | } | 51 | } | ||
51 | } | 52 | } | ||
53 | | ||||
54 | onCfg_sourcesChanged: { | ||||
55 | sourcesChanged(); | ||||
56 | } | ||||
57 | | ||||
52 | property int cfg_updateInterval | 58 | property int cfg_updateInterval | ||
53 | 59 | | |||
54 | signal sourceAdded(string source) | 60 | signal sourceAdded(string source) | ||
55 | 61 | | |||
56 | function addSource(source, friendlyName) { | 62 | function addSource(source, friendlyName) { | ||
57 | var found = false; | 63 | var found = false; | ||
58 | for (var i = 0; i < sourcesModel.count; ++i) { | 64 | for (var i = 0; i < sourcesModel.count; ++i) { | ||
59 | var obj = sourcesModel.get(i); | 65 | var obj = sourcesModel.get(i); | ||
Show All 29 Lines | 80 | PlasmaCore.DataSource { | |||
89 | } | 95 | } | ||
90 | } | 96 | } | ||
91 | 97 | | |||
92 | Component.onCompleted: { | 98 | Component.onCompleted: { | ||
93 | for (var i in smSource.sources) { | 99 | for (var i in smSource.sources) { | ||
94 | var source = smSource.sources[i]; | 100 | var source = smSource.sources[i]; | ||
95 | iconsPage.sourceAdded(source); | 101 | iconsPage.sourceAdded(source); | ||
96 | } | 102 | } | ||
103 | sourcesChanged(); | ||||
97 | } | 104 | } | ||
98 | 105 | | |||
99 | ListModel { | 106 | ListModel { | ||
100 | id: sourcesModel | 107 | id: sourcesModel | ||
101 | } | 108 | } | ||
102 | 109 | | |||
103 | Layouts.ColumnLayout { | 110 | Layouts.ColumnLayout { | ||
104 | id: mainColumn | 111 | id: mainColumn | ||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |