[PATCH] (issue179) Handle software update even if new version can't be found on server

Wald Commits scm-commit at wald.intevation.org
Thu Jan 15 14:40:12 CET 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1421322169 -3600
# Node ID 831d28c2291db8ccc3ffef5121a0c197051924b9
# Parent  3c61ab983f9b6a790788dcbee56bb046ae8ca587
(issue179) Handle software update even if new version can't be found on server

diff -r 3c61ab983f9b -r 831d28c2291d ui/mainwindow.cpp
--- a/ui/mainwindow.cpp	Thu Jan 15 11:50:19 2015 +0100
+++ b/ui/mainwindow.cpp	Thu Jan 15 12:42:49 2015 +0100
@@ -664,26 +664,25 @@
 {
     QDateTime swAvailableLastMod = mSettings.value("Software/availableDate").toDateTime();
 
-    if (swAvailableLastMod.isValid() && date.isValid()) {
-        if (date >= swAvailableLastMod) {
-            qDebug() << "Installed an update: " << date <<
-                " available was " << swAvailableLastMod;
-            syslog_info_printf ("Software has been updated to version: %s\n",
-                QApplication::applicationVersion().toUtf8().constData());
-            QString fileName = mSettings.value("Software/available").toString();
-            if (fileName.isEmpty()) {
-                qDebug() << "Software marked as available but no filename set.";
+    qDebug() << "Set last modified date: " << date << " available: " << swAvailableLastMod;
+    if (swAvailableLastMod.isValid() && (!date.isValid() || date >= swAvailableLastMod)) {
+        qDebug() << "Installed an update: " << date <<
+            " available was " << swAvailableLastMod;
+        syslog_info_printf ("Software has been updated to version: %s\n",
+            QApplication::applicationVersion().toUtf8().constData());
+        QString fileName = mSettings.value("Software/available").toString();
+        if (fileName.isEmpty()) {
+            qDebug() << "Software marked as available but no filename set.";
+        } else {
+            if (QFile::remove(fileName)) {
+                qDebug() << "Removed: " << fileName;
             } else {
-                if (QFile::remove(fileName)) {
-                    qDebug() << "Removed: " << fileName;
-                } else {
-                    qDebug() << "Failed to remove: " << fileName;
-                }
+                qDebug() << "Failed to remove: " << fileName;
             }
-            /* Clear out available data. */
-            mSettings.remove("Software/available");
-            mSettings.remove("Software/availableDate");
         }
+        /* Clear out available data. */
+        mSettings.remove("Software/available");
+        mSettings.remove("Software/availableDate");
     }
 
     mSettings.beginGroup("Software");


More information about the Trustbridge-commits mailing list