diff options
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 6 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_defaults.cpp | 3 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_network.cpp | 33 |
3 files changed, 22 insertions, 20 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index cca10fd86..ff525eb00 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -442,8 +442,8 @@ void MainWindow::on_actionDiveSiteEdit_triggered() { void MainWindow::enableDisableCloudActions() { - ui.actionCloudstorageopen->setEnabled(prefs.cloud_verification_status == CS_VERIFIED); - ui.actionCloudstoragesave->setEnabled(prefs.cloud_verification_status == CS_VERIFIED); + ui.actionCloudstorageopen->setEnabled(prefs.cloud_verification_status == qPref::CS_VERIFIED); + ui.actionCloudstoragesave->setEnabled(prefs.cloud_verification_status == qPref::CS_VERIFIED); } PlannerDetails *MainWindow::plannerDetails() const { @@ -751,7 +751,7 @@ void MainWindow::closeCurrentFile() void MainWindow::updateCloudOnlineStatus() { - bool is_cloud = existing_filename && prefs.cloud_git_url && prefs.cloud_verification_status == CS_VERIFIED && + bool is_cloud = existing_filename && prefs.cloud_git_url && prefs.cloud_verification_status == qPref::CS_VERIFIED && strstr(existing_filename, prefs.cloud_git_url); ui.actionCloudOnline->setEnabled(is_cloud); ui.actionCloudOnline->setChecked(is_cloud && !prefs.git_local_only); diff --git a/desktop-widgets/preferences/preferences_defaults.cpp b/desktop-widgets/preferences/preferences_defaults.cpp index 7ae5e38ae..e93848f17 100644 --- a/desktop-widgets/preferences/preferences_defaults.cpp +++ b/desktop-widgets/preferences/preferences_defaults.cpp @@ -3,6 +3,7 @@ #include "ui_preferences_defaults.h" #include "core/dive.h" #include "core/subsurface-qt/SettingsObjectWrapper.h" +#include "core/settings/qPref.h" #include <QFileDialog> @@ -61,7 +62,7 @@ void PreferencesDefaults::refreshSettings() ui->velocitySlider->setValue(prefs.animation_speed); ui->btnUseDefaultFile->setChecked(prefs.use_default_file); - if (prefs.cloud_verification_status == CS_VERIFIED) { + if (prefs.cloud_verification_status == qPref::CS_VERIFIED) { ui->cloudDefaultFile->setEnabled(true); } else { if (ui->cloudDefaultFile->isChecked()) diff --git a/desktop-widgets/preferences/preferences_network.cpp b/desktop-widgets/preferences/preferences_network.cpp index 193a38c89..37dbc5721 100644 --- a/desktop-widgets/preferences/preferences_network.cpp +++ b/desktop-widgets/preferences/preferences_network.cpp @@ -5,6 +5,7 @@ #include "core/cloudstorage.h" #include "core/dive.h" #include "core/subsurface-qt/SettingsObjectWrapper.h" +#include "core/settings/qPref.h" #include <QNetworkProxy> PreferencesNetwork::PreferencesNetwork() : AbstractPreferencesWidget(tr("Network"),QIcon(":preferences-system-network-icon"), 9), ui(new Ui::PreferencesNetwork()) @@ -62,7 +63,7 @@ void PreferencesNetwork::syncSettings() 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()) { + if (prefs.cloud_verification_status == qPref::CS_VERIFIED && !newpassword.isEmpty()) { // deal with password change if (!email.isEmpty() && !password.isEmpty()) { // connect to backend server to check / create credentials @@ -83,14 +84,14 @@ void PreferencesNetwork::syncSettings() ui->cloud_storage_new_passwd->setText(""); cloud->setNewPassword(newpassword); } - } else if (prefs.cloud_verification_status == CS_UNKNOWN || - prefs.cloud_verification_status == CS_INCORRECT_USER_PASSWD || + } else if (prefs.cloud_verification_status == qPref::CS_UNKNOWN || + prefs.cloud_verification_status == qPref::CS_INCORRECT_USER_PASSWD || email != prefs.cloud_storage_email || password != prefs.cloud_storage_password) { // different credentials - reset verification status int oldVerificationStatus = cloud->verificationStatus(); - cloud->setVerificationStatus(CS_UNKNOWN); + cloud->setVerificationStatus(qPref::CS_UNKNOWN); if (!email.isEmpty() && !password.isEmpty()) { // connect to backend server to check / create credentials QRegularExpression reg("^[a-zA-Z0-9@.+_-]+$"); @@ -103,7 +104,7 @@ void PreferencesNetwork::syncSettings() connect(cloudAuth, &CloudStorageAuthenticate::finishedAuthenticate, this, &PreferencesNetwork::updateCloudAuthenticationState); cloudAuth->backend(email, password); } - } else if (prefs.cloud_verification_status == CS_NEED_TO_VERIFY) { + } else if (prefs.cloud_verification_status == qPref::CS_NEED_TO_VERIFY) { QString pin = ui->cloud_storage_pin->text(); if (!pin.isEmpty()) { // connect to backend server to check / create credentials @@ -126,19 +127,19 @@ void PreferencesNetwork::syncSettings() void PreferencesNetwork::updateCloudAuthenticationState() { - ui->cloud_storage_pin->setEnabled(prefs.cloud_verification_status == CS_NEED_TO_VERIFY); - ui->cloud_storage_pin->setVisible(prefs.cloud_verification_status == CS_NEED_TO_VERIFY); - ui->cloud_storage_pin_label->setEnabled(prefs.cloud_verification_status == CS_NEED_TO_VERIFY); - ui->cloud_storage_pin_label->setVisible(prefs.cloud_verification_status == CS_NEED_TO_VERIFY); - ui->cloud_storage_new_passwd->setEnabled(prefs.cloud_verification_status == CS_VERIFIED); - ui->cloud_storage_new_passwd->setVisible(prefs.cloud_verification_status == CS_VERIFIED); - ui->cloud_storage_new_passwd_label->setEnabled(prefs.cloud_verification_status == CS_VERIFIED); - ui->cloud_storage_new_passwd_label->setVisible(prefs.cloud_verification_status == CS_VERIFIED); - if (prefs.cloud_verification_status == CS_VERIFIED) { + ui->cloud_storage_pin->setEnabled(prefs.cloud_verification_status == qPref::CS_NEED_TO_VERIFY); + ui->cloud_storage_pin->setVisible(prefs.cloud_verification_status == qPref::CS_NEED_TO_VERIFY); + ui->cloud_storage_pin_label->setEnabled(prefs.cloud_verification_status == qPref::CS_NEED_TO_VERIFY); + ui->cloud_storage_pin_label->setVisible(prefs.cloud_verification_status == qPref::CS_NEED_TO_VERIFY); + ui->cloud_storage_new_passwd->setEnabled(prefs.cloud_verification_status == qPref::CS_VERIFIED); + ui->cloud_storage_new_passwd->setVisible(prefs.cloud_verification_status == qPref::CS_VERIFIED); + ui->cloud_storage_new_passwd_label->setEnabled(prefs.cloud_verification_status == qPref::CS_VERIFIED); + ui->cloud_storage_new_passwd_label->setVisible(prefs.cloud_verification_status == qPref::CS_VERIFIED); + if (prefs.cloud_verification_status == qPref::CS_VERIFIED) { ui->cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage (credentials verified)")); - } else if (prefs.cloud_verification_status == CS_INCORRECT_USER_PASSWD) { + } else if (prefs.cloud_verification_status == qPref::CS_INCORRECT_USER_PASSWD) { ui->cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage (incorrect password)")); - } else if (prefs.cloud_verification_status == CS_NEED_TO_VERIFY) { + } else if (prefs.cloud_verification_status == qPref::CS_NEED_TO_VERIFY) { ui->cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage (PIN required)")); } else { ui->cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage")); |