aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-08 11:08:49 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-08 11:10:21 -0800
commitc1b3de61902ac392ffe2597a11a89664c9499304 (patch)
treeb91799ebda514eebe34c00a1283e36160a14589a /qt-mobile
parentd43a2c032bc7f0d76047cf9d55c32b850c669cd8 (diff)
downloadsubsurface-c1b3de61902ac392ffe2597a11a89664c9499304.tar.gz
Remember status of specific cloud account in settings
What matters is that the cloud storage for a specific email address has successfully been synced - and we need to remember this across restarts of the app. This way Subsurface-mobile can work with different accounts, even if offline. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r--qt-mobile/qmlmanager.cpp17
-rw-r--r--qt-mobile/qmlmanager.h1
2 files changed, 13 insertions, 5 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index e6a5d9b0b..bce25795d 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -42,7 +42,6 @@ extern "C" int gitProgressCB(int percent)
QMLManager::QMLManager() : m_locationServiceEnabled(false),
m_verboseEnabled(false),
- m_loadFromCloud(false),
reply(0)
{
m_instance = this;
@@ -54,9 +53,9 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
// create location manager service
locationProvider = new GpsLocation(&appendTextToLogStandalone, this);
set_git_update_cb(&gitProgressCB);
- QSettings s;
- if (s.contains("setLoadFromCloud") && s.value("setLoadFromCloud").toInt() == 1)
- setLoadFromCloud(true);
+
+ // make sure we know if the current cloud repo has been successfully synced
+ syncLoadFromCloud();
}
void QMLManager::finishSetup()
@@ -716,10 +715,18 @@ bool QMLManager::loadFromCloud() const
return m_loadFromCloud;
}
+void QMLManager::syncLoadFromCloud()
+{
+ QSettings s;
+ QString cloudMarker = QLatin1Literal("loadFromCloud") + QString(prefs.cloud_storage_email);
+ m_loadFromCloud = s.contains(cloudMarker) && s.value(cloudMarker).toBool();
+}
+
void QMLManager::setLoadFromCloud(bool done)
{
QSettings s;
- s.setValue("loadFromCloud", 1);
+ QString cloudMarker = QLatin1Literal("loadFromCloud") + QString(prefs.cloud_storage_email);
+ s.setValue(cloudMarker, done);
m_loadFromCloud = done;
emit loadFromCloudChanged();
}
diff --git a/qt-mobile/qmlmanager.h b/qt-mobile/qmlmanager.h
index 0f43f473c..4d9b9cc8c 100644
--- a/qt-mobile/qmlmanager.h
+++ b/qt-mobile/qmlmanager.h
@@ -48,6 +48,7 @@ public:
bool loadFromCloud() const;
void setLoadFromCloud(bool done);
+ void syncLoadFromCloud();
QString startPageText() const;
void setStartPageText(const QString& text);