summaryrefslogtreecommitdiffstats
path: root/core/cloudstorage.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-07-23 12:53:37 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-07-23 12:53:37 +0900
commit9815eaf1ed039d7831c1de64c4f083ebcc90abe7 (patch)
treec8b69b45c1e8318c08f66cb44ebb83392689bc05 /core/cloudstorage.cpp
parent0b5a1719a17eaaaa4d08ca34b17d4b4600083715 (diff)
downloadsubsurface-9815eaf1ed039d7831c1de64c4f083ebcc90abe7.tar.gz
Use preferences object to correctly store cloud status
There are a lot more places all over Subsurface where this needs to be cleaned up. The converstion of the preferences system has been a complete mess. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/cloudstorage.cpp')
-rw-r--r--core/cloudstorage.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/cloudstorage.cpp b/core/cloudstorage.cpp
index 575191891..6cbc76991 100644
--- a/core/cloudstorage.cpp
+++ b/core/cloudstorage.cpp
@@ -2,7 +2,7 @@
#include "pref.h"
#include "dive.h"
#include "helpers.h"
-
+#include "core/subsurface-qt/SettingsObjectWrapper.h"
#include <QApplication>
CloudStorageAuthenticate::CloudStorageAuthenticate(QObject *parent) :
@@ -48,8 +48,10 @@ void CloudStorageAuthenticate::uploadFinished()
QString cloudAuthReply(reply->readAll());
qDebug() << "Completed connection with cloud storage backend, response" << cloudAuthReply;
+ CloudStorageSettings csSettings(parent());
+
if (cloudAuthReply == QLatin1String("[VERIFIED]") || cloudAuthReply == QLatin1String("[OK]")) {
- prefs.cloud_verification_status = CS_VERIFIED;
+ csSettings.setVerificationStatus(CS_VERIFIED);
/* TODO: Move this to a correct place
NotificationWidget *nw = MainWindow::instance()->getNotificationWidget();
if (nw->getNotificationText() == myLastError)
@@ -57,7 +59,7 @@ void CloudStorageAuthenticate::uploadFinished()
*/
myLastError.clear();
} else if (cloudAuthReply == QLatin1String("[VERIFY]")) {
- prefs.cloud_verification_status = CS_NEED_TO_VERIFY;
+ csSettings.setVerificationStatus(CS_NEED_TO_VERIFY);
} else if (cloudAuthReply == QLatin1String("[PASSWDCHANGED]")) {
free(prefs.cloud_storage_password);
prefs.cloud_storage_password = prefs.cloud_storage_newpassword;
@@ -65,7 +67,7 @@ void CloudStorageAuthenticate::uploadFinished()
emit passwordChangeSuccessful();
return;
} else {
- prefs.cloud_verification_status = CS_INCORRECT_USER_PASSWD;
+ csSettings.setVerificationStatus(CS_INCORRECT_USER_PASSWD);
myLastError = cloudAuthReply;
report_error("%s", qPrintable(cloudAuthReply));
/* TODO: Emit a signal with the error