From a7b2ecdb12b86cacba894309779e4ea1dbfdeed9 Mon Sep 17 00:00:00 2001 From: Thomas Surrel Date: Fri, 12 Oct 2018 23:18:06 +0200 Subject: [PATCH] [Device Notifier] Restore busy indicator Summary: This patch fixes two issues: - the 'state' of the device now propagates correctly, that makes the busy indicator be displayed again, device emblems are also updated correctly - there is no more delay between the moment when the device is actually mounted and the moment the device notifier says it is. The worst case used to be 5 seconds. BUG: 354321 BUG: 399986 Reviewers: #plasma, #vdg, broulik, bruns, ngraham, davidedmundson Reviewed By: #plasma, #vdg, ngraham, davidedmundson Subscribers: mart, cfeck, ngraham, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D16170 --- .../package/contents/ui/DeviceItem.qml | 15 +++++++++++++-- .../package/contents/ui/devicenotifier.qml | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/applets/devicenotifier/package/contents/ui/DeviceItem.qml b/applets/devicenotifier/package/contents/ui/DeviceItem.qml index 7dbe7b5fc..c2ee95f57 100644 --- a/applets/devicenotifier/package/contents/ui/DeviceItem.qml +++ b/applets/devicenotifier/package/contents/ui/DeviceItem.qml @@ -119,6 +119,19 @@ MouseArea { } } + Timer { + id: updateStorageSpaceTimer + interval: 5000 + repeat: true + running: mounted && plasmoid.expanded + triggeredOnStart: true // Update the storage space as soon as we open the plasmoid + onTriggered: { + var service = sdSource.serviceForSource(udi); + var operation = service.operationDescription("updateFreespace"); + service.startOperationCall(operation); + } + } + RowLayout { id: row anchors.horizontalCenter: parent.horizontalCenter @@ -239,8 +252,6 @@ MouseArea { font.pointSize: theme.smallestFont.pointSize visible: deviceItem.state != 0 || (!actionsList.visible && !deviceItem.hasMessage) text: { - // FIXME: state changes do not reach the plasmoid if the - // device was already attached when the plasmoid was initialized if (deviceItem.state == 0) { if (!hpSource.data[udi]) { return "" diff --git a/applets/devicenotifier/package/contents/ui/devicenotifier.qml b/applets/devicenotifier/package/contents/ui/devicenotifier.qml index 1e89d1b83..16e441928 100644 --- a/applets/devicenotifier/package/contents/ui/devicenotifier.qml +++ b/applets/devicenotifier/package/contents/ui/devicenotifier.qml @@ -109,7 +109,7 @@ Item { id: sdSource engine: "soliddevice" connectedSources: hpSource.sources - interval: plasmoid.expanded ? 5000 : 0 + interval: 0 property string last onSourceAdded: { disconnectSource(source);