aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/updatemanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/updatemanager.cpp')
-rw-r--r--qt-ui/updatemanager.cpp17
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)