mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: declare cloud_status in qPrefCloudStorage
qml declaration of cloud_status (defined in pref.h) does not belong in qPref.h but in qPrefCloudStorage Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
parent
4d57b52062
commit
684e334fb6
13 changed files with 82 additions and 82 deletions
|
@ -77,7 +77,7 @@ void PreferencesDefaults::refreshSettings()
|
|||
ui->velocitySlider->setValue(qPrefDisplay::animation_speed());
|
||||
ui->btnUseDefaultFile->setChecked(qPrefGeneral::use_default_file());
|
||||
|
||||
if (qPrefCloudStorage::cloud_verification_status() == qPref::CS_VERIFIED) {
|
||||
if (qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_VERIFIED) {
|
||||
ui->cloudDefaultFile->setEnabled(true);
|
||||
} else {
|
||||
if (ui->cloudDefaultFile->isChecked())
|
||||
|
|
|
@ -57,7 +57,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 == qPref::CS_VERIFIED && !newpassword.isEmpty()) {
|
||||
if (prefs.cloud_verification_status == qPrefCloudStorage::CS_VERIFIED && !newpassword.isEmpty()) {
|
||||
// deal with password change
|
||||
if (!email.isEmpty() && !password.isEmpty()) {
|
||||
// connect to backend server to check / create credentials
|
||||
|
@ -77,14 +77,14 @@ void PreferencesNetwork::syncSettings()
|
|||
cloudAuth->backend(email, password, "", newpassword);
|
||||
ui->cloud_storage_new_passwd->setText("");
|
||||
}
|
||||
} else if (prefs.cloud_verification_status == qPref::CS_UNKNOWN ||
|
||||
prefs.cloud_verification_status == qPref::CS_INCORRECT_USER_PASSWD ||
|
||||
} else if (prefs.cloud_verification_status == qPrefCloudStorage::CS_UNKNOWN ||
|
||||
prefs.cloud_verification_status == qPrefCloudStorage::CS_INCORRECT_USER_PASSWD ||
|
||||
email != prefs.cloud_storage_email ||
|
||||
password != prefs.cloud_storage_password) {
|
||||
|
||||
// different credentials - reset verification status
|
||||
int oldVerificationStatus = cloud->cloud_verification_status();
|
||||
cloud->set_cloud_verification_status(qPref::CS_UNKNOWN);
|
||||
cloud->set_cloud_verification_status(qPrefCloudStorage::CS_UNKNOWN);
|
||||
if (!email.isEmpty() && !password.isEmpty()) {
|
||||
// connect to backend server to check / create credentials
|
||||
QRegularExpression reg("^[a-zA-Z0-9@.+_-]+$");
|
||||
|
@ -97,7 +97,7 @@ void PreferencesNetwork::syncSettings()
|
|||
connect(cloudAuth, &CloudStorageAuthenticate::finishedAuthenticate, this, &PreferencesNetwork::updateCloudAuthenticationState);
|
||||
cloudAuth->backend(email, password);
|
||||
}
|
||||
} else if (prefs.cloud_verification_status == qPref::CS_NEED_TO_VERIFY) {
|
||||
} else if (prefs.cloud_verification_status == qPrefCloudStorage::CS_NEED_TO_VERIFY) {
|
||||
QString pin = ui->cloud_storage_pin->text();
|
||||
if (!pin.isEmpty()) {
|
||||
// connect to backend server to check / create credentials
|
||||
|
@ -120,19 +120,19 @@ void PreferencesNetwork::syncSettings()
|
|||
|
||||
void PreferencesNetwork::updateCloudAuthenticationState()
|
||||
{
|
||||
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->cloud_storage_pin->setEnabled(prefs.cloud_verification_status == qPrefCloudStorage::CS_NEED_TO_VERIFY);
|
||||
ui->cloud_storage_pin->setVisible(prefs.cloud_verification_status == qPrefCloudStorage::CS_NEED_TO_VERIFY);
|
||||
ui->cloud_storage_pin_label->setEnabled(prefs.cloud_verification_status == qPrefCloudStorage::CS_NEED_TO_VERIFY);
|
||||
ui->cloud_storage_pin_label->setVisible(prefs.cloud_verification_status == qPrefCloudStorage::CS_NEED_TO_VERIFY);
|
||||
ui->cloud_storage_new_passwd->setEnabled(prefs.cloud_verification_status == qPrefCloudStorage::CS_VERIFIED);
|
||||
ui->cloud_storage_new_passwd->setVisible(prefs.cloud_verification_status == qPrefCloudStorage::CS_VERIFIED);
|
||||
ui->cloud_storage_new_passwd_label->setEnabled(prefs.cloud_verification_status == qPrefCloudStorage::CS_VERIFIED);
|
||||
ui->cloud_storage_new_passwd_label->setVisible(prefs.cloud_verification_status == qPrefCloudStorage::CS_VERIFIED);
|
||||
if (prefs.cloud_verification_status == qPrefCloudStorage::CS_VERIFIED) {
|
||||
ui->cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage (credentials verified)"));
|
||||
} else if (prefs.cloud_verification_status == qPref::CS_INCORRECT_USER_PASSWD) {
|
||||
} else if (prefs.cloud_verification_status == qPrefCloudStorage::CS_INCORRECT_USER_PASSWD) {
|
||||
ui->cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage (incorrect password)"));
|
||||
} else if (prefs.cloud_verification_status == qPref::CS_NEED_TO_VERIFY) {
|
||||
} else if (prefs.cloud_verification_status == qPrefCloudStorage::CS_NEED_TO_VERIFY) {
|
||||
ui->cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage (PIN required)"));
|
||||
} else {
|
||||
ui->cloudStorageGroupBox->setTitle(tr("Subsurface cloud storage"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue