From cf8e87545f1e2bfb2d995e6ad9bbd348589293c6 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Wed, 27 Sep 2017 17:24:03 +0200 Subject: 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 --- mobile-widgets/qmlmanager.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'mobile-widgets/qmlmanager.cpp') 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 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. -- cgit v1.2.3-70-g09d2