[PATCH 5 of 5] Merged

Wald Commits scm-commit at wald.intevation.org
Wed Sep 24 17:50:39 CEST 2014


# HG changeset patch
# User Emanuel Schuetze <emanuel at intevation.de>
# Date 1411573823 -7200
# Node ID 4692f8860a24bb749818a9b01c6f53f26d824943
# Parent  17aa7cf0bedd74dc80fa5dd3d0f16b1904e16b6e
# Parent  33a17569812a29d03d22c888a5f4a5f0dc7dde90
Merged.

diff -r 17aa7cf0bedd -r 4692f8860a24 AUTHORS
--- a/AUTHORS	Wed Sep 24 17:50:09 2014 +0200
+++ b/AUTHORS	Wed Sep 24 17:50:23 2014 +0200
@@ -1,5 +1,5 @@
-TrustBridge was written by the follwing authors of 
-Intevation GmbH <http://intevation.de/>:
+TrustBridge software enginieering by
+Intevation GmbH <http://intevation.de/> in particular:
 
   Andre Heinecke <andre.heinecke at intevation.de>
   Bernhard Reiter <bernhard.reiter at intevation.de>
diff -r 17aa7cf0bedd -r 4692f8860a24 ui/certificateitemwidget.cpp
--- a/ui/certificateitemwidget.cpp	Wed Sep 24 17:50:09 2014 +0200
+++ b/ui/certificateitemwidget.cpp	Wed Sep 24 17:50:23 2014 +0200
@@ -11,6 +11,27 @@
 #include <QDebug>
 #include <QStyleFactory>
 #include <QToolButton>
+#include <QSignalBlocker>
+
+void CheckLessToolBtn::paintEvent(QPaintEvent * pe) {
+
+    /* Hack to always paint the button as if it were
+     * not checked. */
+    bool oldchecked = isChecked();
+    QIcon oldIcon = icon();
+    QIcon tmpIcon;
+    if (isEnabled())
+        tmpIcon = QIcon(oldIcon.pixmap(QSize(48, 48), QIcon::Normal, oldchecked ? QIcon::On : QIcon::Off));
+    else {
+        tmpIcon = QIcon(oldIcon.pixmap(QSize(48, 48), QIcon::Disabled, oldchecked ? QIcon::On : QIcon::Off));
+    }
+    QSignalBlocker blk(this);
+    setChecked(false);
+    setIcon(tmpIcon);
+    QToolButton::paintEvent(pe);
+    setIcon(oldIcon);
+    setChecked(oldchecked);
+}
 
 CertificateItemWidget::CertificateItemWidget(QWidget *parent,
                                              const Certificate &cert,
@@ -22,12 +43,12 @@
     mCertificate = cert;
     mOriginalState = state;
     btn->setCheckable(true);
-    btn->setStyleSheet("QToolButton:Checked{"
+/*    btn->setStyleSheet("QToolButton:Checked{"
          "border: 1px solid #8f8f91;"
          "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
                                            "stop: 0 #f6f7fa, stop: 1 #dadbde);"
     "}"
-    );
+    );*/
     setState(state);
     setupGUI();
 }
diff -r 17aa7cf0bedd -r 4692f8860a24 ui/certificateitemwidget.h
--- a/ui/certificateitemwidget.h	Wed Sep 24 17:50:09 2014 +0200
+++ b/ui/certificateitemwidget.h	Wed Sep 24 17:50:23 2014 +0200
@@ -14,10 +14,14 @@
  */
 #include <QWidget>
 #include <QLabel>
+#include <QToolButton>
 
 #include "certificate.h"
 
-class QToolButton;
+class CheckLessToolBtn : public QToolButton
+{
+    void paintEvent(QPaintEvent * pe);
+};
 
 class CertificateItemWidget : public QWidget
 {
diff -r 17aa7cf0bedd -r 4692f8860a24 ui/mainwindow.cpp
--- 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;
     }
 
diff -r 17aa7cf0bedd -r 4692f8860a24 ui/mainwindow.h
--- a/ui/mainwindow.h	Wed Sep 24 17:50:09 2014 +0200
+++ b/ui/mainwindow.h	Wed Sep 24 17:50:23 2014 +0200
@@ -68,7 +68,6 @@
      * @brief The internal state of the application
      */
     enum CurrentState {
-        BeforeDownload, /*! Initial state before a connection is tried. */
         NewListAvailable, /*! A new certificate list is available. */
         NewSoftwareAvailable, /*! A new Software is avaialable. */
         DownloadingSW, /*! Download in progress. */


More information about the Trustbridge-commits mailing list