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 @@ -29,6 +29,7 @@ id: rootItem signal sourceAdded(string source) + signal sourceRemoved(string source) property Component delegate width: units.gridUnit * 10 @@ -66,6 +67,22 @@ "dataSource": smSource}); } + function removeSource(source1, friendlyName1, source2, friendlyName2) { + var found = false; + for (var i = 0; i < sourcesModel.count; ++i) { + var obj = sourcesModel.get(i); + if (obj.source1 == encodeURIComponent(source1) && + obj.source2 == encodeURIComponent(source2)) { + sourcesModel.remove(i); + if (source2) { + smSource.disconnectSource(source2); + } + smSource.disconnectSource(source1); + break; + } + } + } + ListModel { id: sourcesModel } @@ -96,6 +113,7 @@ } } smSource.disconnectSource(source); + rootItem.sourceRemoved(source); } } Connections { diff --git a/applets/systemmonitor/net/contents/ui/net.qml b/applets/systemmonitor/net/contents/ui/net.qml --- a/applets/systemmonitor/net/contents/ui/net.qml +++ b/applets/systemmonitor/net/contents/ui/net.qml @@ -39,6 +39,17 @@ } } + onSourceRemoved: { + if (source.indexOf("network/interfaces/lo/") !== -1) { + return; + } + var match = source.match(/^network\/interfaces\/(\w+)\/transmitter\/data$/); + if (match) { + var rxSource = "network/interfaces/" + match[1] + "/receiver/data"; + root.removeSource(source, match[1], rxSource, match[1]); + } + } + delegate: DoublePlotter { function formatData(data) { var value = data.value * 1024 * 8