summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-30 11:08:33 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-30 11:08:33 -0700
commitba9288fab6d7aa8527f7a75a717cdc88a68facd9 (patch)
tree3d779a9bbdba74ab13e2d4d652c5c6306afd931c
parent7afcadef532a06de7ae9bf515e81971babd139fa (diff)
downloadsubsurface-ba9288fab6d7aa8527f7a75a717cdc88a68facd9.tar.gz
QML UI: when first entering cloud credentials, force cloud connection
With offline the default now, we need to force a connection at least once so that the repos are in sync. And then of course we need to return to the correct state, regardless on whether this connection succeeded or failed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qmlmanager.cpp14
-rw-r--r--mobile-widgets/qmlmanager.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index a0ed9873c..82ea319bb 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -286,6 +286,10 @@ void QMLManager::saveCloudCredentials()
// we therefore know that no one else is already accessing THIS git repo;
// let's make sure we stay the only ones doing so
alreadySaving = true;
+ // since we changed credentials, we need to try to connect to the cloud, regardless
+ // of whether we're in offline mode or not, to make sure the repository is synced
+ currentGitLocalOnly = prefs.git_local_only;
+ prefs.git_local_only = false;
openLocalThenRemote(url);
}
}
@@ -461,11 +465,21 @@ successful_exit:
}
}
setAccessingCloud(-1);
+ // if we got here just for an initial connection to the cloud, reset to offline
+ if (currentGitLocalOnly) {
+ currentGitLocalOnly = false;
+ prefs.git_local_only = true;
+ }
return;
}
void QMLManager::revertToNoCloudIfNeeded()
{
+ if (currentGitLocalOnly) {
+ // we tried to connect to the cloud for the first time and that failed
+ currentGitLocalOnly = false;
+ prefs.git_local_only = true;
+ }
if (oldStatus() == NOCLOUD) {
// we tried to switch to a cloud account and had previously used local data,
// but connecting to the cloud account (and subsequently merging the local
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index 965a68d40..906e7b0b2 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -174,6 +174,7 @@ private:
bool checkLocation(DiveObjectHelper *myDive, struct dive *d, QString location, QString gps);
bool checkDuration(DiveObjectHelper *myDive, struct dive *d, QString duration);
bool checkDepth(DiveObjectHelper *myDive, struct dive *d, QString depth);
+ bool currentGitLocalOnly;
signals:
void cloudUserNameChanged();