From d63910caa3dfffb6c8ad85a5db322d57a86eb3e3 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 5 Jan 2021 12:07:41 -0800 Subject: [PATCH] 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 --- desktop-widgets/updatemanager.cpp | 6 ++---- 1 file 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)); }