From 616842c8c00654718ba3390b055eb946aaa4cff4 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 3 Apr 2016 18:00:00 -0700 Subject: [PATCH] QML UI: be more careful when to show us accessing the cloud There may be other paths where we potentially show the wrong status to the user... but at least with this it times out eventually; there shouldn't be any single operation that isn't broken down with progress markers that takes more than 10 seconds, so keeping the notification around for 30 seconds seems very conservative. Signed-off-by: Dirk Hohndel --- qt-mobile/qml/main.qml | 4 +++- qt-mobile/qmlmanager.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/qt-mobile/qml/main.qml b/qt-mobile/qml/main.qml index 3ed5aeac9..6b6116611 100644 --- a/qt-mobile/qml/main.qml +++ b/qt-mobile/qml/main.qml @@ -22,7 +22,9 @@ Kirigami.ApplicationWindow { property bool showingDiveList: false onAccessingCloudChanged: { if (accessingCloud >= 0) { - showPassiveNotification("Accessing Subsurface Cloud Storage " + accessingCloud +"%", 500000); + // we now keep updating this to show progress, so timing out after 30 seconds is more useful + // but should still be very conservative + showPassiveNotification("Accessing Subsurface Cloud Storage " + accessingCloud +"%", 30000); } else { hidePassiveNotification(); } diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index 3f4e4c2ec..b8683de43 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -122,6 +122,7 @@ void QMLManager::openLocalThenRemote(QString url) QByteArray fileNamePrt = QFile::encodeName(url); prefs.git_local_only = true; int error = parse_file(fileNamePrt.data()); + setAccessingCloud(-1); prefs.git_local_only = false; if (error) { appendTextToLog(QStringLiteral("loading dives from cache failed %1").arg(error)); @@ -143,7 +144,6 @@ void QMLManager::openLocalThenRemote(QString url) appendTextToLog(QStringLiteral("%1 dives loaded from cache").arg(i)); } appendTextToLog(QStringLiteral("have cloud credentials, trying to connect")); - setAccessingCloud(0); tryRetrieveDataFromBackend(); } @@ -235,6 +235,7 @@ void QMLManager::checkCredentialsAndExecute(execute_function_type execute) // and (if we haven't done so) load the dive list if (!same_string(prefs.cloud_storage_email, "") && !same_string(prefs.cloud_storage_password, "")) { + setAccessingCloud(0); setStartPageText(tr("Testing cloud credentials")); appendTextToLog("Have credentials, let's see if they are valid"); connect(manager(), &QNetworkAccessManager::authenticationRequired, this, &QMLManager::provideAuth, Qt::UniqueConnection);