From f27bd2fc696242322ca17748ee618843573d17ee Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Sat, 15 Jan 2022 07:41:35 -0700 Subject: [PATCH] applets/devicenotifier: Make "removing" message more instructional When you unmount a device using the UI, the device shows a message saying, "Removing..." This message remains visible as long as the device is still processing file move or copy operations due to the use of async file IO. The device is not yet safe to unplug as long as the message is visible, but this is not obvious from the UI. As a result, it is possible for people to think it's stuck and unplug it anyway, causing data loss. This commit attempts to address that by showing a different message when the unmount takes more than one second, which tells the user what is actually happening and explicitly asks them not to unplug it yet. --- .../package/contents/ui/DeviceItem.qml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/applets/devicenotifier/package/contents/ui/DeviceItem.qml b/applets/devicenotifier/package/contents/ui/DeviceItem.qml index 0652ced3c3..bc0eab1649 100644 --- a/applets/devicenotifier/package/contents/ui/DeviceItem.qml +++ b/applets/devicenotifier/package/contents/ui/DeviceItem.qml @@ -102,6 +102,12 @@ PlasmaExtras.ExpandableListItem { } } + Timer { + id: unmountTimer + interval: 1000 + repeat: false + } + Component { id: deviceActionComponent QQC2.Action { } @@ -130,6 +136,7 @@ PlasmaExtras.ExpandableListItem { } else { service = sdSource.serviceForSource(udi); operation = service.operationDescription("unmount"); + unmountTimer.restart(); } service.startOperationCall(operation); if (wasMounted) { @@ -174,8 +181,12 @@ PlasmaExtras.ExpandableListItem { return "" } else if (deviceItem.state == 1) { return i18nc("Accessing is a less technical word for Mounting; translation should be short and mean \'Currently mounting this device\'", "Accessing…") - } else { + } else if (unmountTimer.running) { + // Unmounting, shown if unmount takes less than 1 second return i18nc("Removing is a less technical word for Unmounting; translation should be short and mean \'Currently unmounting this device\'", "Removing…") + } else { + // Unmounting; shown if unmount takes longer than 1 second + return i18n("Don't unplug yet! Files are still being transferred...") } } -- GitLab