summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/updatemanager.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-05 12:07:41 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-06 10:18:23 -0800
commitd63910caa3dfffb6c8ad85a5db322d57a86eb3e3 (patch)
tree33ec50a8c2aa3928a3a89ee050abe87a5888a4b0 /desktop-widgets/updatemanager.cpp
parentfabeb71adedf5c0026d874ad425d98cc14808657 (diff)
downloadsubsurface-d63910caa3dfffb6c8ad85a5db322d57a86eb3e3.tar.gz
desktop/update-check: fix logic when to ask about update check
Checking a field that we intentionally don't store to disk is obviously wrong. It's been this way for a long time and it has annoyed me many times, but somehow I never spent the time to track down why this was happening. It makes much more sense to use the presence of either the don't check flag or a next check date as an indication that we have already asked this question. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/updatemanager.cpp')
-rw-r--r--desktop-widgets/updatemanager.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/desktop-widgets/updatemanager.cpp b/desktop-widgets/updatemanager.cpp
index ea2f41868..fa52cad40 100644
--- a/desktop-widgets/updatemanager.cpp
+++ b/desktop-widgets/updatemanager.cpp
@@ -22,7 +22,6 @@ UpdateManager::UpdateManager(QObject *parent) :
return;
qPrefUpdateManager::set_last_version_used(subsurface_git_version());
- qPrefUpdateManager::set_next_check(QDate::currentDate().addDays(14));
checkForUpdates(true);
}
@@ -107,8 +106,7 @@ void UpdateManager::requestReceived()
}
if (isAutomaticCheck) {
auto update_settings = qPrefUpdateManager::instance();
- if (!update_settings->dont_check_exists()) {
-
+ if (!update_settings->dont_check_for_updates() && update_settings->next_check() == QDate::fromJulianDay(0)) {
// we allow an opt out of future checks
QMessageBox response(MainWindow::instance());
QString message = tr("Subsurface is checking every two weeks if a new version is available. "
@@ -120,7 +118,7 @@ void UpdateManager::requestReceived()
response.setIcon(QMessageBox::Question);
response.setWindowModality(Qt::WindowModal);
update_settings->set_dont_check_for_updates(response.exec() != QMessageBox::Accepted);
- update_settings->set_dont_check_exists(true);
}
}
+ qPrefUpdateManager::set_next_check(QDate::currentDate().addDays(14));
}