From d9e8b4a7a49f78e60d40458c5de3ba22c239cb2f Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Fri, 4 Dec 2020 08:36:43 -0700 Subject: [PATCH] [applets/devicenotifier] Re-add "show popup when new device is plugged in" option This was removed in https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/185, however the original reasons for making the change no longer apply because we now have a clean place to put the option--in the new popup menu in the header. So let's re-add it, because hidden options are bad. :) BUG: 430017 FIXED-IN: 5.20 --- .../devicenotifier/package/contents/config/main.xml | 1 - .../package/contents/ui/devicenotifier.qml | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/applets/devicenotifier/package/contents/config/main.xml b/applets/devicenotifier/package/contents/config/main.xml index 980563f23..26c9e5e6f 100644 --- a/applets/devicenotifier/package/contents/config/main.xml +++ b/applets/devicenotifier/package/contents/config/main.xml @@ -18,7 +18,6 @@ false - true diff --git a/applets/devicenotifier/package/contents/ui/devicenotifier.qml b/applets/devicenotifier/package/contents/ui/devicenotifier.qml index 37b4a8a1a..6cf0d4818 100644 --- a/applets/devicenotifier/package/contents/ui/devicenotifier.qml +++ b/applets/devicenotifier/package/contents/ui/devicenotifier.qml @@ -228,6 +228,7 @@ Item { property var showRemovableDevicesAction property var showNonRemovableDevicesAction property var showAllDevicesAction + property var openAutomaticallyAction Component.onCompleted: { if (sdSource.connectedSources.count === 0) { @@ -254,6 +255,13 @@ Item { plasmoid.setActionSeparator("sep"); + plasmoid.setAction("openAutomatically", i18n("Show popup when new device is plugged in")); + devicenotifier.openAutomaticallyAction = plasmoid.action("openAutomatically"); + devicenotifier.openAutomaticallyAction.checkable = true; + devicenotifier.openAutomaticallyAction.checked = Qt.binding(() => {return plasmoid.configuration.popupOnNewDevice;}); + + plasmoid.setActionSeparator("sep2"); + if (devicenotifier.openAutomounterKcmAuthorized) { plasmoid.setAction("openAutomounterKcm", i18nc("Open auto mounter kcm", "Configure Removable Devices..."), "configure") } @@ -281,6 +289,10 @@ Item { plasmoid.configuration.allDevices = true; } + function action_openAutomatically() { + plasmoid.configuration.popupOnNewDevice = !plasmoid.configuration.popupOnNewDevice; + } + Plasmoid.onExpandedChanged: { popupEventSlot(plasmoid.expanded); }