core: make qPref::cloud_status the only version of the enum

add enum to qPref and remove elsewhere
update source core to reference qPref.

the enum cannot be in pref.h because it is to be used in qml and Q_ENUM
need the enum to be defined as part of the class

Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
jan Iversen 2018-07-05 20:37:53 +02:00 committed by Dirk Hohndel
parent 7103f36c7c
commit 8d66633fe7
14 changed files with 90 additions and 95 deletions

View file

@ -186,10 +186,10 @@ Kirigami.ApplicationWindow {
text: qsTr("Dive list")
onTriggered: {
manager.appendTextToLog("requested dive list with credential status " + prefs.credentialStatus)
if (prefs.credentialStatus == QMLPrefs.CS_UNKNOWN) {
if (prefs.credentialStatus == SsrfPrefs.CS_UNKNOWN) {
// the user has asked to change credentials - if the credentials before that
// were valid, go back to dive list
if (oldStatus == QMLPrefs.CS_VERIFIED) {
if (oldStatus == SsrfPrefs.CS_VERIFIED) {
prefs.credentialStatus = oldStatus
}
}
@ -216,8 +216,8 @@ Kirigami.ApplicationWindow {
name: ":/icons/ic_add.svg"
}
text: qsTr("Add dive manually")
enabled: prefs.credentialStatus === QMLPrefs.CS_VERIFIED ||
prefs.credentialStatus === QMLPrefs.CS_NOCLOUD
enabled: prefs.credentialStatus === SsrfPrefs.CS_VERIFIED ||
prefs.credentialStatus === SsrfPrefs.CS_NOCLOUD
onTriggered: {
globalDrawer.close()
returnTopPage() // otherwise odd things happen with the page stack
@ -251,14 +251,14 @@ Kirigami.ApplicationWindow {
name: ":/icons/cloud_sync.svg"
}
text: qsTr("Manual sync with cloud")
enabled: prefs.credentialStatus === QMLPrefs.CS_VERIFIED ||
prefs.credentialStatus === QMLPrefs.CS_NOCLOUD
enabled: prefs.credentialStatus === SsrfPrefs.CS_VERIFIED ||
prefs.credentialStatus === SsrfPrefs.CS_NOCLOUD
onTriggered: {
if (prefs.credentialStatus === QMLPrefs.CS_NOCLOUD) {
if (prefs.credentialStatus === SsrfPrefs.CS_NOCLOUD) {
returnTopPage()
oldStatus = prefs.credentialStatus
manager.startPageText = "Enter valid cloud storage credentials"
prefs.credentialStatus = QMLPrefs.CS_UNKNOWN
prefs.credentialStatus = SsrfPrefs.CS_UNKNOWN
globalDrawer.close()
} else {
globalDrawer.close()
@ -273,7 +273,7 @@ Kirigami.ApplicationWindow {
name: syncToCloud ? ":/icons/ic_cloud_off.svg" : ":/icons/ic_cloud_done.svg"
}
text: syncToCloud ? qsTr("Disable auto cloud sync") : qsTr("Enable auto cloud sync")
enabled: prefs.credentialStatus !== QMLPrefs.CS_NOCLOUD
enabled: prefs.credentialStatus !== SsrfPrefs.CS_NOCLOUD
onTriggered: {
syncToCloud = !syncToCloud
if (!syncToCloud) {