diff ui/mainwindow.cpp @ 1241:4692f8860a24

Merged.
author Emanuel Schuetze <emanuel@intevation.de>
date Wed, 24 Sep 2014 17:50:23 +0200
parents 33a17569812a
children 8748223990eb
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Wed Sep 24 17:50:09 2014 +0200
+++ b/ui/mainwindow.cpp	Wed Sep 24 17:50:23 2014 +0200
@@ -33,6 +33,7 @@
 #include <QDesktopServices>
 
 #include "certificatelist.h"
+#include "certificateitemwidget.h"
 #include "downloader.h"
 #include "helpdialog.h"
 #include "aboutdialog.h"
@@ -266,7 +267,14 @@
 }
 
 void MainWindow::handleNewList(const QString& fileName, const QDateTime& modDate) {
-    qDebug() << "new list available";
+
+    if (mSettings.value("List/available").toString() == fileName &&
+        getState() == NewListAvailable) {
+        qDebug() << "List already handled";
+        return;
+    } else {
+        qDebug() << "Handling list";
+    }
     mSettings.setValue("List/available", fileName);
     mSettings.setValue("List/availableDate", modDate);
 
@@ -512,7 +520,6 @@
     connect(downloader, SIGNAL(newListAvailable(const QString&, const QDateTime&)),
             this, SLOT(handleNewList(const QString&, const QDateTime&)));
     if (!downloadSW) {
-        setState(BeforeDownload);
         connect(downloader, SIGNAL(newSoftwareAvailable(const QString&, const QDateTime&)),
                 this, SLOT(handleNewSW(const QString&, const QDateTime&)));
     } else {
@@ -581,6 +588,7 @@
 void MainWindow::downloaderError(const QString &message, SSLConnection::ErrorCode error)
 {
     syslog_error_printf ("Failed to check for updates: %s", message.toUtf8().constData());
+    qDebug() << "Downloader error: " << error;
     if (error == SSLConnection::InvalidCertificate) {
         handleLTE(lteInvalidCertificate);
     } else {
@@ -1128,12 +1136,8 @@
     if (changeCount() && !mUpdatesManual->certificates().size()) {
         mUpdatesTip->setText(
                 tr("You should apply the following, recommended changes to your certificate stores:"));
-    } else if (changeCount()) {
-        mUpdatesTip->setText(
-                tr("You can apply the following, changes to your certificate stores:"));
     } else {
-        mUpdatesTip->setText(
-                tr("There are currently no changes for your certificate stores."));
+        mUpdatesTip->setText("");
     }
 
     if (!changeCount()) {
@@ -1233,6 +1237,7 @@
 {
     /* TODO (issue134): if nothing is available (neither old nor new) add some progress
      * indication */
+    setUpdatesEnabled(false);
     mInstallList->clear();
     mRemoveList->clear();
     mUpdatesNew->clear();
@@ -1248,7 +1253,7 @@
             bool state = !mPreviouslyUnselected.contains(cert.base64Line());
             if (cert.isInstallCert()) {
                 oldInstallCerts.append(cert);
-                QToolButton* actionBtn = new QToolButton();
+                CheckLessToolBtn* actionBtn = new CheckLessToolBtn();
                 QIcon btnIcon;
                 if (!state) {
                     btnIcon.addFile(":/img/cert-to-be-installed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off);
@@ -1266,7 +1271,7 @@
             }
             else {
                 oldRemoveCerts.append(cert);
-                QToolButton* actionBtn = new QToolButton();
+                CheckLessToolBtn* actionBtn = new CheckLessToolBtn();
                 QIcon btnIcon;
                 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed."));
                 actionBtn->setProperty("ToolTip_On", tr("Certificate has not been removed."));
@@ -1291,7 +1296,7 @@
                 if (mInstalledList.getCertificates().contains(cert)) {
                     // Was in the old list.
                     oldInstallCerts.append(cert);
-                    QToolButton* actionBtn = new QToolButton();
+                    CheckLessToolBtn* actionBtn = new CheckLessToolBtn();
                     QIcon btnIcon;
                     actionBtn->setProperty("ToolTip_Off", tr("Certificate is installed."));
                     actionBtn->setProperty("ToolTip_On", tr("Certifcate is not installed."));
@@ -1303,7 +1308,7 @@
                 else {
                     // Is a brand new certificate
                     newInstallCerts.append(cert);
-                    QToolButton* actionBtn = new QToolButton();
+                    CheckLessToolBtn* actionBtn = new CheckLessToolBtn();
                     QIcon btnIcon;
                     actionBtn->setProperty("ToolTip_Off", tr("Certificate will be installed."));
                     actionBtn->setProperty("ToolTip_On", tr("Certificate will not be installed."));
@@ -1319,7 +1324,7 @@
                     // Was in the old list.
                     oldRemoveCerts.append(cert);
                     // Is removed, so set editable to false.
-                    QToolButton* actionBtn = new QToolButton();
+                    CheckLessToolBtn* actionBtn = new CheckLessToolBtn();
                     QIcon btnIcon;
                     actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed."));
                     actionBtn->setProperty("ToolTip_On", tr("Certificate has not been removed."));
@@ -1337,7 +1342,7 @@
                     // Was in the old list with status "install" and now has the
                     // status "remove".
                     newRemoveCerts.append(cert);
-                    QToolButton* actionBtn = new QToolButton();
+                    CheckLessToolBtn* actionBtn = new CheckLessToolBtn();
                     QIcon btnIcon;
                     actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed."));
                     actionBtn->setProperty("ToolTip_On", tr("Certificate will not be removed."));
@@ -1351,6 +1356,7 @@
     }
 
     listChanged(0);
+    setUpdatesEnabled(true);
 }
 
 void MainWindow::installerError(const QString& errMsg) {
@@ -1723,6 +1729,7 @@
 void MainWindow::handleLTE(LongTimeErrors lte, bool reset)
 {
     QString settingPrefix;
+ //   qDebug() << "Handle LTE for " << lte << " Reset? : " << reset;
     switch (lte) {
         case lteInvalidSoftware:
             settingPrefix = "LTE/invalidSW";
@@ -1744,7 +1751,7 @@
         /* delete all values and be done */
         mSettings.remove(settingPrefix + "_lastSaved");
         mSettings.remove(settingPrefix + "_count");
-        mSettings.remove(settingPrefix + "_lastMsgShown");
+        mSettings.remove(settingPrefix + "_lastShown");
         return;
     }
 

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