summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-01-03 18:03:28 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-01-06 10:46:07 -0800
commit59526e948aea42b977a3976293fbfdfe561dec97 (patch)
treea603c538b2bfb54731e9519a0190cd2fffa8da67
parentb3901aa8f90499ee2a34efdddc2463105afc53f1 (diff)
downloadsubsurface-59526e948aea42b977a3976293fbfdfe561dec97.tar.gz
Remove cloud_background_sync preferences option
The preferences flag cloud_background_sync used to be used heavily in the mobile code, but is not used there anymore. Now, it is accessed only in one place, but does not do what it actually says: If it is off, the remote storage is not synced on save (but will be synced on next load). Syncing on save can also be prevented by unchecking the "Cloud online" menu checkbox. Since the latter seems more logical and general (support for non-cloud remote git repositories), remove the cloud_background_sync option. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--core/pref.h1
-rw-r--r--core/save-git.c2
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.cpp17
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.h4
-rw-r--r--core/subsurfacestartup.c1
-rw-r--r--desktop-widgets/preferences/preferences_network.cpp2
-rw-r--r--desktop-widgets/preferences/preferences_network.ui7
-rw-r--r--tests/testgitstorage.cpp1
-rw-r--r--tests/testpreferences.cpp4
9 files changed, 1 insertions, 38 deletions
diff --git a/core/pref.h b/core/pref.h
index 6c06f5669..9f7192ca3 100644
--- a/core/pref.h
+++ b/core/pref.h
@@ -145,7 +145,6 @@ struct preferences {
const char *cloud_storage_email_encoded;
bool save_password_local;
short cloud_verification_status;
- bool cloud_background_sync;
geocoding_prefs_t geocoding;
enum deco_mode planner_deco_mode;
short vpmb_conservatism;
diff --git a/core/save-git.c b/core/save-git.c
index 1000f78a1..6eab07580 100644
--- a/core/save-git.c
+++ b/core/save-git.c
@@ -1273,7 +1273,7 @@ int do_git_save(git_repository *repo, const char *branch, const char *remote, bo
return report_error("creating commit failed");
/* now sync the tree with the remote server */
- if (remote && prefs.cloud_background_sync && !prefs.git_local_only)
+ if (remote && !prefs.git_local_only)
return sync_with_remote(repo, remote, branch, RT_HTTPS);
return 0;
}
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index e4a9a71d6..7dff976fb 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -983,11 +983,6 @@ short CloudStorageSettings::verificationStatus() const
return prefs.cloud_verification_status;
}
-bool CloudStorageSettings::backgroundSync() const
-{
- return prefs.cloud_background_sync;
-}
-
QString CloudStorageSettings::userId() const
{
return QString(prefs.userid);
@@ -1081,17 +1076,6 @@ void CloudStorageSettings::setVerificationStatus(short value)
emit verificationStatusChanged(value);
}
-void CloudStorageSettings::setBackgroundSync(bool value)
-{
- if (value == prefs.cloud_background_sync)
- return;
- QSettings s;
- s.beginGroup(group);
- s.setValue("cloud_background_sync", value);
- prefs.cloud_background_sync = value;
- emit backgroundSyncChanged(value);
-}
-
void CloudStorageSettings::setSaveUserIdLocal(bool value)
{
//TODO: this is not saved on disk?
@@ -2300,7 +2284,6 @@ void SettingsObjectWrapper::load()
GET_TXT("password", cloud_storage_password);
}
GET_INT("cloud_verification_status", cloud_verification_status);
- GET_BOOL("cloud_background_sync", cloud_background_sync);
GET_BOOL("git_local_only", git_local_only);
// creating the git url here is simply a convenience when C code wants
diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h
index 1d56ddf30..a41caae40 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.h
+++ b/core/subsurface-qt/SettingsObjectWrapper.h
@@ -331,7 +331,6 @@ class CloudStorageSettings : public QObject {
Q_PROPERTY(bool git_local_only READ gitLocalOnly WRITE setGitLocalOnly NOTIFY gitLocalOnlyChanged)
Q_PROPERTY(bool save_password_local READ savePasswordLocal WRITE setSavePasswordLocal NOTIFY savePasswordLocalChanged)
Q_PROPERTY(short verification_status READ verificationStatus WRITE setVerificationStatus NOTIFY verificationStatusChanged)
- Q_PROPERTY(bool background_sync READ backgroundSync WRITE setBackgroundSync NOTIFY backgroundSyncChanged)
public:
CloudStorageSettings(QObject *parent);
QString password() const;
@@ -343,7 +342,6 @@ public:
QString gitUrl() const;
bool savePasswordLocal() const;
short verificationStatus() const;
- bool backgroundSync() const;
bool gitLocalOnly() const;
bool saveUserIdLocal() const;
@@ -357,7 +355,6 @@ public slots:
void setGitUrl(const QString& value);
void setSavePasswordLocal(bool value);
void setVerificationStatus(short value);
- void setBackgroundSync(bool value);
void setGitLocalOnly(bool value);
void setSaveUserIdLocal(bool value);
@@ -371,7 +368,6 @@ signals:
void gitUrlChanged(const QString& value);
void savePasswordLocalChanged(bool value);
void verificationStatusChanged(short value);
- void backgroundSyncChanged(bool value);
void gitLocalOnlyChanged(bool value);
void saveUserIdLocalChanged(bool value);
diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c
index fc768c268..db942f7ba 100644
--- a/core/subsurfacestartup.c
+++ b/core/subsurfacestartup.c
@@ -81,7 +81,6 @@ struct preferences default_prefs = {
.access_token = NULL
},
.defaultsetpoint = 1100,
- .cloud_background_sync = true,
.geocoding = {
.category = { 0 }
},
diff --git a/desktop-widgets/preferences/preferences_network.cpp b/desktop-widgets/preferences/preferences_network.cpp
index 9ea78f50b..9cc12d328 100644
--- a/desktop-widgets/preferences/preferences_network.cpp
+++ b/desktop-widgets/preferences/preferences_network.cpp
@@ -38,7 +38,6 @@ void PreferencesNetwork::refreshSettings()
ui->cloud_storage_email->setText(prefs.cloud_storage_email);
ui->cloud_storage_password->setText(prefs.cloud_storage_password);
ui->save_password_local->setChecked(prefs.save_password_local);
- ui->cloud_background_sync->setChecked(prefs.cloud_background_sync);
ui->save_uid_local->setChecked(prefs.save_userid_local);
ui->default_uid->setText(QString(prefs.userid).toUpper());
updateCloudAuthenticationState();
@@ -115,7 +114,6 @@ void PreferencesNetwork::syncSettings()
cloud->setSavePasswordLocal(ui->save_password_local->isChecked());
cloud->setPassword(password);
cloud->setVerificationStatus(prefs.cloud_verification_status);
- cloud->setBackgroundSync(ui->cloud_background_sync->isChecked());
cloud->setBaseUrl(prefs.cloud_base_url);
}
diff --git a/desktop-widgets/preferences/preferences_network.ui b/desktop-widgets/preferences/preferences_network.ui
index 0899c7c94..74f2548c1 100644
--- a/desktop-widgets/preferences/preferences_network.ui
+++ b/desktop-widgets/preferences/preferences_network.ui
@@ -216,13 +216,6 @@
</widget>
</item>
<item row="2" column="0">
- <widget class="QCheckBox" name="cloud_background_sync">
- <property name="text">
- <string>Sync to cloud in the background?</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
<widget class="QCheckBox" name="save_password_local">
<property name="text">
<string>Save Password locally?</string>
diff --git a/tests/testgitstorage.cpp b/tests/testgitstorage.cpp
index 9387fbd81..2edc8e305 100644
--- a/tests/testgitstorage.cpp
+++ b/tests/testgitstorage.cpp
@@ -43,7 +43,6 @@ void TestGitStorage::initTestCase()
s.endGroup();
prefs.cloud_storage_email_encoded = strdup("ssrftest@hohndel.org");
prefs.cloud_storage_password = strdup("geheim");
- prefs.cloud_background_sync = true;
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::ProxyType(prefs.proxy_type));
proxy.setHostName(prefs.proxy_host);
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
index bc6e90213..585044fd0 100644
--- a/tests/testpreferences.cpp
+++ b/tests/testpreferences.cpp
@@ -25,10 +25,6 @@ void TestPreferences::testPreferences()
pref->load();
auto cloud = pref->cloud_storage;
- cloud->setBackgroundSync(true);
- TEST(cloud->backgroundSync(), true);
- cloud->setBackgroundSync(false);
- TEST(cloud->backgroundSync(), false);
cloud->setBaseUrl("test_one");
TEST(cloud->baseUrl(), QStringLiteral("test_one"));