diff ui/mainwindow.cpp @ 1371:23df332b2a4c

(issue179) Read install signature timestamp from config This also changes the way the sigDt is propgated to the MainWindow. It no longer uses the settings but hands it over as a parameter directly.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 24 Nov 2014 15:48:49 +0100
parents 3d7ddf698480
children 00fcb9c4d16b
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Mon Nov 24 14:43:36 2014 +0100
+++ b/ui/mainwindow.cpp	Mon Nov 24 15:48:49 2014 +0100
@@ -124,10 +124,11 @@
     return -1;
 }
 
-MainWindow::MainWindow(bool trayMode):
+MainWindow::MainWindow(bool trayMode, const QDateTime& sigDt):
     mTrayMode(trayMode),
     mManualDetailsShown(false),
-    mFailedConnections(0)
+    mFailedConnections(0),
+    mSigDt(sigDt)
 {
     createActions();
     createTrayIcon();
@@ -281,15 +282,14 @@
     bin_verify_result verifyResult = verify_binary(swFileName.toUtf8().constData(),
             swFileName.toUtf8().size());
     QDateTime sigDt = QDateTime::fromTime_t (verifyResult.sig_time);
-    QDateTime currentSigDt = mSettings.value("Software/currentSigDt").toDateTime();
 
-    if (verifyResult.result != VerifyValid || (currentSigDt.isValid() && sigDt <= currentSigDt)) {
+    if (verifyResult.result != VerifyValid || (mSigDt.isValid() && sigDt <= mSigDt)) {
         handleLTE(lteInvalidSoftware);
         if (verifyResult.result != VerifyValid) {
             qDebug() << "Failed to verify downloaded data.";
         } else {
             qDebug() << "Software update was signed at: " << sigDt;
-            qDebug() << "But the installed software was signed on: " << currentSigDt;
+            qDebug() << "But the installed software was signed on: " << mSigDt;
             if (verifyResult.fptr) {
                 fclose(verifyResult.fptr);
             }
@@ -425,15 +425,14 @@
             filePath.toUtf8().size());
 
     QDateTime sigDt = QDateTime::fromTime_t (vres.sig_time);
-    QDateTime currentSigDt = mSettings.value("Software/currentSigDt").toDateTime();
 
-    if (vres.result != VerifyValid || (currentSigDt.isValid() && sigDt <= currentSigDt)) {
+    if (vres.result != VerifyValid || (mSigDt.isValid() && sigDt <= mSigDt)) {
         handleLTE(lteInvalidSoftware);
         if (vres.result != VerifyValid) {
             qDebug() << "Failed to verify installer.";
         } else {
             qDebug() << "Software update was signed at: " << sigDt;
-            qDebug() << "But the installed software was signed on: " << currentSigDt;
+            qDebug() << "But the installed software was signed on: " << mSigDt;
             if (vres.fptr) {
                 fclose(vres.fptr);
             }

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