changeset 1145:a41338b18273

(issue130) Do not show error when software was not found and handle it in setLastMod
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 18 Sep 2014 11:09:34 +0200
parents a4282bc67a8b
children 5fdda2ad19fb
files ui/mainwindow.cpp
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Thu Sep 18 11:08:57 2014 +0200
+++ b/ui/mainwindow.cpp	Thu Sep 18 11:09:34 2014 +0200
@@ -554,7 +554,14 @@
 void MainWindow::setLastModifiedSWDate(const QDateTime &date)
 {
     mSettings.beginGroup("Software");
+#ifdef IS_TAG_BUILD
+    /* We accept an invalid date to force installing any avialable update
+     * in release mode. Otherwise we default to current datetime when we
+     * did not find out version.*/
     mSettings.setValue("installedDate", date);
+#else
+    mSettings.setValue("installedDate", date.isValid() ? date : QDateTime::currentDateTime());
+#endif
     mSettings.setValue("installedVersion", QApplication::applicationVersion());
     mSettings.endGroup();
     checkUpdates();
@@ -564,6 +571,10 @@
 {
     /* TODO logging and handle error according to a plan */
     syslog_error_printf ("Failed to check for updates: %s", message.toUtf8().constData());
+#ifdef IS_TAG_BUILD
+    /* During tag build it should never happen that an url checked is not available
+     * during development this is normal as each revision produces a new url. */
+    setState(TransferError);
     if (!isVisible()) {
         mCurMessage = message;
         mTrayIcon->show();
@@ -571,15 +582,6 @@
     } else {
         showErrorMessage(tr("Failed to check for updates:") + "\n"  + message);
     }
-    setState(TransferError);
-
-#ifndef IS_TAG_BUILD
-    /* For development versions we default to datetime::now if
-     * we can not find our version. */
-    if (!mSettings.contains("Software/installedDate") ||
-          mSettings.value("Software/installedVersion").toString() != QApplication::applicationVersion()) {
-        setLastModifiedSWDate(QDateTime::currentDateTime());
-    }
 #endif
 }
 

http://wald.intevation.org/projects/trustbridge/