diff --git a/package/contents/ui/main.qml b/package/contents/ui/main.qml index 75ae04d..3c362f1 100644 --- a/package/contents/ui/main.qml +++ b/package/contents/ui/main.qml @@ -55,8 +55,8 @@ Item { property double iconBottomMargin: itemHeight * plasmoid.configuration.iconBottomMargin * 0.01 property bool enableLabelDropShadow: plasmoid.configuration.enableLabelDropShadow - property var systemmonitorAvailableSources - property var systemmonitorSourcesToAdd + property var systemmonitorAvailableSources: [] + property var systemmonitorSourcesToAdd: [] property int numberOfParts: temperatureModel.count @@ -171,13 +171,6 @@ Item { reloadAllSources() } - function getSystemmonitorAvailableSources() { - if (!systemmonitorAvailableSources) { - systemmonitorAvailableSources = systemmonitorDS.sources - } - return systemmonitorAvailableSources - } - function action_reloadSources() { reloadAllSources() } @@ -194,10 +187,6 @@ Item { systemmonitorAvailableSources = [] } - if (!systemmonitorSourcesToAdd) { - systemmonitorSourcesToAdd = [] - } - if (systemmonitorDS.connectedSources === undefined) { systemmonitorDS.connectedSources = [] } @@ -281,10 +270,12 @@ Item { dbgprint('adding source to systemmonitorDS: ' + source) - if (getSystemmonitorAvailableSources().indexOf(source) > -1) { + if (systemmonitorDS.sources.indexOf(source) > -1) { + // this is an existing source of systemmonitorDS so we can connect it dbgprint('adding to connected') addToSourcesOfDatasource(systemmonitorDS, source) } else { + // the source does not exist in systemmonitorDS (yet...) so we can't add yet it but we store it to add it if it appears later dbgprint('adding to sta') systemmonitorSourcesToAdd.push(source) } @@ -313,7 +304,6 @@ Item { if (source.indexOf(lmSensorsStart) === 0 || source.indexOf(acpiStart) === 0) { - systemmonitorAvailableSources.push(source) var staIndex = systemmonitorSourcesToAdd.indexOf(source) if (staIndex > -1) { addToSourcesOfDatasource(systemmonitorDS, source)