summaryrefslogtreecommitdiffstats
path: root/core/settings
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2018-10-08 16:15:53 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-09 10:03:21 -0700
commit91c8a2fa5c897111146bff30ff27763ddb92f929 (patch)
tree525bbd9464e904c0d483ad5c1edc02aa879a2348 /core/settings
parent26234d326fe0e9aaa82c253762f89b20101b9bf4 (diff)
downloadsubsurface-91c8a2fa5c897111146bff30ff27763ddb92f929.tar.gz
Prefs: add bool preference cloud_auto_sync [1/3]
With removal of the git_local_only from the preferences (see ae653703a5d3f), the users choice, in the mobile app, was not stored any more in between sessions. This resulted in issue 1725. So, in order to store that user preference, we need a new preference. This is added here, but its not yet hooked up in the app yet. This deals only with the preference handling. And adapted tests are included. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'core/settings')
-rw-r--r--core/settings/qPrefCloudStorage.cpp3
-rw-r--r--core/settings/qPrefCloudStorage.h5
2 files changed, 8 insertions, 0 deletions
diff --git a/core/settings/qPrefCloudStorage.cpp b/core/settings/qPrefCloudStorage.cpp
index ef7605d97..8bbd91aec 100644
--- a/core/settings/qPrefCloudStorage.cpp
+++ b/core/settings/qPrefCloudStorage.cpp
@@ -16,6 +16,7 @@ qPrefCloudStorage *qPrefCloudStorage::instance()
void qPrefCloudStorage::loadSync(bool doSync)
{
+ disk_cloud_auto_sync(doSync);
disk_cloud_base_url(doSync);
disk_cloud_storage_email(doSync);
disk_cloud_storage_email_encoded(doSync);
@@ -26,6 +27,8 @@ void qPrefCloudStorage::loadSync(bool doSync)
disk_save_password_local(doSync);
}
+HANDLE_PREFERENCE_BOOL(CloudStorage, "cloud_auto_sync", cloud_auto_sync);
+
void qPrefCloudStorage::set_cloud_base_url(const QString &value)
{
if (value != prefs.cloud_base_url) {
diff --git a/core/settings/qPrefCloudStorage.h b/core/settings/qPrefCloudStorage.h
index 631eaa670..841005b76 100644
--- a/core/settings/qPrefCloudStorage.h
+++ b/core/settings/qPrefCloudStorage.h
@@ -7,6 +7,7 @@
class qPrefCloudStorage : public QObject {
Q_OBJECT
+ Q_PROPERTY(bool cloud_auto_sync READ cloud_auto_sync WRITE set_cloud_auto_sync NOTIFY cloud_auto_syncChanged);
Q_PROPERTY(QString cloud_base_url READ cloud_base_url WRITE set_cloud_base_url NOTIFY cloud_base_urlChanged);
Q_PROPERTY(QString cloud_git_url READ cloud_git_url);
Q_PROPERTY(QString cloud_storage_email READ cloud_storage_email WRITE set_cloud_storage_email NOTIFY cloud_storage_emailChanged);
@@ -36,6 +37,7 @@ public:
};
Q_ENUM(cloud_status);
+ static bool cloud_auto_sync() { return prefs.cloud_auto_sync; }
static QString cloud_base_url() { return prefs.cloud_base_url; }
static QString cloud_git_url() { return prefs.cloud_git_url; }
static QString cloud_storage_email() { return prefs.cloud_storage_email; }
@@ -47,6 +49,7 @@ public:
static bool save_password_local() { return prefs.save_password_local; }
public slots:
+ static void set_cloud_auto_sync(bool value);
static void set_cloud_base_url(const QString &value);
static void set_cloud_storage_email(const QString &value);
static void set_cloud_storage_email_encoded(const QString &value);
@@ -57,6 +60,7 @@ public slots:
static void set_save_password_local(bool value);
signals:
+ void cloud_auto_syncChanged(bool value);
void cloud_base_urlChanged(const QString &value);
void cloud_storage_emailChanged(const QString &value);
void cloud_storage_email_encodedChanged(const QString &value);
@@ -68,6 +72,7 @@ signals:
private:
// functions to load/sync variable with disk
+ static void disk_cloud_auto_sync(bool doSync);
static void disk_cloud_base_url(bool doSync);
static void disk_cloud_storage_email(bool doSync);
static void disk_cloud_storage_email_encoded(bool doSync);