From eb6f6c2566622b883ca43138f8adee3c29f1f3fa Mon Sep 17 00:00:00 2001 From: Pavel Mars Date: Thu, 5 Dec 2019 23:56:14 +0000 Subject: [PATCH] Keep at least one system monitor alive Added a ban on disabling the last checkbox in the widget settings. There will always be at least one graph. If the user disables the last checkbox, all other checkboxes will automatically get enabled in the settings. It may be inconvenient for users to uncheck a large number of checkboxes. --- applets/systemmonitor/common/contents/ui/ConfigGeneral.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml b/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml index 3f025ffaf..3e8f679ef 100644 --- a/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml +++ b/applets/systemmonitor/common/contents/ui/ConfigGeneral.qml @@ -160,8 +160,10 @@ Item { } } else { var idx = cfg_sources.indexOf(model.source); - if (idx !== -1) { - cfg_sources.splice(idx, 1); + if (cfg_sources.length !== 1) { // This condition prohibits turning off the last item from the list. + if (idx !== -1) { + cfg_sources.splice(idx, 1); + } } } cfg_sourcesChanged();