[PATCH 2 of 2] (issue130) Do not show error when software was not found and handle it in setLastMod

Wald Commits scm-commit at wald.intevation.org
Thu Sep 18 11:13:11 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1411031374 -7200
# Node ID a41338b18273518d0f566edf58b294dea5cfb0a2
# Parent  a4282bc67a8bc6e352bd8cfd2a1add7c5e9a31df
(issue130) Do not show error when software was not found and handle it in setLastMod

diff -r a4282bc67a8b -r a41338b18273 ui/mainwindow.cpp
--- 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
 }
 


More information about the Trustbridge-commits mailing list