diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-01-17 21:24:50 +0100 |
---|---|---|
committer | Jan Mulder <jlmulder@xs4all.nl> | 2018-01-18 08:56:00 +0100 |
commit | a116ff85f8ecc2e5634752befd6241efa26e9b85 (patch) | |
tree | 5377af3913e27f2977f45e2417e7456f48c3fa09 /mobile-widgets/qmlmanager.cpp | |
parent | ee17024ac5a5be574a78016209f3f9da19e48576 (diff) | |
download | subsurface-a116ff85f8ecc2e5634752befd6241efa26e9b85.tar.gz |
Remove redundant local variables cloudPwd and cloudUser
These were assigned the member variables QMLManager::m_cloudPassword
and QMLManager::m_cloudPassword. Use the member variables directly.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index bcd9a3895..37857b9fc 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -363,44 +363,42 @@ void QMLManager::saveCloudCredentials() bool cloudCredentialsChanged = false; // make sure we only have letters, numbers, and +-_. in password and email address QRegularExpression regExp("^[a-zA-Z0-9@.+_-]+$"); - QString cloudPwd = m_cloudPassword; - QString cloudUser = m_cloudUserName; if (m_credentialStatus != CS_NOCLOUD) { // in case of NO_CLOUD, the email address + passwd do not care, so do not check it. - if (cloudPwd.isEmpty() || !regExp.match(cloudPwd).hasMatch() || !regExp.match(cloudUser).hasMatch()) { + if (m_cloudPassword.isEmpty() || !regExp.match(m_cloudPassword).hasMatch() || !regExp.match(m_cloudUserName).hasMatch()) { setStartPageText(RED_FONT + tr("Cloud storage email and password can only consist of letters, numbers, and '.', '-', '_', and '+'.") + END_FONT); return; } // use the same simplistic regex as the backend to check email addresses regExp = QRegularExpression("^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.+_-]+\\.[a-zA-Z0-9]+"); - if (!regExp.match(cloudUser).hasMatch()) { + if (!regExp.match(m_cloudUserName).hasMatch()) { setStartPageText(RED_FONT + tr("Invalid format for email address") + END_FONT); return; } } s.beginGroup("CloudStorage"); - s.setValue("email", cloudUser); - s.setValue("password", cloudPwd); + s.setValue("email", m_cloudUserName); + s.setValue("password", m_cloudPassword); s.setValue("cloud_verification_status", m_credentialStatus); s.sync(); - if (!same_string(prefs.cloud_storage_email, qPrintable(cloudUser))) { + if (!same_string(prefs.cloud_storage_email, qPrintable(m_cloudUserName))) { free((void *)prefs.cloud_storage_email); - prefs.cloud_storage_email = strdup(qPrintable(cloudUser)); + prefs.cloud_storage_email = strdup(qPrintable(m_cloudUserName)); cloudCredentialsChanged = true; } - cloudCredentialsChanged |= !same_string(prefs.cloud_storage_password, qPrintable(cloudPwd)); + cloudCredentialsChanged |= !same_string(prefs.cloud_storage_password, qPrintable(m_cloudPassword)); if (m_credentialStatus != CS_NOCLOUD && !cloudCredentialsChanged) { // just go back to the dive list setCredentialStatus(m_oldStatus); } - if (!same_string(prefs.cloud_storage_password, qPrintable(cloudPwd))) { + if (!same_string(prefs.cloud_storage_password, qPrintable(m_cloudPassword))) { free((void *)prefs.cloud_storage_password); - prefs.cloud_storage_password = strdup(qPrintable(cloudPwd)); + prefs.cloud_storage_password = strdup(qPrintable(m_cloudPassword)); } - if (cloudUser.isEmpty() || cloudPwd.isEmpty()) { + if (m_cloudUserName.isEmpty() || m_cloudPassword.isEmpty()) { setStartPageText(RED_FONT + tr("Please enter valid cloud credentials.") + END_FONT); } else if (cloudCredentialsChanged) { // let's make sure there are no unsaved changes |