# HG changeset patch # User Andre Heinecke # Date 1410800537 -7200 # Node ID 6594e8e63a2595d9bdf78c0cb76782c336ef7985 # Parent 9bb9932bb819c71e4118b29f3e0e8ca1ff5b477e (issue115) Add tooltips and fix manual changes handling diff -r 9bb9932bb819 -r 6594e8e63a25 ui/certificateitemwidget.cpp --- a/ui/certificateitemwidget.cpp Mon Sep 15 17:47:12 2014 +0200 +++ b/ui/certificateitemwidget.cpp Mon Sep 15 19:02:17 2014 +0200 @@ -20,11 +20,15 @@ mButton(btn) { mCertificate = cert; - mState = state; - /* We carry the state explicitly to be better prepared for future - * changes */ + mOriginalState = state; btn->setCheckable(true); - btn->setChecked(!state); + 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(); } @@ -56,41 +60,6 @@ layout->addWidget(mButton); mButton->setFixedSize(64, 64); mButton->setIconSize(QSize(48, 48)); - /* - if (mCertificate.isInstallCert()) { - mComboBox->addItem(QIcon(":/img/security-high.png"), QString(), mInstallLabel); - mComboBox->addItem(QIcon(":/img/security-low.png"), QString(), mRemoveLabel); - if (mState) { - mComboBox->setCurrentIndex(0); - mComboBox->setToolTip(tr("This certificate is currently installed.")); - } - else { - mComboBox->setCurrentIndex(1); - mComboBox->setToolTip(tr("This certificate is currently not installed.")); - } - layout->addWidget(mComboBox); - } - else if (!mCertificate.isInstallCert() && !mEditable){ - QImage *img = new QImage(":/img/trash-empty.png"); - QLabel *imgLabel = new QLabel; - imgLabel->setPixmap(QPixmap::fromImage(*img)); - imgLabel->setFixedSize(64, 64); - imgLabel->setMargin(8); - imgLabel->setToolTip(tr("This certificate was uninstalled.")); - layout->addWidget(imgLabel); - } - else { - mComboBox->addItem(QIcon(":/img/trash-empty.png"), QString(), tr("uninstall")); - mComboBox->addItem(QIcon(":/img/security-medium.png"), QString(), tr("keep")); - mComboBox->setToolTip(tr("This certificate is currently installed.")); - if (mState) - mComboBox->setCurrentIndex(0); - else { - mComboBox->setCurrentIndex(1); - } - layout->addWidget(mComboBox); - } - */ layout->addWidget(mLabel); this->setLayout(layout); } @@ -101,22 +70,22 @@ return true; } - /* - const QString currentString = mComboBox->currentData().toString(); - - if (!mCertificate.isInstallCert()) { - return currentString == tr("uninstall"); - } - - return currentString == mInstallLabel; - */ - return mState; + return !mButton->isChecked(); } void CertificateItemWidget::setState(bool state) { - mState = state; + /* The internal state we get here is inverted for Ui reasons the logic + * is if a certificate is selected for installation the button + * is disabled (as this is the default) Only those that are + * unselected have the enabled button. */ + mButton->blockSignals(true); // code did this and not the user mButton->setChecked(!state); + mButton->blockSignals(false); + if (mButton->isEnabled()) { + mButton->setToolTip(mButton->property(!state ? "ToolTip_On" : + "ToolTip_Off").toString()); + } } Certificate CertificateItemWidget::certificate() @@ -126,6 +95,7 @@ void CertificateItemWidget::currentStateChanged(bool state) { - mState = !state; - emit stateChanged(mState, mCertificate); + mButton->setToolTip(mButton->property(state ? "ToolTip_On" : + "ToolTip_Off").toString()); + emit stateChanged(state, mCertificate); } diff -r 9bb9932bb819 -r 6594e8e63a25 ui/certificateitemwidget.h --- a/ui/certificateitemwidget.h Mon Sep 15 17:47:12 2014 +0200 +++ b/ui/certificateitemwidget.h Mon Sep 15 19:02:17 2014 +0200 @@ -37,7 +37,7 @@ void setupGUI(); Certificate mCertificate; - bool mState; + bool mOriginalState; QLabel *mLabel; QToolButton *mButton; diff -r 9bb9932bb819 -r 6594e8e63a25 ui/l10n/trustbridge_de_DE.ts --- a/ui/l10n/trustbridge_de_DE.ts Mon Sep 15 17:47:12 2014 +0200 +++ b/ui/l10n/trustbridge_de_DE.ts Mon Sep 15 19:02:17 2014 +0200 @@ -67,12 +67,12 @@ Entfernen - + Validity: %1 until %2 Gültigkeit: %1 bis %2 - + Fingerprint (SHA1): <code>%1</code> Fingerabdruck (SHA1): <code>%1</code> @@ -203,19 +203,19 @@ Neue Vorschläge für Wurzelzertifikate sind verfügbar. Klicken Sie hier zum Installieren. - - + + Check for Updates Neue Empfehlungen suchen - - + + Quit Beenden - + TrustBridge TrustBridge @@ -241,7 +241,7 @@ Empfehlungen - + Revoked certificates Abgeratene @@ -256,41 +256,41 @@ Aktualisierungen (%1/%2) - - + + Quit without saving Beenden ohne Schreiben - - + + Remove revoked certificates (%1/%2) Abgeratene Wurzelzertifikate entfernen (%1/%2) - + Trusted certificates Empfohlene Wurzelzertifikate - + 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 folgenden Wurzelzertifikate wurden bisher vom BSI zur Installation vorgeschlagen. Sie können erkennen, welche Sie bereits geschrieben haben. - + 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, ob Sie der Empfehlung ganz oder teilweise folgen möchten. TrustBridge wird die Änderungen an den Wurzelzertifikaten vornehmen. - + Trusted certificates Empfohlene Wurzelzertifikate - + Information and help Informationen @@ -317,28 +317,27 @@ Aktualisierungen einspielen - - + + Install new trusted certificates (%1/%2) Neue, empfohlene Wurzelzertifikate installieren (%1/%2) - - - - - - + + + + + Show details Details einblenden - + Revoked certificates Abgeratene Wurzelzertifikate - + Certificates can be corrupted or stolen and misused in many ways. Therefore the BSI recommends to remove all revoked certificates from your system. Wurzelzertifikate können veraltet sein, korrumpiert, gestohlen oder missbraucht werden. Die Wurzelzertifikate , von denen das BSI abrät, sollten umgehend entfernt werden. @@ -351,7 +350,7 @@ Abweichend zu behandelnde Wurzelzertifikate (%1) - + Trust in your digital communication Vertrauen in Ihre digitale Kommunikation @@ -360,8 +359,8 @@ Änderungen - - + + Certificates unchanged Wurzelzertifikate unverändert @@ -378,60 +377,60 @@ Es wird empfohlen, die nachfolgenden Änderungen an Ihren Wurzelzertifikaten zu übernehmen. - + Apply changes Änderungen schreiben - + Version: Version: - - + + An updated certificate list is available. Neue Vorschläge für Wurzelzertifikate sind verfügbar. - + Click here to install. Klicken Sie hier zum Installieren. - - + + An update for %1 is available. Eine Aktualisierung für %1 ist verfügbar. - + Click here to download and install the update. Hier klicken, um Download und Installation zu starten. - + Failed to check for updates: Fehler bei Updateprüfung: - + You should apply the following, recommended changes to your certificate stores: Es wird empfohlen, die nachfolgenden Änderungen an Ihren Zertifikatsspeichern vorzunehmen: - + You can apply the following, changes to your certificate stores: Sie können die nachfolgenden Änderungen an Ihren Zertifikatsspeichern vornehmen: - + There are currently no changes for your certificate stores. Es liegem keine neuen Empfehlungen vor. - - + + Install certificates again Wurzelzertifikate erneut schreiben @@ -484,7 +483,7 @@ Letzte erfolgreiche Prüfung nach Aktualisierungen: %1 - + Sucessfully checked for updates. Suche nach neuen Empfehlungen erfolgreich. @@ -495,91 +494,91 @@ Hier klicken, um Download und Installation zu starten. - + TrustBridge is a root certificate installer for Windows and GNU/Linux.<br/> TrustBridge ist ein Wurzelzertifikatsinstaller für Windows und GNU/Linux.<br/> - + The root certificate lists are managed by the German <a href="https://www.bsi.bund.de">Federal Office for Information Security (BSI)</a>.<br/><br/> Die Wurzelzertifikate werden vom <a href="https://www.bsi.bund.de">Bundesamt für Sicherheit in der Informationstechnik (BSI)</a> vorgeschlagen.<br/><br/> - + 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).<br/><br/> 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).<br/><br/> - + TrustBridge is Free Software licensed under GNU GPL v2+.<br/><br/>Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik TrustBridge ist Freie Software, lizensiert unter der GNU GPL v2+.<br/><br/>(C) 2014. Die Rechte liegen beim Bundesamt für Sicherheit in der Informationstechnik. - + Show Help Hilfe anzeigen - + Proxy settings Proxy-Einstellungen - + Last update check: Letzte Suche: - + No connection with the updateserver. Keine Verbindung zum Updateserver. - + Update Aktualisieren - - - + + + Details Details - + The following 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. Von den folgenden, ehemals empfohlenen Wurzelzertifikaten, rät das BSI ab. Über diese Anwendung können sie auch nicht mehr installiert werden. Markieren Sie verbleibende Wurzelzertifikate zur Löschung, sobald Sie können. - + Version Version - + Pending changes Ausstehende Änderungen - + Manual changes (%1) Manuelle Änderungen (%1) - + Certificate list from: Zertifikatsliste vom: - + Currently installed certificate list: Aktuell installierte Zertifikatsliste: - + No certificate list installed. Keine Zertifikatsliste installiert. @@ -593,18 +592,18 @@ Sie können die nachfolgenden Änderungen an Ihren Zertifikatsspeichern vornehmen. - + Pending changes (%1) Ausstehende Änderungen (%1) - + New, recommended changes (%1/%2) Neue, empfohlene Änderungen (%1/%2) - + No new recommendations Keine neuen Empfehlungen @@ -625,37 +624,37 @@ Neue empfohlene Änderungen (%1) - + Error executing update Fehler bei der Aktualisierung - + Installation with standard user account Installation mit Standardbenutzerkonto - + Windows will now ask you to confirm each root certificate modification because TrustBridge does not have the necessary privileges to install root certificates into the Windows certificate store silently. Windows wird Sie nun bitten, jede Wurzelzertifikatsänderung zu bestätigen. Grund dafür: TrustBridge besitzt nicht die nötigen Privilegien, um Wurzelzertifikate ohne Nachfrage in den Windows-Zertifikatsspeicher zu installieren. - + Installing certificates... Wurzelzertifikate werden geändert... - + Error! Fehler! - + Failed to find the manual Fehler beim Finden des Handbuchs - + TrustBridge error TrustBridge Fehler @@ -728,22 +727,22 @@ Automatische Aktualisierungsprüfung von TrustBridge. - + Hide details Details ausblenden - + Less Weniger - + Show details Details einblenden - + Details Details diff -r 9bb9932bb819 -r 6594e8e63a25 ui/mainwindow.cpp --- a/ui/mainwindow.cpp Mon Sep 15 17:47:12 2014 +0200 +++ b/ui/mainwindow.cpp Mon Sep 15 19:02:17 2014 +0200 @@ -93,8 +93,21 @@ #define HELP_PATH "/../share/doc/trustbridge/index.html" #endif +#define NEW_INSTALL_TT "Certificate will be installed." +#define NOT_INSTALL_TT "Certificate will not be installed." +#define NEW_REMOVE_TT "Certificate will be removed." +#define NOT_REMOVE_TT "Certificate will not be removed." +#define IS_INSTALLED_TT "Certificate is installed." +#define IS_NOT_INSTALLED_TT "Certifcate is not installed." +#define IS_REMOVED_TT "Certificate has been removed." +#define IS_NOT_REMOVED_TT "Certificate has not been removed." + +static void activateDetailsButton(QPushButton *); +static void deactivateDetailsButton(QPushButton *); + MainWindow::MainWindow(bool trayMode): - mTrayMode(trayMode) + mTrayMode(trayMode), + mManualDetailsShown(false) { createActions(); createTrayIcon(); @@ -1039,14 +1052,18 @@ if (mUpdatesManual->certificates().size()) { mUpdatesDetailsManual->show(); - mUpdatesDetailsManual->setIcon(QIcon(":/img/dialog-information_16px.png")); - mUpdatesDetailsManual->setToolTip(tr("Show details")); + if (mManualDetailsShown) { + mUpdatesManual->show(); + deactivateDetailsButton(mUpdatesDetailsManual); + } else { + activateDetailsButton(mUpdatesDetailsManual); + } } else { mUpdatesDetailsManual->hide(); mUpdatesManual->hide(); } mUpdatesManualCertificates->setText("

" + - tr("Manual changes (%1)").arg(mUpdatesManual->activeCertificates()) + + tr("Manual changes (%1)").arg(mUpdatesManual->certificates().size()) + "

"); if (mUpdatesNew->certificates().size()) { @@ -1136,7 +1153,11 @@ if (!state) { btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); btnIcon.addFile(":/img/security-low.png", QSize(48, 48), QIcon::Normal, QIcon::On); + actionBtn->setProperty("ToolTip_Off", tr(NEW_INSTALL_TT)); + actionBtn->setProperty("ToolTip_On", tr(IS_NOT_INSTALLED_TT)); } else { + actionBtn->setProperty("ToolTip_Off", tr(IS_INSTALLED_TT)); + actionBtn->setProperty("ToolTip_On", tr(NEW_REMOVE_TT)); btnIcon.addFile(":/img/security-high.png", QSize(48, 48), QIcon::Normal, QIcon::Off); btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); } @@ -1147,12 +1168,15 @@ oldRemoveCerts.append(cert); QToolButton* actionBtn = new QToolButton(); QIcon btnIcon; + actionBtn->setProperty("ToolTip_Off", tr(NEW_REMOVE_TT)); + actionBtn->setProperty("ToolTip_On", tr(IS_NOT_REMOVED_TT)); btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); btnIcon.addFile(":/img/security-medium.png", QSize(48, 48), QIcon::Normal, QIcon::On); btnIcon.addFile(":/img/trash-empty.png", QSize(48, 48), QIcon::Disabled, QIcon::Off); actionBtn->setIcon(btnIcon); if (state) { actionBtn->setEnabled(false); + actionBtn->setToolTip(tr(IS_REMOVED_TT)); } mRemoveList->addCertificate(cert, state, actionBtn); } @@ -1169,6 +1193,8 @@ oldInstallCerts.append(cert); QToolButton* actionBtn = new QToolButton(); QIcon btnIcon; + actionBtn->setProperty("ToolTip_Off", tr(IS_INSTALLED_TT)); + actionBtn->setProperty("ToolTip_On", tr(IS_NOT_INSTALLED_TT)); btnIcon.addFile(":/img/security-high.png", QSize(48, 48), QIcon::Normal, QIcon::Off); btnIcon.addFile(":/img/security-low.png", QSize(48, 48), QIcon::Normal, QIcon::On); actionBtn->setIcon(btnIcon); @@ -1179,6 +1205,8 @@ newInstallCerts.append(cert); QToolButton* actionBtn = new QToolButton(); QIcon btnIcon; + actionBtn->setProperty("ToolTip_Off", tr(NEW_INSTALL_TT)); + actionBtn->setProperty("ToolTip_On", tr(NOT_INSTALL_TT)); btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); btnIcon.addFile(":/img/security-low.png", QSize(48, 48), QIcon::Normal, QIcon::On); actionBtn->setIcon(btnIcon); @@ -1193,12 +1221,15 @@ // Is removed, so set editable to false. QToolButton* actionBtn = new QToolButton(); QIcon btnIcon; + actionBtn->setProperty("ToolTip_Off", tr(NEW_REMOVE_TT)); + actionBtn->setProperty("ToolTip_On", tr(IS_NOT_REMOVED_TT)); btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); btnIcon.addFile(":/img/security-medium.png", QSize(48, 48), QIcon::Normal, QIcon::On); btnIcon.addFile(":/img/trash-empty.png", QSize(48, 48), QIcon::Disabled, QIcon::Off); actionBtn->setIcon(btnIcon); if (state) { actionBtn->setEnabled(false); + actionBtn->setToolTip(tr(IS_REMOVED_TT)); } mRemoveList->addCertificate(cert, state, actionBtn); } @@ -1208,6 +1239,8 @@ newRemoveCerts.append(cert); QToolButton* actionBtn = new QToolButton(); QIcon btnIcon; + actionBtn->setProperty("ToolTip_Off", tr(NEW_REMOVE_TT)); + actionBtn->setProperty("ToolTip_On", tr(NOT_REMOVE_TT)); btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); btnIcon.addFile(":/img/security-medium.png", QSize(48, 48), QIcon::Normal, QIcon::On); actionBtn->setIcon(btnIcon); @@ -1382,13 +1415,10 @@ if (!mUpdatesManual->contains(cert)) { QToolButton* actionBtn = new QToolButton(); QIcon btnIcon; - if (cert.isInstallCert()) { - btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); - btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); - } else { - btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); - btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); - } + btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); + btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); + actionBtn->setProperty("ToolTip_On", tr(NEW_INSTALL_TT)); + actionBtn->setProperty("ToolTip_Off", tr(NEW_REMOVE_TT)); actionBtn->setIcon(btnIcon); mUpdatesManual->addCertificate(cert, state, actionBtn); } @@ -1491,10 +1521,12 @@ void MainWindow::toggleUpdatesManual() { if (!mUpdatesManual->isVisible()) { mUpdatesManual->show(); + mManualDetailsShown = true; deactivateDetailsButton(mUpdatesDetailsManual); } else { mUpdatesManual->hide(); + mManualDetailsShown = false; activateDetailsButton(mUpdatesDetailsManual); } } diff -r 9bb9932bb819 -r 6594e8e63a25 ui/mainwindow.h --- a/ui/mainwindow.h Mon Sep 15 17:47:12 2014 +0200 +++ b/ui/mainwindow.h Mon Sep 15 19:02:17 2014 +0200 @@ -289,6 +289,7 @@ QPushButton *mInstallButton; int mChangeCount; + bool mManualDetailsShown; }; #endif // MAINWINDOW_H