summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mobile-widgets/qml/CloudCredentials.qml4
-rw-r--r--mobile-widgets/qmlmanager.cpp7
-rw-r--r--mobile-widgets/qmlmanager.h2
3 files changed, 7 insertions, 6 deletions
diff --git a/mobile-widgets/qml/CloudCredentials.qml b/mobile-widgets/qml/CloudCredentials.qml
index 198e2605c..50db7c952 100644
--- a/mobile-widgets/qml/CloudCredentials.qml
+++ b/mobile-widgets/qml/CloudCredentials.qml
@@ -15,10 +15,8 @@ Item {
property string password: password.text;
function saveCredentials() {
- prefs.cloudUserName = login.text
- prefs.cloudPassword = password.text
prefs.cloudPin = pin.text
- manager.saveCloudCredentials()
+ manager.saveCloudCredentials(login.text, password.text)
}
ColumnLayout {
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) {
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index 0c61615a0..14baf6dd8 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -167,7 +167,7 @@ public:
public slots:
void appInitialized();
void applicationStateChanged(Qt::ApplicationState state);
- void saveCloudCredentials();
+ void saveCloudCredentials(const QString &email, const QString &password);
bool verifyCredentials(QString email, QString password, QString pin);
void tryRetrieveDataFromBackend();
void handleError(QNetworkReply::NetworkError nError);