diff --git a/applets/systemmonitor/common/contents/ui/Applet.qml b/applets/systemmonitor/common/contents/ui/Applet.qml --- a/applets/systemmonitor/common/contents/ui/Applet.qml +++ b/applets/systemmonitor/common/contents/ui/Applet.qml @@ -53,17 +53,37 @@ return; } - smSource.connectSource(source1); - if (source2) { - smSource.connectSource(source2); + var match_disk = source1.match(/^(disk+)/i); + if ((match_disk)&&(plasmoid.configuration.sources.length == 0)) { + var match_device = source1.match(/^disk\/((sd|vd|hd)\w+)/i); + if (match_device) { + var device_number = match_device[1].match(/\d+/); + if (device_number == null) { + smSource.connectSource(source1); + if (source2) { + smSource.connectSource(source2); + } + sourcesModel.append( + {"source1": encodeURIComponent(source1), + "friendlyName1": friendlyName1, + "source2": encodeURIComponent(source2), + "friendlyName2": friendlyName2, + "dataSource": smSource}); + } + } + } + else { + smSource.connectSource(source1); + if (source2) { + smSource.connectSource(source2); + } + sourcesModel.append( + {"source1": encodeURIComponent(source1), + "friendlyName1": friendlyName1, + "source2": encodeURIComponent(source2), + "friendlyName2": friendlyName2, + "dataSource": smSource}); } - - sourcesModel.append( - {"source1": encodeURIComponent(source1), - "friendlyName1": friendlyName1, - "source2": encodeURIComponent(source2), - "friendlyName2": friendlyName2, - "dataSource": smSource}); } ListModel { diff --git a/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml b/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml --- a/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml +++ b/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml @@ -37,7 +37,20 @@ for (var i in mainColumn.children) { var child = mainColumn.children[i]; if (child.checked !== undefined) { - child.checked = true; + var childSource = child.source; + var match_disk = childSource.match(/^(disk+)/i); + if (match_disk) { + var match_device = childSource.match(/^disk%2F((sd|vd|hd)\w+)/i); + if (match_device) { + var device_number = match_device[1].match(/\d+/); + if (device_number == null) { + child.checked = true; + } + } + } + else { + child.checked = true; + } } } } else {