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>
This commit is contained in:
Jan Mulder 2017-09-27 17:24:03 +02:00 committed by Dirk Hohndel
parent 801b1bc5f5
commit cf8e87545f
2 changed files with 28 additions and 0 deletions

View file

@ -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.

View file

@ -167,6 +167,7 @@ public slots:
void populateGpsData();
void cancelDownloadDC();
void clearGpsData();
void cancelCredentialsPinSetup();
void finishSetup();
void openLocalThenRemote(QString url);
void mergeLocalRepo();