Mobile: preserve auto download status [2/3]

Hook up the new preference to the UI. So now, an earlier choice
if automatic or manual download to the cloud is preserved in
between sessions. Strictly speaking this fixes issue 1725.

Notice that there is also a higly related syncToCloud thing
present. As factoring out that seemingly duplicate piece
of code is non-trivial, this will be done in a seperate
commit.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2018-10-08 18:47:01 +02:00 committed by Dirk Hohndel
parent 91c8a2fa5c
commit 87b8155576
2 changed files with 6 additions and 4 deletions

View file

@ -144,6 +144,7 @@ Item {
text: qsTr("No cloud mode")
onClicked: {
manager.syncToCloud = false
PrefCloudStorage.cloud_auto_sync = false
prefs.credentialStatus = CloudStatus.CS_NOCLOUD
manager.saveCloudCredentials()
manager.openNoCloudRepo()

View file

@ -273,13 +273,14 @@ Kirigami.ApplicationWindow {
}
Kirigami.Action {
icon {
name: syncToCloud ? ":/icons/ic_cloud_off.svg" : ":/icons/ic_cloud_done.svg"
name: PrefCloudStorage.cloud_auto_sync ? ":/icons/ic_cloud_off.svg" : ":/icons/ic_cloud_done.svg"
}
text: syncToCloud ? qsTr("Disable auto cloud sync") : qsTr("Enable auto cloud sync")
text: PrefCloudStorage.cloud_auto_sync ? qsTr("Disable auto cloud sync") : qsTr("Enable auto cloud sync")
visible: prefs.credentialStatus !== CloudStatus.CS_NOCLOUD
onTriggered: {
syncToCloud = !syncToCloud
if (!syncToCloud) {
PrefCloudStorage.cloud_auto_sync = !PrefCloudStorage.cloud_auto_sync
syncToCloud = 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' \
if you have network connectivity and want to sync your data to cloud storage."), 10000)