aboutsummaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2019-12-21 17:33:51 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-25 03:15:52 +0900
commit9117aa2a52bec1997cb69984e6a9f333432e5167 (patch)
tree7eb32ef9b1029d5496db4deaa03f00f73364bcbe /mobile-widgets/qmlmanager.cpp
parente92dbe7974a1b28b0c26438b7818f3249f82ac4c (diff)
downloadsubsurface-9117aa2a52bec1997cb69984e6a9f333432e5167.tar.gz
mobile-widgets: make saveCredentials() an atom
Call saveCredentials with username/password to avoid first setting the two and then calling. Change saveCredentials() to use newUser, newPassword. Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r--mobile-widgets/qmlmanager.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 289009eda..3a362f0f7 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -458,7 +458,7 @@ void QMLManager::finishSetup()
} else if (!empty_string(existing_filename) &&
QMLPrefs::instance()->credentialStatus() != qPrefCloudStorage::CS_UNKNOWN) {
QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_NOCLOUD);
- saveCloudCredentials();
+ saveCloudCredentials(qPrefCloudStorage::cloud_storage_email(), qPrefCloudStorage::cloud_storage_password());
appendTextToLog(tr("working in no-cloud mode"));
int error = parse_file(existing_filename, &dive_table, &trip_table, &dive_site_table);
if (error) {
@@ -494,11 +494,14 @@ QMLManager *QMLManager::instance()
#define CLOUDURL QString(prefs.cloud_base_url)
#define CLOUDREDIRECTURL CLOUDURL + "/cgi-bin/redirect.pl"
-void QMLManager::saveCloudCredentials()
+void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &newPassword)
{
bool cloudCredentialsChanged = false;
bool noCloud = QMLPrefs::instance()->credentialStatus() == qPrefCloudStorage::CS_NOCLOUD;
+ QMLPrefs::instance()->setCloudUserName(newEmail);
+ QMLPrefs::instance()->setCloudPassword(newPassword);
+
// make sure we only have letters, numbers, and +-_. in password and email address
QRegularExpression regExp("^[a-zA-Z0-9@.+_-]+$");
if (!noCloud) {