From 619fbaf1e231a8f54e3a7458f1f3081deab1825b Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Wed, 19 Jul 2017 09:16:47 +0200 Subject: QML UI: Allow cancel of ongoing download This commit adds the capability to cancel a running download from DC. The actual cancel is fully handled in the underlying libdivecomputer code. As the user may be interested in the dives downloaded up to the moment of cancel, do not just close the download screen (as it was before this commit). Now, the button changes to when the download is started, and pressing cancel, only cancels the download and does not close the download screen, but presents the so far downloaded data. When no download is running, the button just quits the screen as before. Fixes: #485 Signed-off-by: Jan Mulder --- mobile-widgets/qml/DownloadFromDiveComputer.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mobile-widgets/qml') diff --git a/mobile-widgets/qml/DownloadFromDiveComputer.qml b/mobile-widgets/qml/DownloadFromDiveComputer.qml index a9b34f34f..32ea5dfed 100644 --- a/mobile-widgets/qml/DownloadFromDiveComputer.qml +++ b/mobile-widgets/qml/DownloadFromDiveComputer.qml @@ -201,14 +201,16 @@ Kirigami.Page { antialiasing: true radius: Kirigami.Units.smallSpacing * 2 } - text: qsTr("Quit") + text: progressBar.visible ? qsTr("Cancel") : qsTr("Quit") contentItem: Text { text: quitbutton.text color: subsurfaceTheme.darkerPrimaryTextColor } onClicked: { + manager.cancelDownloadDC() + if (!progressBar.visible) + stackView.pop(); manager.appendTextToLog("exit DCDownload screen") - stackView.pop(); } } } -- cgit v1.2.3-70-g09d2