diff options
author | Tomaz Canabrava <tomaz.canabrava@gmail.com> | 2016-08-10 13:43:39 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-08-27 10:55:40 -0700 |
commit | b5e98ec993c2648dd0f6e19eab490963625931a2 (patch) | |
tree | ee70aa071844e732b4981ebc80319d26f08e3080 | |
parent | 81d5d82b7bfb1a7a1cfe44b8d33befe9b31a2099 (diff) | |
download | subsurface-b5e98ec993c2648dd0f6e19eab490963625931a2.tar.gz |
Settings update: Fix "Network" and "CloudStorage"
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | desktop-widgets/preferences/preferences_network.cpp | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/desktop-widgets/preferences/preferences_network.cpp b/desktop-widgets/preferences/preferences_network.cpp index 5d7f70665..2e0ebbd32 100644 --- a/desktop-widgets/preferences/preferences_network.cpp +++ b/desktop-widgets/preferences/preferences_network.cpp @@ -52,20 +52,18 @@ void PreferencesNetwork::syncSettings() 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()); - s.setValue("proxy_port", ui->proxyPort->value()); - SB("proxy_auth", ui->proxyAuthRequired); - s.setValue("proxy_user", ui->proxyUsername->text()); - s.setValue("proxy_pass", ui->proxyPassword->text()); - s.endGroup(); + proxy->setType(ui->proxyType->itemData(ui->proxyType->currentIndex()).toInt()); + proxy->setHost(ui->proxyHost->text()); + proxy->setPort(ui->proxyPort->value()); + proxy->setAuth(ui->proxyAuthRequired->isChecked()); + proxy->setUser(ui->proxyUsername->text()); + proxy->setPass(ui->proxyPassword->text()); - s.beginGroup("CloudStorage"); QString email = ui->cloud_storage_email->text(); QString password = ui->cloud_storage_password->text(); QString newpassword = ui->cloud_storage_new_passwd->text(); + + //TODO: Change this to the Cloud Storage Stuff, not preferences. if (prefs.cloud_verification_status == CS_VERIFIED && !newpassword.isEmpty()) { // deal with password change if (!email.isEmpty() && !password.isEmpty()) { @@ -79,8 +77,7 @@ void PreferencesNetwork::syncSettings() connect(cloudAuth, SIGNAL(passwordChangeSuccessful()), this, SLOT(passwordUpdateSuccessfull())); cloudAuth->backend(email, password, "", newpassword); ui->cloud_storage_new_passwd->setText(""); - free(prefs.cloud_storage_newpassword); - prefs.cloud_storage_newpassword = strdup(qPrintable(newpassword)); + cloud->setNewPassword(newpassword); } } } else if (prefs.cloud_verification_status == CS_UNKNOWN || @@ -89,7 +86,7 @@ void PreferencesNetwork::syncSettings() password != prefs.cloud_storage_password) { // different credentials - reset verification status - prefs.cloud_verification_status = CS_UNKNOWN; + cloud->setVerificationStatus(CS_UNKNOWN); if (!email.isEmpty() && !password.isEmpty()) { // connect to backend server to check / create credentials QRegularExpression reg("^[a-zA-Z0-9@.+_-]+$"); @@ -114,22 +111,12 @@ void PreferencesNetwork::syncSettings() cloudAuth->backend(email, password, pin); } } - SAVE_OR_REMOVE("email", default_prefs.cloud_storage_email, email); - SAVE_OR_REMOVE("save_password_local", default_prefs.save_password_local, ui->save_password_local->isChecked()); - if (ui->save_password_local->isChecked()) { - SAVE_OR_REMOVE("password", default_prefs.cloud_storage_password, password); - } else { - s.remove("password"); - free(prefs.cloud_storage_password); - prefs.cloud_storage_password = strdup(qPrintable(password)); - } - SAVE_OR_REMOVE("cloud_verification_status", default_prefs.cloud_verification_status, prefs.cloud_verification_status); - SAVE_OR_REMOVE("cloud_background_sync", default_prefs.cloud_background_sync, ui->cloud_background_sync->isChecked()); - - // at this point we intentionally do not have a UI for changing this - // it could go into some sort of "advanced setup" or something - SAVE_OR_REMOVE("cloud_base_url", default_prefs.cloud_base_url, prefs.cloud_base_url); - s.endGroup(); + cloud->setEmail(email); + cloud->setSavePasswordLocal(ui->save_password_local->isChecked()); + cloud->setPassword(password); + cloud->setVerificationStatus(prefs.cloud_verification_status); + cloud->setBackgroundSync(ui->cloud_background_sync->isChecked()); + cloud->setBaseUrl(prefs.cloud_base_url); } void PreferencesNetwork::cloudPinNeeded() |