diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-01-03 13:47:05 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-03 13:47:05 -0800 |
commit | 5cc261311ec1649440ff9e4db8ff9e3229f167b6 (patch) | |
tree | 56157e5332597d95ec090217be18d67490f7b90d | |
parent | 09f5289271eb85cbd63d65e16a7c14705ff27029 (diff) | |
download | subsurface-5cc261311ec1649440ff9e4db8ff9e3229f167b6.tar.gz |
Fix the update check logic
Oops. That was supposed to do the opposite of what it ended up doing. The
goal was to NOT check for two weeks when the user updates to a new
version.
Instead it always checked when the user updated to a new version.
This mostly would hit developers...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/updatemanager.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/qt-ui/updatemanager.cpp b/qt-ui/updatemanager.cpp index b6e8dc47a..d672b2dbb 100644 --- a/qt-ui/updatemanager.cpp +++ b/qt-ui/updatemanager.cpp @@ -12,18 +12,25 @@ UpdateManager::UpdateManager(QObject *parent) : QObject(parent) // is this the first time this version was run? QSettings settings; settings.beginGroup("UpdateManager"); - if (settings.contains("LastVersionUsed") && settings.value("LastVersionUsed").toString() == GIT_VERSION_STRING) { - // this is the version we've been using + if (settings.contains("DontCheckForUpdates") && settings.value("DontCheckForUpdates") == "TRUE") + return; + if (settings.contains("LastVersionUsed")) { + // we have checked at least once before + if (settings.value("LastVersionUsed").toString() != GIT_VERSION_STRING) { + // we have just updated - wait two weeks before you check again + settings.setValue("LastVersionUsed", QString(GIT_VERSION_STRING)); + settings.setValue("NextCheck", QDateTime::currentDateTime().addDays(14).toString(Qt::ISODate)); + return; + } + // is it time to check again? QString nextCheckString = settings.value("NextCheck").toString(); QDateTime nextCheck = QDateTime::fromString(nextCheckString, Qt::ISODate); if (nextCheck > QDateTime::currentDateTime()) return; } settings.setValue("LastVersionUsed", QString(GIT_VERSION_STRING)); - if (settings.contains("DontCheckForUpdates") && settings.value("DontCheckForUpdates") == "TRUE") - return; - checkForUpdates(true); settings.setValue("NextCheck", QDateTime::currentDateTime().addDays(14).toString(Qt::ISODate)); + checkForUpdates(true); } void UpdateManager::checkForUpdates(bool automatic) |