Mobile: Fix Cloud Synch Status Management.

Fix how the cloud synch status is handled - currently the preference is
used incorrectly, switching cloud synch off when it should be on.
Also hide the 'Manual cloud synch' button when no cloud credentials are
stored, and don't show the 'manual synch' popup when auto synch is
enabled.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-02-13 01:03:34 +13:00 committed by Dirk Hohndel
parent 1309064873
commit 31d1755efd
2 changed files with 7 additions and 6 deletions

View file

@ -125,6 +125,7 @@ Item {
id: signin_register_normal
text: qsTr("Sign-in or Register")
onClicked: {
PrefCloudStorage.cloud_auto_sync = true
manager.saveCloudCredentials(login.text, password.text, "")
}
}

View file

@ -334,7 +334,7 @@ Kirigami.ApplicationWindow {
name: ":/icons/cloud_sync.svg"
}
text: qsTr("Manual sync with cloud")
enabled: Backend.cloud_verification_status === Enums.CS_VERIFIED
visible: Backend.cloud_verification_status !== Enums.CS_NOCLOUD
onTriggered: {
globalDrawer.close()
detailsWindow.endEditMode()
@ -344,14 +344,14 @@ Kirigami.ApplicationWindow {
}
}
Kirigami.Action {
icon {
name: PrefCloudStorage.cloud_auto_sync ? ":/icons/ic_cloud_off.svg" : ":/icons/ic_cloud_done.svg"
}
text: (PrefCloudStorage.cloud_auto_sync ? "\u2610 " : "\u2611 ") + qsTr("Auto cloud sync")
icon {
name: PrefCloudStorage.cloud_auto_sync ? ":/icons/ic_cloud_done.svg" : ":/icons/ic_cloud_off.svg"
}
text: (PrefCloudStorage.cloud_auto_sync ? "\u2611 " : "\u2610 ") + qsTr("Auto cloud sync")
visible: Backend.cloud_verification_status !== Enums.CS_NOCLOUD
onTriggered: {
PrefCloudStorage.cloud_auto_sync = !PrefCloudStorage.cloud_auto_sync
manager.setGitLocalOnly(PrefCloudStorage.cloud_auto_sync)
manager.setGitLocalOnly(!PrefCloudStorage.cloud_auto_sync)
if (!PrefCloudStorage.cloud_auto_sync) {
showPassiveNotification(qsTr("Turning off automatic sync to cloud causes all data to only be \
stored locally. This can be very useful in situations with limited or no network access. Please choose 'Manual sync with cloud' \