[PATCH 2 of 2] (Issue26) Make updates tip and install button depend on changes

Wald Commits scm-commit at wald.intevation.org
Wed Jul 2 16:27:52 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1404311266 -7200
# Node ID e7a070e64b805d1e281b7b8aa8c227a0ff979eaa
# Parent  77c9c2dfc8ac41246835f6d8e4ce1551053d710e
(Issue26) Make updates tip and install button depend on changes

diff -r 77c9c2dfc8ac -r e7a070e64b80 ui/mainwindow.cpp
--- a/ui/mainwindow.cpp	Wed Jul 02 16:15:52 2014 +0200
+++ b/ui/mainwindow.cpp	Wed Jul 02 16:27:46 2014 +0200
@@ -565,29 +565,30 @@
     updatesHeaderLayout->setRowMinimumHeight(4, 15);
 
     /* Header 2: Action text and buttons */
-    QLabel *updatesTip =
-        new QLabel(tr("You should apply the following, recommended changes to your certificate stores."));
-    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"));
     mQuitButton->setFixedHeight(30);
-    QPushButton *installButton = new QPushButton(" " + tr("Apply changes"));
-    installButton->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);
@@ -841,16 +842,31 @@
         mUpdatesManualCertificates->hide();
     }
 
+    /* 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 (mUpdatesNew->certificates().size()) {
diff -r 77c9c2dfc8ac -r e7a070e64b80 ui/mainwindow.h
--- a/ui/mainwindow.h	Wed Jul 02 16:15:52 2014 +0200
+++ b/ui/mainwindow.h	Wed Jul 02 16:27:46 2014 +0200
@@ -232,6 +232,7 @@
     QLabel *mUpdatesNewCertificates;
     QLabel *mUpdatesRemoveCertificates;
     QLabel *mUpdatesManualCertificates;
+    QLabel *mUpdatesTip;
 
     CertificateListWidget *mUpdatesNew;
     CertificateListWidget *mUpdatesRemove;
@@ -243,6 +244,7 @@
     QPushButton *mUpdatesDetailsRemove;
     QPushButton *mUpdatesDetailsManual;
 
+    QPushButton *mInstallButton;
     int mChangeCount;
 };
 


More information about the Trustbridge-commits mailing list