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 <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-04-03 18:00:00 -07:00
parent 4af9ee5dea
commit 616842c8c0
2 changed files with 5 additions and 2 deletions

View file

@ -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();
}

View file

@ -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);