[PATCH 4 of 4] Merged

Wald Commits scm-commit at wald.intevation.org
Wed Jul 2 19:32:37 CEST 2014


# HG changeset patch
# User Sascha Wilde <wilde at intevation.de>
# Date 1404322336 -7200
# Node ID 3777482dc306c9358d99c8c60ab1f7d973ba6e4b
# Parent  ce3e33e66a177c8a635464cec2808e54a5c64f25
# Parent  b0929968562a82f27384e63561d4c7af765bcdf8
Merged

diff -r ce3e33e66a17 -r 3777482dc306 ui/CMakeLists.txt
--- a/ui/CMakeLists.txt	Wed Jul 02 19:31:51 2014 +0200
+++ b/ui/CMakeLists.txt	Wed Jul 02 19:32:16 2014 +0200
@@ -41,6 +41,7 @@
     ${CMAKE_CURRENT_SOURCE_DIR}/processhelp_win.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/processhelp_linux.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/processwaitdialog.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/textoverlaybutton.cpp
     ${CERTIFICATELIST_SOURCES}
     ${DOWNLOADER_SOURCES}
 )
diff -r ce3e33e66a17 -r 3777482dc306 ui/certificatelistwidget.cpp
--- a/ui/certificatelistwidget.cpp	Wed Jul 02 19:31:51 2014 +0200
+++ b/ui/certificatelistwidget.cpp	Wed Jul 02 19:32:16 2014 +0200
@@ -233,8 +233,10 @@
 
 void CertificateListWidget::setSelected(int index)
 {
+    if (index <= 0) {
+        index = 0;
+    }
     mCertificateList->setFocus();
-    if (mCertificateList->count() > 0) {
-        mCertificateList->item(0)->setSelected(true);
-    }
+    mCertificateList->item(index)->setSelected(true);
+    mCertificateList->setCurrentRow(index);
 }
diff -r ce3e33e66a17 -r 3777482dc306 ui/certificatelistwidget.h
--- a/ui/certificatelistwidget.h	Wed Jul 02 19:31:51 2014 +0200
+++ b/ui/certificatelistwidget.h	Wed Jul 02 19:32:16 2014 +0200
@@ -42,6 +42,7 @@
     int selectedCertCount();
     bool contains(const Certificate &cert);
     void setSelected(int index);
+    int selected() { return mCertificateList->currentRow(); }
 
 private:
     void setupGUI();
diff -r ce3e33e66a17 -r 3777482dc306 ui/l10n/trustbridge_de_DE.ts
--- a/ui/l10n/trustbridge_de_DE.ts	Wed Jul 02 19:31:51 2014 +0200
+++ b/ui/l10n/trustbridge_de_DE.ts	Wed Jul 02 19:32:16 2014 +0200
@@ -50,12 +50,13 @@
 <context>
     <name>CertificateItemWidget</name>
     <message>
-        <location filename="../certificateitemwidget.cpp" line="57"/>
+        <location filename="../certificateitemwidget.cpp" line="72"/>
+        <location filename="../certificateitemwidget.cpp" line="94"/>
         <source>uninstall</source>
         <translation>Deinstallieren</translation>
     </message>
     <message>
-        <location filename="../certificateitemwidget.cpp" line="58"/>
+        <location filename="../certificateitemwidget.cpp" line="73"/>
         <source>keep</source>
         <translation>Behalten</translation>
     </message>
@@ -158,83 +159,83 @@
 <context>
     <name>MainWindow</name>
     <message>
-        <location filename="../mainwindow.cpp" line="232"/>
+        <location filename="../mainwindow.cpp" line="236"/>
         <source>An updated certificate list is available. Click here to install.</source>
         <translation>Eine aktualisierte Zertifikatsliste ist verfügbar. Klicken Sie hier zum Installieren.</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="403"/>
+        <location filename="../mainwindow.cpp" line="411"/>
         <source>Check for Updates</source>
         <translation>Aktualisierungen prüfen</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="405"/>
-        <location filename="../mainwindow.cpp" line="822"/>
+        <location filename="../mainwindow.cpp" line="413"/>
+        <location filename="../mainwindow.cpp" line="852"/>
         <source>Quit</source>
         <translation>Beenden</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="423"/>
-        <location filename="../mainwindow.cpp" line="735"/>
+        <location filename="../mainwindow.cpp" line="431"/>
+        <location filename="../mainwindow.cpp" line="753"/>
         <source>TrustBridge</source>
         <translation>TrustBridge</translation>
     </message>
     <message>
+        <location filename="../mainwindow.cpp" line="473"/>
         <source>Updates</source>
-        <translation type="vanished">Aktualisierungen</translation>
+        <translation>Aktualisierungen</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="484"/>
+        <location filename="../mainwindow.cpp" line="492"/>
         <source>Revoked
 certificates</source>
         <translation>Zurückgezogene
 Zertifikate</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="540"/>
         <source>Last update of TrustBridge: %1</source>
-        <translation>Letzte Aktualisierung von TrustBridge: %1</translation>
+        <translation type="vanished">Letzte Aktualisierung von TrustBridge: %1</translation>
     </message>
     <message>
         <source>Updates (%1/%2)</source>
         <translation type="vanished">Aktualisierungen (%1/%2)</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="553"/>
-        <location filename="../mainwindow.cpp" line="826"/>
+        <location filename="../mainwindow.cpp" line="572"/>
+        <location filename="../mainwindow.cpp" line="857"/>
         <source>Quit without saving</source>
         <translation>Beenden ohne Speichern</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="604"/>
-        <location filename="../mainwindow.cpp" line="838"/>
+        <location filename="../mainwindow.cpp" line="620"/>
+        <location filename="../mainwindow.cpp" line="891"/>
         <source>Remove revoked certificates (%1/%2)</source>
         <translation>Zurückgezogene Zertifikate löschen (%1/%2)</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="667"/>
+        <location filename="../mainwindow.cpp" line="685"/>
         <source>Trusted certificates</source>
         <translation>Vertrauenswürdige Zertifikate</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="668"/>
+        <location filename="../mainwindow.cpp" line="686"/>
         <source>The following list of trusted root certificates is managed by the BSI. The BSI validates independently the authenticity, security and actuality of these certificates.</source>
         <translation>Die folgende Liste von Wurzelzertifikaten wird durch das BSI betreut. Das BSI überprüft dabei unabhängig die Echtheit, Sicherheit und Aktualität der Zertifikate.</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="675"/>
+        <location filename="../mainwindow.cpp" line="693"/>
         <source>Please choose the certificates you want to trust or untrust. TrustBridge will install these certificates for your secure communication for email and internet.</source>
         <translation>Legen Sie fest, welchen Zertifikaten Sie vertrauen wollen. TrustBridge wird diese Zertifikate dann für Ihre sichere Kommunikation via E-Mail und Internet installieren.</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="475"/>
+        <location filename="../mainwindow.cpp" line="483"/>
         <source>Trusted
 certificates</source>
         <translation>Vertrauenswürdige
 Zertifikate</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="493"/>
+        <location filename="../mainwindow.cpp" line="501"/>
         <source>Information
 and help</source>
         <translation>Informationen
@@ -245,18 +246,15 @@
         <translation type="obsolete">Aktualisierungen (%1/%2) {1)?}</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="538"/>
-        <location filename="../mainwindow.cpp" line="907"/>
         <source>Last update of certificates: %1</source>
-        <translation>Letzte Aktualisierung der Zertifikate: %1</translation>
+        <translation type="vanished">Letzte Aktualisierung der Zertifikate: %1</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="542"/>
         <source>You should apply the following changes to your root certificates:</source>
-        <translation>Sie sollten die folgenden Änderungen an Ihren Wurzelzertifikaten übernehmen:</translation>
+        <translation type="vanished">Sie sollten die folgenden Änderungen an Ihren Wurzelzertifikaten übernehmen:</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="551"/>
+        <location filename="../mainwindow.cpp" line="555"/>
         <source>Check for updates</source>
         <translation>Nach Aktualisierungen suchen</translation>
     </message>
@@ -265,91 +263,119 @@
         <translation type="vanished">Aktualisierungen einspielen</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="587"/>
-        <location filename="../mainwindow.cpp" line="833"/>
+        <location filename="../mainwindow.cpp" line="603"/>
+        <location filename="../mainwindow.cpp" line="876"/>
         <source>Install new trusted certificates (%1/%2)</source>
         <translation>Neue, vertrauenswürdige Zertifikate installieren (%1/%2)</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="589"/>
-        <location filename="../mainwindow.cpp" line="606"/>
-        <location filename="../mainwindow.cpp" line="623"/>
-        <location filename="../mainwindow.cpp" line="1111"/>
-        <location filename="../mainwindow.cpp" line="1125"/>
-        <location filename="../mainwindow.cpp" line="1138"/>
+        <location filename="../mainwindow.cpp" line="605"/>
+        <location filename="../mainwindow.cpp" line="622"/>
+        <location filename="../mainwindow.cpp" line="639"/>
+        <location filename="../mainwindow.cpp" line="866"/>
+        <location filename="../mainwindow.cpp" line="881"/>
+        <location filename="../mainwindow.cpp" line="896"/>
+        <location filename="../mainwindow.cpp" line="1176"/>
+        <location filename="../mainwindow.cpp" line="1190"/>
+        <location filename="../mainwindow.cpp" line="1203"/>
         <source>Show details</source>
         <translation>Details einblenden</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="698"/>
+        <location filename="../mainwindow.cpp" line="716"/>
         <source>Revoked certificates</source>
         <translation>Zurückgezogene Zertifikate</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="699"/>
+        <location filename="../mainwindow.cpp" line="717"/>
         <source>Certificates can be corrupted or stolen and misused in many ways. Therefore the BSI recommends to remove all revoked certificates from your system.</source>
         <translation>Zertifikate können auf vielfache Weise korrumpiert oder gestohlen und missbraucht werden. Das BSI empfiehlt Ihnen daher zurückgezogene Zertifikate auch umgehend von Ihrem System zu entfernen.</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="706"/>
+        <location filename="../mainwindow.cpp" line="724"/>
         <source>The follwing unsecure certificates were revoked by the BSI. Already uninstalled certificates cannot be reinstalled. It is recommended that you select all certificates to uninstall if you still have revoked certificates installed.</source>
         <translation>Die folgenden unsicheren Zertifikate wurden vom BSI zurückgezogen. Bereits deinstallierte Zertifikate können nicht wieder installiert werden. Es wird empfohlen, dass Sie alle Zertifikate zur Deinstallation markieren, sofern Sie noch zurückgezogene Zertifikate installiert haben.</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="621"/>
-        <location filename="../mainwindow.cpp" line="910"/>
-        <location filename="../mainwindow.cpp" line="1037"/>
-        <location filename="../mainwindow.cpp" line="1047"/>
+        <location filename="../mainwindow.cpp" line="637"/>
+        <location filename="../mainwindow.cpp" line="975"/>
+        <location filename="../mainwindow.cpp" line="1102"/>
+        <location filename="../mainwindow.cpp" line="1112"/>
         <source>Manually changed certificates (%1)</source>
         <translation>Manuell geänderte Zertifikate (%1)</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="448"/>
+        <location filename="../mainwindow.cpp" line="456"/>
         <source>Trust in your digital communication</source>
         <translation>Vertrauen in Ihre digitale Kommunikation</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="465"/>
         <source>Changes</source>
-        <translation type="unfinished"></translation>
+        <translation type="vanished">Änderungen</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="536"/>
-        <location filename="../mainwindow.cpp" line="823"/>
+        <location filename="../mainwindow.cpp" line="540"/>
+        <location filename="../mainwindow.cpp" line="853"/>
         <source>Certificates unchanged</source>
-        <translation type="unfinished"></translation>
+        <translation>Zertifikate unverändert</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="555"/>
-        <source>Apply changes</source>
-        <translation type="unfinished"></translation>
+        <location filename="../mainwindow.cpp" line="545"/>
+        <source>TrustBridge Version: %1</source>
+        <translation>TrustBridge Version: %1</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="736"/>
+        <location filename="../mainwindow.cpp" line="550"/>
+        <source>Last sucessful update check: %1</source>
+        <translation>Letzte erfolgreiche Prüfung nach Aktualisierungen: %1</translation>
+    </message>
+    <message>
+        <source>You should apply the following, recommended changes to your root certificates.</source>
+        <translation type="vanished">Es wird empfohlen, die nachfolgenden Änderungen an Ihren Wurzelzertifikaten zu übernehmen.</translation>
+    </message>
+    <message>
+        <location filename="../mainwindow.cpp" line="861"/>
+        <source>Apply changes</source>
+        <translation>Änderungen übernehmen</translation>
+    </message>
+    <message>
+        <location filename="../mainwindow.cpp" line="754"/>
         <source>Version: </source>
         <translation>Version:</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="753"/>
+        <location filename="../mainwindow.cpp" line="569"/>
+        <location filename="../mainwindow.cpp" line="847"/>
+        <source>There are currently no changes for your certificate stores.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mainwindow.cpp" line="576"/>
+        <location filename="../mainwindow.cpp" line="855"/>
+        <source>Install certificates again</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mainwindow.cpp" line="771"/>
         <source>TrustBridge is a root certificate installer for Windows and Linux.</source>
         <translation>TrustBridge ist eine Wurzelzertifikatsinstaller für Windows und Linux.</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="758"/>
+        <location filename="../mainwindow.cpp" line="776"/>
         <source>The root certificate lists are managed by the German <a href="https://www.bsi.bund.de">Federal Office for Information Security (BSI)</a>.
 
 </source>
         <translation>Die Liste der Wurzelzertifikate wird vom <a href="https://www.bsi.bund.de">Bundesamt für Sicherheit in der Informationstechnik (BSI)</a> verwaltet.</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="764"/>
+        <location filename="../mainwindow.cpp" line="782"/>
         <source>The software was developed by the companies <a href="http://www.intevation.de">Intevation GmbH</a> and  <a href="http://www.dn-systems.de">DN-Systems GmbH</a>, <br> contracted by the German Federal Office for Information Security (BSI).
 
 </source>
         <translation>Die Software wurde von den Unternehmen <a href="http://www.intevation.de">Intevation GmbH</a> und  <a href="http://www.dn-systems.de">DN-Systems GmbH</a> entwickelt, <br> beauftragt vom Bundesamt für Sicherheit in der Informationstechnik (BSI).</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="771"/>
+        <location filename="../mainwindow.cpp" line="789"/>
         <source>TrustBridge is Free Software licensed under GNU GPL v2+.
 
 Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik</source>
@@ -358,41 +384,70 @@
 Copyright (C) 2014, Bundesamt für Sicherheit in der Informationstechnik (BSI)</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="827"/>
         <source>Changes (%1)</source>
-        <translation type="unfinished"></translation>
+        <translation type="vanished">Änderungen (%1)</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="886"/>
+        <location filename="../mainwindow.cpp" line="947"/>
         <source>install</source>
         <translation>Installieren</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="886"/>
+        <location filename="../mainwindow.cpp" line="947"/>
         <source>ignore</source>
         <translation>Ignorieren</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="1105"/>
-        <location filename="../mainwindow.cpp" line="1119"/>
-        <location filename="../mainwindow.cpp" line="1133"/>
+        <location filename="../mainwindow.cpp" line="969"/>
+        <source>Installed certificates from: %1</source>
+        <translation>Installierte Zertifikate vom: %1</translation>
+    </message>
+    <message>
+        <location filename="../mainwindow.cpp" line="1170"/>
+        <location filename="../mainwindow.cpp" line="1184"/>
+        <location filename="../mainwindow.cpp" line="1198"/>
         <source>Hide details</source>
         <translation>Details ausblenden</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="240"/>
+        <location filename="../mainwindow.cpp" line="1225"/>
+        <source>Last successful update check: %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mainwindow.cpp" line="1228"/>
+        <source>Sucessfully checked for updates.</source>
+        <translation>Prüfung nach Aktualisierungen erfolgreich.</translation>
+    </message>
+    <message>
+        <location filename="../mainwindow.cpp" line="244"/>
         <source>An update for %1 is available.
 Click here to download and install the update.</source>
         <translation>Eine Aktualisierung für %1 ist verfügbar.
 Hier klicken, um Download und Installation zu starten.</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="916"/>
+        <location filename="../mainwindow.cpp" line="841"/>
+        <source>You should apply the following, recommended changes to your certificate stores.</source>
+        <translation>Es wird empfohlen, die nachfolgenden Änderungen an Ihren Zertifikatsspeichern zu übernehmen.</translation>
+    </message>
+    <message>
+        <location filename="../mainwindow.cpp" line="844"/>
+        <source>You can apply the following, changes to your certificate stores.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../mainwindow.cpp" line="858"/>
+        <source>Changes to certificate stores (%1)</source>
+        <translation>Änderungen an Zertifikatsspeichern (%1)</translation>
+    </message>
+    <message>
+        <location filename="../mainwindow.cpp" line="981"/>
         <source>Error executing update</source>
         <translation>Fehler bei der Aktualisierung</translation>
     </message>
     <message>
-        <location filename="../mainwindow.cpp" line="973"/>
+        <location filename="../mainwindow.cpp" line="1038"/>
         <source>Installing certificates...</source>
         <translation>Zertifikate werden installiert...</translation>
     </message>
diff -r ce3e33e66a17 -r 3777482dc306 ui/main.cpp
--- a/ui/main.cpp	Wed Jul 02 19:31:51 2014 +0200
+++ b/ui/main.cpp	Wed Jul 02 19:32:16 2014 +0200
@@ -88,8 +88,8 @@
     }
     app.installTranslator(&translator);
 
-    if (!QSystemTrayIcon::isSystemTrayAvailable() ||
-            !QSystemTrayIcon::supportsMessages()) {
+    if ((!QSystemTrayIcon::isSystemTrayAvailable() ||
+            !QSystemTrayIcon::supportsMessages()) && trayMode) {
         QMessageBox::critical(0, QString::fromLatin1(APPNAME),
                               QObject::tr("Couldn't detect any system tray "
                                           "on this system. This software can only "
diff -r ce3e33e66a17 -r 3777482dc306 ui/mainwindow.cpp
--- a/ui/mainwindow.cpp	Wed Jul 02 19:31:51 2014 +0200
+++ b/ui/mainwindow.cpp	Wed Jul 02 19:32:16 2014 +0200
@@ -47,6 +47,8 @@
 // something to say
 #define NAG_INTERVAL_MINUTES 70
 
+#define DATETIME_FORMAT "dddd, d.MMMM yyyy HH:mm:ss"
+
 #ifndef APPNAME
 #define APPNAME "TrustBridge"
 #endif
@@ -464,16 +466,19 @@
      ***********************************/
     mButtonGroup = new QButtonGroup;
 
-    QToolButton *updatesButton = new QToolButton;
+    TextOverlayButton *updatesButton = new TextOverlayButton;
     updatesButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
     updatesButton->setIcon(QIcon(":/img/view-refresh.png"));
     updatesButton->setIconSize(QSize(40, 40));
-    updatesButton->setText(tr("Changes"));
+    updatesButton->setText(tr("Updates"));
     updatesButton->setFixedWidth(120);
     updatesButton->setFixedHeight(80);
     updatesButton->setCheckable(true);
     updatesButton->setChecked(true);
 
+    connect(this, SIGNAL(changesChanged(const QString&)),
+            updatesButton, SLOT(setOverlay(const QString&)));
+
     QToolButton *allInstallButton = new QToolButton;
     allInstallButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
     allInstallButton->setIcon(QIcon(":/img/document-encrypt.png"));
@@ -541,9 +546,9 @@
     mLastCertUpdate->hide();
     mSoftwareVersionLabel =
         new QLabel(tr("TrustBridge Version: %1").arg(QApplication::applicationVersion()));
-    const QDateTime lastCheck = mSettings.value("lastUpdateCheck").toDateTime();
+    const QDateTime lastCheck = mSettings.value("lastUpdateCheck").toDateTime().toLocalTime();
     if (lastCheck.isValid()) {
-        const QString lastUpdateCheck = QLocale::system().toString(lastCheck);
+        const QString lastUpdateCheck = QLocale::system().toString(lastCheck, DATETIME_FORMAT);
         mLastUpdateCheck =
             new QLabel(tr("Last sucessful update check: %1").arg(lastUpdateCheck));
     } else {
@@ -556,34 +561,37 @@
 
     // addWidget(*Widget, row, column, rowspan, colspan, [Qt::Alignment])
     updatesHeaderLayout->addWidget(mUpdatesHeader, 0, 0, 1, 2);
-    updatesHeaderLayout->addWidget(mLastCertUpdate, 1, 0, 1, 1);
-    updatesHeaderLayout->addWidget(mSoftwareVersionLabel, 2, 0, 1, 1);
-    updatesHeaderLayout->addWidget(mLastUpdateCheck, 3, 0, 1, 1);
+    updatesHeaderLayout->addWidget(mSoftwareVersionLabel, 1, 0, 1, 1);
+    updatesHeaderLayout->addWidget(mLastUpdateCheck, 2, 0, 1, 1);
+    updatesHeaderLayout->addWidget(mLastCertUpdate, 3, 0, 1, 1);
     updatesHeaderLayout->addWidget(searchUpdates, 1, 2, 2, 1, Qt::AlignRight);
     updatesHeaderLayout->setRowMinimumHeight(4, 15);
 
     /* Header 2: Action text and buttons */
-    QLabel *updatesTip =
-        new QLabel(tr("You should apply the following, recommended changes to your root certificates."));
-    updatesTip->setWordWrap(true);
+    mUpdatesTip =
+        new QLabel(tr("There are currently no changes for your certificate stores."));
+    mUpdatesTip->setWordWrap(true);
     QHBoxLayout *updatesHeaderActionButtonLayout = new QHBoxLayout;
     mQuitButton = new QPushButton(" " + tr("Quit without saving"));
     mQuitButton->setIcon(QIcon(":/img/application-exit.png"));
-    QPushButton *installButton = new QPushButton(" " + tr("Apply changes"));
+    mQuitButton->setFixedHeight(30);
+
+    mInstallButton = new QPushButton(" " + tr("Install certificates again"));
+    mInstallButton->setFixedHeight(30);
 #ifdef Q_OS_WIN
     if (is_admin()) {
         QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield);
-        installButton->setIcon(uacShield);
+        mInstallButton->setIcon(uacShield);
     }
 #else
-    installButton->setIcon(QIcon(":/img/view-refresh.png"));
+    mInstallButton->setIcon(QIcon(":/img/view-refresh.png"));
 #endif
     connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp()));
-    connect(installButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts()));
+    connect(mInstallButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts()));
 
     // addWidget(*Widget, row, column, rowspan, colspan)
-    updatesHeaderLayout->addWidget(updatesTip, 5, 0, 1, 2);
-    updatesHeaderActionButtonLayout->addWidget(installButton);
+    updatesHeaderLayout->addWidget(mUpdatesTip, 5, 0, 1, 2);
+    updatesHeaderActionButtonLayout->addWidget(mInstallButton);
     updatesHeaderActionButtonLayout->addWidget(mQuitButton);
     updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout, 6, 0, 1, 1);
     updatesHeaderLayout->setRowMinimumHeight(7, 10);
@@ -825,39 +833,76 @@
 
 void MainWindow::listChanged(int selected)
 {
-    int totalCount = mUpdatesRemove->selectedCertCount() +
-        mUpdatesNew->selectedCertCount() + mUpdatesManual->certificates().size();
+    Q_UNUSED (selected);
+    setChangeCount(mUpdatesRemove->selectedCertCount() +
+        mUpdatesNew->selectedCertCount() + mUpdatesManual->certificates().size());
+
+    /* Show a different tip in case of manual changes, updates aviailable, updates and manual
+     * changes available */
+    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."));
+    }
+
+    if (!changeCount()) {
+        /* No changes */
+        mQuitButton->setText(" " + tr("Quit"));
+        mUpdatesHeader->setText("<h2>" + tr("Certificates unchanged") +
+                "</h2>");
+        mInstallButton->setText(" " + tr("Install certificates again"));
+    } else {
+        mQuitButton->setText(" " + tr("Quit without saving"));
+        mUpdatesHeader->setText("<h2>" + tr("Changes to certificate stores (%1)")
+                .arg(changeCount()) +
+                "</h2>");
+        mInstallButton->setText(" " + tr("Apply changes"));
+    }
 
     if (mUpdatesManual->certificates().size()) {
         mUpdatesDetailsManual->show();
+        mUpdatesDetailsManual->setText(tr("Show details"));
         mUpdatesManualCertificates->show();
     } else {
         mUpdatesDetailsManual->hide();
         mUpdatesManualCertificates->hide();
+        mUpdatesManual->hide();
     }
 
-    if (!totalCount) {
-        /* No changes */
-        mQuitButton->setText(" " + tr("Quit"));
-        mUpdatesHeader->setText("<h2>" + tr("Certificates unchanged") +
-                "</h2>");
+    if (mUpdatesNew->certificates().size()) {
+        mUpdatesNewCertificates->setText("<h3>" +
+                tr("Install new trusted certificates (%1/%2)")
+                .arg(mUpdatesNew->selectedCertCount())
+                .arg(mUpdatesNew->certificates().size()) +
+                "</h3>");
+        mUpdatesDetailsNew->show();
+        mUpdatesDetailsNew->setText(tr("Show details"));
+        mUpdatesNewCertificates->show();
     } else {
-        mQuitButton->setText(" " + tr("Quit without saving"));
-        mUpdatesHeader->setText("<h2>" + tr("Changes (%1)")
-                .arg(totalCount) +
-                "</h2>");
+        mUpdatesDetailsNew->hide();
+        mUpdatesNew->hide();
+        mUpdatesNewCertificates->hide();
     }
 
-    mUpdatesNewCertificates->setText("<h3>" +
-            tr("Install new trusted certificates (%1/%2)")
-            .arg(mUpdatesNew->selectedCertCount())
-            .arg(mUpdatesNew->certificates().size()) +
-            "</h3>");
-    mUpdatesRemoveCertificates->setText("<h3>" +
-            tr("Remove revoked certificates (%1/%2)")
-            .arg(mUpdatesRemove->selectedCertCount())
-            .arg(mUpdatesRemove->certificates().size()) +
-            "</h3>");
+    if (mUpdatesRemove->certificates().size()) {
+        mUpdatesRemoveCertificates->setText("<h3>" +
+                tr("Remove revoked certificates (%1/%2)")
+                .arg(mUpdatesRemove->selectedCertCount())
+                .arg(mUpdatesRemove->certificates().size()) +
+                "</h3>");
+        mUpdatesRemoveCertificates->show();
+        mUpdatesDetailsRemove->setText(tr("Show details"));
+        mUpdatesDetailsRemove->show();
+    } else {
+        mUpdatesRemoveCertificates->hide();
+        mUpdatesDetailsRemove->hide();
+        mUpdatesRemove->hide();
+    }
 }
 
 void MainWindow::loadCertificateList()
@@ -925,7 +970,8 @@
 
     if (mInstalledList.date().isValid()) {
         mLastCertUpdate->setText(tr("Installed certificates from: %1")
-                .arg(QLocale::system().toString(mInstalledList.date())));
+                .arg(QLocale::system().toString(mInstalledList.date().toLocalTime(),
+                        DATETIME_FORMAT)));
         mLastCertUpdate->show();
     }
     mUpdatesManualCertificates->setText("<h3>" +
@@ -1126,7 +1172,7 @@
     if (!mUpdatesNew->isVisible()) {
         mUpdatesDetailsNew->setText(tr("Hide details"));
         mUpdatesNew->show();
-        mUpdatesNew->setSelected(0);
+        mUpdatesNew->setSelected(mUpdatesNew->selected());
     }
     else {
         mUpdatesNew->hide();
@@ -1179,9 +1225,22 @@
     if (getState() != TransferError) {
         const QDateTime now = QDateTime::currentDateTime();
         mSettings.setValue("lastUpdateCheck", now);
-        mLastUpdateCheck->setText(tr("Last sucessful update check: %1").arg(
-                        QLocale::system().toString(now)));
+        mLastUpdateCheck->setText(tr("Last successful update check: %1").arg(
+                        QLocale::system().toString(now, DATETIME_FORMAT)));
         mLastUpdateCheck->show();
         syslog_info_printf(tr("Sucessfully checked for updates.").toUtf8().constData());
     }
 }
+
+int MainWindow::changeCount()
+{
+    return mChangeCount;
+}
+
+void MainWindow::setChangeCount(int cnt)
+{
+    if (mChangeCount != cnt) {
+        mChangeCount = cnt;
+        emit changesChanged(QString("%1").arg(cnt));
+    }
+}
diff -r ce3e33e66a17 -r 3777482dc306 ui/mainwindow.h
--- a/ui/mainwindow.h	Wed Jul 02 19:31:51 2014 +0200
+++ b/ui/mainwindow.h	Wed Jul 02 19:32:16 2014 +0200
@@ -27,6 +27,7 @@
 #include "downloader.h"
 #include "certificatelist.h"
 #include "certificatelistwidget.h"
+#include "textoverlaybutton.h"
 class QMenu;
 class QAction;
 class QTimer;
@@ -82,6 +83,14 @@
     void toggleUpdatesNew();
     void toggleUpdatesRemove();
     void toggleUpdatesManual();
+
+    /** Reflect change list states in the UI
+     *
+     * This slot should be called each time the contents or selection
+     * state of one of the certificate lists change to update the
+     * UI elements accordingly.
+     *
+     * @param[in] selected unused. */
     void listChanged(int selected);
 
     /** @brief check for running software that needs to close before installing
@@ -153,7 +162,17 @@
      * the application. */
     void installNewSW(const QString& fileName, const QDateTime& modDate);
 
+signals:
+    /** @brief emits the changecount as a string when it changes */
+    void changesChanged(const QString& cnt);
+
 private:
+    /** @brief the combined number of changes made in all lists */
+    int changeCount();
+
+    /** @brief use this to set the change count */
+    void setChangeCount(int cnt);
+
     /** @brief check the integrity of available certificate lists.
      *
      * Note: Do not use this as a local trust check as this only works on
@@ -221,6 +240,7 @@
     QLabel *mUpdatesNewCertificates;
     QLabel *mUpdatesRemoveCertificates;
     QLabel *mUpdatesManualCertificates;
+    QLabel *mUpdatesTip;
 
     CertificateListWidget *mUpdatesNew;
     CertificateListWidget *mUpdatesRemove;
@@ -231,6 +251,9 @@
     QPushButton *mUpdatesDetailsNew;
     QPushButton *mUpdatesDetailsRemove;
     QPushButton *mUpdatesDetailsManual;
+
+    QPushButton *mInstallButton;
+    int mChangeCount;
 };
 
 #endif // MAINWINDOW_H
diff -r ce3e33e66a17 -r 3777482dc306 ui/textoverlaybutton.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/textoverlaybutton.cpp	Wed Jul 02 19:32:16 2014 +0200
@@ -0,0 +1,37 @@
+/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=2)
+ * and comes with ABSOLUTELY NO WARRANTY!
+ * See LICENSE.txt for details.
+ */
+
+#include <QPaintEvent>
+#include <QPainter>
+#include <QFont>
+#include <QApplication>
+
+#include <QDebug>
+
+#include "textoverlaybutton.h"
+
+void TextOverlayButton::paintEvent(QPaintEvent *e)
+{
+    QToolButton::paintEvent(e);
+    QPainter painter(this);
+    QFont font;
+    QRect myRect = e->rect().translated(0, 10);
+
+    //font.setFamily("Comic Sans MS");
+
+    font.setPixelSize(14);
+    font.setWeight(QFont::DemiBold);
+    painter.setFont(font);
+
+    //painter.setPen(Qt::white);
+    //painter.drawText(myRect.translated(1,1), Qt::AlignCenter, "20");
+    painter.setPen(qApp->palette().color(QPalette::ButtonText));
+    painter.drawText(myRect, Qt::AlignCenter | Qt::AlignVCenter, mOverlay);
+
+    return;
+}
diff -r ce3e33e66a17 -r 3777482dc306 ui/textoverlaybutton.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/textoverlaybutton.h	Wed Jul 02 19:32:16 2014 +0200
@@ -0,0 +1,35 @@
+#ifndef UI_TEXTOVERLAYBUTTON_H
+#define UI_TEXTOVERLAYBUTTON_H
+/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=2)
+ * and comes with ABSOLUTELY NO WARRANTY!
+ * See LICENSE.txt for details.
+ */
+
+/** @file A tool button that overlays a text over the icon */
+
+#include <QToolButton>
+#include <QString>
+
+class QPaintEvent;
+
+class TextOverlayButton : public QToolButton
+{
+    Q_OBJECT
+
+public:
+    QString overlay() {return mOverlay;}
+
+protected:
+    virtual void paintEvent(QPaintEvent *);
+
+public slots:
+    void setOverlay (const QString& text) {mOverlay = text; repaint();}
+
+private:
+    QString mOverlay;
+};
+
+#endif // UI_TEXTOVERLAYBUTTON_H


More information about the Trustbridge-commits mailing list