From 59ce9a3e9f162992e5158c3a5eaebf2ef3352eae Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Tue, 13 Oct 2020 15:47:58 +0000 Subject: [PATCH] [applets/devicenotifier] Don't offer to unmount non-removable devices The previous check for whether a device was non-removable in the delegate was faulty and was doing too much work, which caused it to miss non-root internal disks. In fact, we can already get this data straight from the data engine. This fixes the bug and removes code in net. BUG: 427176 FIXED-IN: 5.20.1 (cherry picked from commit 677d5dd872efae7c08015ea88454fdb991dc2fdf) --- .../devicenotifier/package/contents/ui/DeviceItem.qml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/applets/devicenotifier/package/contents/ui/DeviceItem.qml b/applets/devicenotifier/package/contents/ui/DeviceItem.qml index ce2dc4e7b..1b2b2e636 100644 --- a/applets/devicenotifier/package/contents/ui/DeviceItem.qml +++ b/applets/devicenotifier/package/contents/ui/DeviceItem.qml @@ -36,10 +36,6 @@ PlasmaExtras.ExpandableListItem { readonly property int state: sdSource.data[udi] ? sdSource.data[udi].State : 0 readonly property int operationResult: (model["Operation result"]) - // don't show unmount actions for root and media players; instead, show an - // "Open in file manager" button instead, so the user can do something useful - readonly property bool unmountable: sdSource.data[udi]["File Path"] !== "/" - && model["Device Types"].indexOf("Portable Media Player") == -1 readonly property bool isMounted: devicenotifier.isMounted(udi) readonly property bool hasMessage: statusSource.lastUdi == udi && statusSource.data[statusSource.last] ? true : false readonly property var message: hasMessage ? statusSource.data[statusSource.last] || ({}) : ({}) @@ -124,7 +120,7 @@ PlasmaExtras.ExpandableListItem { var service var operationName var operation - if (!deviceItem.unmountable) { + if (!sdSource.data[udi].Removable) { service = hpSource.serviceForSource(udi); operation = service.operationDescription('invokeAction'); operation.predicate = "test-predicate-openinwindow.desktop"; @@ -196,14 +192,14 @@ PlasmaExtras.ExpandableListItem { defaultActionButtonAction: QQC2.Action { icon.name: { - if (!deviceItem.unmountable) { + if (!sdSource.data[udi].Removable) { return "document-open-folder" } else { return isMounted ? "media-eject" : "media-mount" } } text: { - if (!deviceItem.unmountable) { + if (!sdSource.data[udi].Removable) { return i18n("Open in File Manager") } else { var types = model["Device Types"];