mobile: initialize credential data in one place

It appears that the onCompleted of the StartPage item is triggered
before the onCompleted of the rootItem. This is logical as the
Startpage is a child of the rootItem. And, yes, this does matter.
As the divelist also contains the logic for initial cloud
registration (and is the default page shown in a state where
the cloud credentials are valid (CS_VERIFIED state)), we need to
know the correct credential state at start of the app.

The move of this one line of code makes sure of that, in addition
to setting the credential state from the preferences. Now, the
setupActions function can reference correct credential data.

This is further preparation for a better cloud creation
process from mobile.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2017-09-09 13:15:14 +02:00 committed by Dirk Hohndel
parent e903c6bd1a
commit 2e91de9d95
3 changed files with 2 additions and 1 deletions

View file

@ -291,6 +291,7 @@ Kirigami.ScrollablePage {
}
Component.onCompleted: {
manager.finishSetup();
setupActions();
}
}

View file

@ -470,7 +470,6 @@ if you have network connectivity and want to sync your data to cloud storage."),
}
Component.onCompleted: {
manager.finishSetup();
rootItem.visible = true
diveList.opacity = 1
rootItem.opacity = 1

View file

@ -221,6 +221,7 @@ void QMLManager::finishSetup()
setCloudUserName(prefs.cloud_storage_email);
setCloudPassword(prefs.cloud_storage_password);
setSyncToCloud(!prefs.git_local_only);
setCredentialStatus((cloud_status_qml) prefs.cloud_verification_status);
// if the cloud credentials are valid, we should get the GPS Webservice ID as well
QString url;
if (!cloudUserName().isEmpty() &&