# HG changeset patch # User Sascha Wilde # 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 @@ CertificateItemWidget - + + uninstall Deinstallieren - + keep Behalten @@ -158,83 +159,83 @@ MainWindow - + An updated certificate list is available. Click here to install. Eine aktualisierte Zertifikatsliste ist verfügbar. Klicken Sie hier zum Installieren. - + Check for Updates Aktualisierungen prüfen - - + + Quit Beenden - - + + TrustBridge TrustBridge + Updates - Aktualisierungen + Aktualisierungen - + Revoked certificates Zurückgezogene Zertifikate - Last update of TrustBridge: %1 - Letzte Aktualisierung von TrustBridge: %1 + Letzte Aktualisierung von TrustBridge: %1 Updates (%1/%2) Aktualisierungen (%1/%2) - - + + Quit without saving Beenden ohne Speichern - - + + Remove revoked certificates (%1/%2) Zurückgezogene Zertifikate löschen (%1/%2) - + Trusted certificates Vertrauenswürdige Zertifikate - + The following list of trusted root certificates is managed by the BSI. The BSI validates independently the authenticity, security and actuality of these certificates. 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. - + Please choose the certificates you want to trust or untrust. TrustBridge will install these certificates for your secure communication for email and internet. Legen Sie fest, welchen Zertifikaten Sie vertrauen wollen. TrustBridge wird diese Zertifikate dann für Ihre sichere Kommunikation via E-Mail und Internet installieren. - + Trusted certificates Vertrauenswürdige Zertifikate - + Information and help Informationen @@ -245,18 +246,15 @@ Aktualisierungen (%1/%2) {1)?} - - Last update of certificates: %1 - Letzte Aktualisierung der Zertifikate: %1 + Letzte Aktualisierung der Zertifikate: %1 - You should apply the following changes to your root certificates: - Sie sollten die folgenden Änderungen an Ihren Wurzelzertifikaten übernehmen: + Sie sollten die folgenden Änderungen an Ihren Wurzelzertifikaten übernehmen: - + Check for updates Nach Aktualisierungen suchen @@ -265,91 +263,119 @@ Aktualisierungen einspielen - - + + Install new trusted certificates (%1/%2) Neue, vertrauenswürdige Zertifikate installieren (%1/%2) - - - - - - + + + + + + + + + Show details Details einblenden - + Revoked certificates Zurückgezogene Zertifikate - + Certificates can be corrupted or stolen and misused in many ways. Therefore the BSI recommends to remove all revoked certificates from your system. 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. - + 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. 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. - - - - + + + + Manually changed certificates (%1) Manuell geänderte Zertifikate (%1) - + Trust in your digital communication Vertrauen in Ihre digitale Kommunikation - Changes - + Änderungen - - + + Certificates unchanged - + Zertifikate unverändert - - Apply changes - + + TrustBridge Version: %1 + TrustBridge Version: %1 - + + Last sucessful update check: %1 + Letzte erfolgreiche Prüfung nach Aktualisierungen: %1 + + + You should apply the following, recommended changes to your root certificates. + Es wird empfohlen, die nachfolgenden Änderungen an Ihren Wurzelzertifikaten zu übernehmen. + + + + Apply changes + Änderungen übernehmen + + + Version: Version: - + + + There are currently no changes for your certificate stores. + + + + + + Install certificates again + + + + TrustBridge is a root certificate installer for Windows and Linux. TrustBridge ist eine Wurzelzertifikatsinstaller für Windows und Linux. - + The root certificate lists are managed by the German <a href="https://www.bsi.bund.de">Federal Office for Information Security (BSI)</a>. Die Liste der Wurzelzertifikate wird vom <a href="https://www.bsi.bund.de">Bundesamt für Sicherheit in der Informationstechnik (BSI)</a> verwaltet. - + 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). 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). - + TrustBridge is Free Software licensed under GNU GPL v2+. Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik @@ -358,41 +384,70 @@ Copyright (C) 2014, Bundesamt für Sicherheit in der Informationstechnik (BSI) - Changes (%1) - + Änderungen (%1) - + install Installieren - + ignore Ignorieren - - - + + Installed certificates from: %1 + Installierte Zertifikate vom: %1 + + + + + Hide details Details ausblenden - + + Last successful update check: %1 + + + + + Sucessfully checked for updates. + Prüfung nach Aktualisierungen erfolgreich. + + + An update for %1 is available. Click here to download and install the update. Eine Aktualisierung für %1 ist verfügbar. Hier klicken, um Download und Installation zu starten. - + + You should apply the following, recommended changes to your certificate stores. + Es wird empfohlen, die nachfolgenden Änderungen an Ihren Zertifikatsspeichern zu übernehmen. + + + + You can apply the following, changes to your certificate stores. + + + + + Changes to certificate stores (%1) + Änderungen an Zertifikatsspeichern (%1) + + + Error executing update Fehler bei der Aktualisierung - + Installing certificates... Zertifikate werden installiert... 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()); - if (mUpdatesManual->certificates().size()) { - mUpdatesDetailsManual->show(); - mUpdatesManualCertificates->show(); + /* 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 { - mUpdatesDetailsManual->hide(); - mUpdatesManualCertificates->hide(); + mUpdatesTip->setText( + tr("There are currently no changes for your certificate stores.")); } - if (!totalCount) { + if (!changeCount()) { /* No changes */ mQuitButton->setText(" " + tr("Quit")); mUpdatesHeader->setText("

" + tr("Certificates unchanged") + "

"); + mInstallButton->setText(" " + tr("Install certificates again")); } else { mQuitButton->setText(" " + tr("Quit without saving")); - mUpdatesHeader->setText("

" + tr("Changes (%1)") - .arg(totalCount) + + mUpdatesHeader->setText("

" + tr("Changes to certificate stores (%1)") + .arg(changeCount()) + "

"); + mInstallButton->setText(" " + tr("Apply changes")); } - mUpdatesNewCertificates->setText("

" + - tr("Install new trusted certificates (%1/%2)") - .arg(mUpdatesNew->selectedCertCount()) - .arg(mUpdatesNew->certificates().size()) + - "

"); - mUpdatesRemoveCertificates->setText("

" + - tr("Remove revoked certificates (%1/%2)") - .arg(mUpdatesRemove->selectedCertCount()) - .arg(mUpdatesRemove->certificates().size()) + - "

"); + if (mUpdatesManual->certificates().size()) { + mUpdatesDetailsManual->show(); + mUpdatesDetailsManual->setText(tr("Show details")); + mUpdatesManualCertificates->show(); + } else { + mUpdatesDetailsManual->hide(); + mUpdatesManualCertificates->hide(); + mUpdatesManual->hide(); + } + + if (mUpdatesNew->certificates().size()) { + mUpdatesNewCertificates->setText("

" + + tr("Install new trusted certificates (%1/%2)") + .arg(mUpdatesNew->selectedCertCount()) + .arg(mUpdatesNew->certificates().size()) + + "

"); + mUpdatesDetailsNew->show(); + mUpdatesDetailsNew->setText(tr("Show details")); + mUpdatesNewCertificates->show(); + } else { + mUpdatesDetailsNew->hide(); + mUpdatesNew->hide(); + mUpdatesNewCertificates->hide(); + } + + if (mUpdatesRemove->certificates().size()) { + mUpdatesRemoveCertificates->setText("

" + + tr("Remove revoked certificates (%1/%2)") + .arg(mUpdatesRemove->selectedCertCount()) + .arg(mUpdatesRemove->certificates().size()) + + "

"); + 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("

" + @@ -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 +#include +#include +#include + +#include + +#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 +#include + +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