summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@gmail.com>2016-08-10 13:27:03 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-08-27 10:55:40 -0700
commit81d5d82b7bfb1a7a1cfe44b8d33befe9b31a2099 (patch)
tree31392ef07c43c9ac68ca95805b4865c5859c0848 /desktop-widgets
parent048379cc2b56257be4a435bb707d8a18c9958371 (diff)
downloadsubsurface-81d5d82b7bfb1a7a1cfe44b8d33befe9b31a2099.tar.gz
Settings update: Clean up save user id local
So, prefs.save_userid_local is being set outside of a preferences set (it's set to true and false while loading the files via xml or git) and because of that I had to bypass a few method calls. When something triggers a preferences change, the application will be notified that the preferences changed, thing that I couldn't do while reading the xml or git because that should be local-only. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/preferences/preferences_network.cpp16
-rw-r--r--desktop-widgets/subsurfacewebservices.cpp4
2 files changed, 11 insertions, 9 deletions
diff --git a/desktop-widgets/preferences/preferences_network.cpp b/desktop-widgets/preferences/preferences_network.cpp
index 7d89d4496..5d7f70665 100644
--- a/desktop-widgets/preferences/preferences_network.cpp
+++ b/desktop-widgets/preferences/preferences_network.cpp
@@ -4,7 +4,7 @@
#include "subsurfacewebservices.h"
#include "core/prefs-macros.h"
#include "core/cloudstorage.h"
-
+#include "core/subsurface-qt/SettingsObjectWrapper.h"
#include <QNetworkProxy>
#include <QSettings>
@@ -29,8 +29,6 @@ PreferencesNetwork::~PreferencesNetwork()
void PreferencesNetwork::refreshSettings()
{
- QSettings s;
-
ui->proxyHost->setText(prefs.proxy_host);
ui->proxyPort->setValue(prefs.proxy_port);
ui->proxyAuthRequired->setChecked(prefs.proxy_auth);
@@ -42,17 +40,19 @@ void PreferencesNetwork::refreshSettings()
ui->save_password_local->setChecked(prefs.save_password_local);
ui->cloud_background_sync->setChecked(prefs.cloud_background_sync);
ui->save_uid_local->setChecked(prefs.save_userid_local);
- ui->default_uid->setText(s.value("subsurface_webservice_uid").toString().toUpper());
-
+ ui->default_uid->setText(QString(prefs.userid).toUpper());
cloudPinNeeded();
}
void PreferencesNetwork::syncSettings()
{
- QSettings s;
- s.setValue("subsurface_webservice_uid", ui->default_uid->text().toUpper());
- set_save_userid_local(ui->save_uid_local->checkState());
+ auto cloud = SettingsObjectWrapper::instance()->cloud_storage;
+ auto proxy = SettingsObjectWrapper::instance()->proxy;
+
+ cloud->setUserId(ui->default_uid->text().toUpper());
+ cloud->setSaveUserIdLocal(ui->save_uid_local->checkState());
+ QSettings s;
s.beginGroup("Network");
s.setValue("proxy_type", ui->proxyType->itemData(ui->proxyType->currentIndex()).toInt());
s.setValue("proxy_host", ui->proxyHost->text());
diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp
index bd798c729..68b7737c3 100644
--- a/desktop-widgets/subsurfacewebservices.cpp
+++ b/desktop-widgets/subsurfacewebservices.cpp
@@ -8,6 +8,7 @@
#include "desktop-widgets/maintab.h"
#include "core/display.h"
#include "core/membuffer.h"
+#include "core/subsurface-qt/SettingsObjectWrapper.h"
#include <errno.h>
#include "core/cloudstorage.h"
@@ -436,7 +437,8 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton *button)
QSettings s;
QString qDialogUid = ui.userID->text().toUpper();
bool qSaveUid = ui.saveUidLocal->checkState();
- set_save_userid_local(qSaveUid);
+ SettingsObjectWrapper::instance()->cloud_storage->setSaveUserIdLocal(qSaveUid);
+
if (qSaveUid) {
QString qSettingUid = s.value("subsurface_webservice_uid").toString();
QString qFileUid = QString(prefs.userid);