diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2017-09-27 17:24:03 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-09-29 08:13:25 -0700 |
commit | cf8e87545f1e2bfb2d995e6ad9bbd348589293c6 (patch) | |
tree | 310f3bf5434fcf82ceedd3ab5bad0dfb56015bcf /mobile-widgets | |
parent | 801b1bc5f52f6aa7678c07443e266e70417f7227 (diff) | |
download | subsurface-cf8e87545f1e2bfb2d995e6ad9bbd348589293c6.tar.gz |
mobile: add helper function cancelCredentialsPinSetup()
As written in 8d9ad3cfea7e4c0875, the user needs to be able
to exit the PIN entry UI, in case no PIN can be received due
to a wrong email address.
The simplest way seems to just clear the cloud credential data,
and let the user try again. Obviously, we could argue if the
exact previous state of the 1st credentials screen could
be restored, but as it is only 2 simple fields, of which
it is higly likely that the email adress is misspelled (and
the password hidden), it seems overly complex to implement.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 27 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.h | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 24a51dfe9..3961cc5cf 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -222,6 +222,33 @@ void QMLManager::mergeLocalRepo() process_dives(true, false); } +void QMLManager::cancelCredentialsPinSetup() +{ + /* + * The user selected <cancel> on the final stage of the + * cloud account generation (entering the emailed PIN). + * + * For now, just reset all the cloud data. This brings the app + * back to its initial state, and the user can startover again. + * + * Notice that this function is also used to switch to NOCLOUD + * mode. So the name is not perfect. + */ + QSettings s; + + setCloudUserName(NULL); + setCloudPassword(NULL); + setCredentialStatus(CS_UNKNOWN); + s.beginGroup("CloudStorage"); + s.setValue("email", cloudUserName()); + s.setValue("password", cloudPassword()); + s.setValue("cloud_verification_status", credentialStatus()); + s.sync(); + setStartPageText(tr("Starting...")); + + setShowPin(false); +} + void QMLManager::finishSetup() { // Initialize cloud credentials. diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index dec9e6502..87668d92e 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -167,6 +167,7 @@ public slots: void populateGpsData(); void cancelDownloadDC(); void clearGpsData(); + void cancelCredentialsPinSetup(); void finishSetup(); void openLocalThenRemote(QString url); void mergeLocalRepo(); |