summaryrefslogtreecommitdiffstats
path: root/qt-mobile/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-24 09:44:47 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-24 09:44:47 -0700
commit0029844b1c889a88b4f5785426f4aad4caddc4f9 (patch)
tree3cb955536237386a64fb09ed75d21d7313e47443 /qt-mobile/qmlmanager.cpp
parent292982cdd551b0c42e7f411e3ccade4e50756e6d (diff)
parente93bb9230f19a054888fc6db09f3757412ab7cc5 (diff)
downloadsubsurface-0029844b1c889a88b4f5785426f4aad4caddc4f9.tar.gz
Merge branch 'devel' of https://github.com/gracie89/subsurface
Diffstat (limited to 'qt-mobile/qmlmanager.cpp')
-rw-r--r--qt-mobile/qmlmanager.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index a1c64191b..8cefbe95f 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -20,6 +20,7 @@ QMLManager::QMLManager()
//Initialize cloud credentials.
setCloudUserName(prefs.cloud_storage_email);
setCloudPassword(prefs.cloud_storage_password);
+ setSaveCloudPassword(prefs.save_password_local);
}
QMLManager::~QMLManager()
@@ -31,15 +32,22 @@ void QMLManager::savePreferences()
QSettings s;
s.beginGroup("CloudStorage");
s.setValue("email", cloudUserName());
- s.setValue("password", cloudPassword());
+ s.setValue("save_password_local", saveCloudPassword());
+ if (saveCloudPassword())
+ s.setValue("password", cloudPassword());
s.sync();
if (!same_string(prefs.cloud_storage_email, qPrintable(cloudUserName()))) {
free(prefs.cloud_storage_email);
prefs.cloud_storage_email = strdup(qPrintable(cloudUserName()));
}
- if (!same_string(prefs.cloud_storage_password, qPrintable(cloudPassword()))) {
- free(prefs.cloud_storage_password);
- prefs.cloud_storage_password = strdup(qPrintable(cloudPassword()));
+ if (saveCloudPassword() != prefs.save_password_local) {
+ prefs.save_password_local = saveCloudPassword();
+ }
+ if (saveCloudPassword()) {
+ if (!same_string(prefs.cloud_storage_password, qPrintable(cloudPassword()))) {
+ free(prefs.cloud_storage_password);
+ prefs.cloud_storage_password = strdup(qPrintable(cloudPassword()));
+ }
}
}
@@ -114,6 +122,16 @@ void QMLManager::saveChanges()
set_filename(fileName.toUtf8().data(), true);
mark_divelist_changed(false);
}
+bool QMLManager::saveCloudPassword() const
+{
+ return m_saveCloudPassword;
+}
+
+void QMLManager::setSaveCloudPassword(bool saveCloudPassword)
+{
+ m_saveCloudPassword = saveCloudPassword;
+}
+
QString QMLManager::cloudPassword() const
{