summaryrefslogtreecommitdiffstats
path: root/core/settings/qPrefUpdateManager.cpp
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-08-15 17:19:29 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-08-23 05:19:16 -0700
commit62672276d0457e8890aed57e4ca114e9daac16f2 (patch)
treef9abfdab852b8f67fb8ed15926c88c452c62e104 /core/settings/qPrefUpdateManager.cpp
parentfa62ffdbf018f32758e2828179f8f7f243a874a5 (diff)
downloadsubsurface-62672276d0457e8890aed57e4ca114e9daac16f2.tar.gz
core: correct error in qPrefUpdateManager
make next_check (in qPrefUpdateManager) long instead of string Correct test cases (compare time_t not strings) Add test case to check time_t works as expected Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'core/settings/qPrefUpdateManager.cpp')
-rw-r--r--core/settings/qPrefUpdateManager.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/core/settings/qPrefUpdateManager.cpp b/core/settings/qPrefUpdateManager.cpp
index 2b2bb373d..23952f700 100644
--- a/core/settings/qPrefUpdateManager.cpp
+++ b/core/settings/qPrefUpdateManager.cpp
@@ -41,12 +41,17 @@ HANDLE_PREFERENCE_TXT_EXT(UpdateManager, "/LastVersionUsed", last_version_used,
void qPrefUpdateManager::set_next_check(const QDate& value)
{
- QString valueString = value.toString("dd/MM/yyyy");
- if (valueString != prefs.update_manager.next_check) {
- qPrefPrivate::copy_txt(&prefs.update_manager.next_check, valueString);
+ long time_value = value.toJulianDay();
+ if (time_value != prefs.update_manager.next_check) {
+ prefs.update_manager.next_check = time_value;
disk_next_check(true);
emit instance()->next_check_changed(value);
}
}
-DISK_LOADSYNC_TXT_EXT(UpdateManager, "/NextCheck", next_check, update_manager.);
-
+void qPrefUpdateManager::disk_next_check(bool doSync)
+{
+ if (doSync)
+ qPrefPrivate::instance()->setting.setValue(group + "/NextCheck", prefs.update_manager.next_check);
+ else
+ prefs.update_manager.next_check = qPrefPrivate::instance()->setting.value(group + "/NextCheck", 0).toInt();
+}