diff ui/mainwindow.cpp @ 717:77c9c2dfc8ac

(Issue26) Hide update lists if no updates are available
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 02 Jul 2014 16:15:52 +0200
parents 929c3db85eb7
children e7a070e64b80
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Wed Jul 02 16:09:19 2014 +0200
+++ b/ui/mainwindow.cpp	Wed Jul 02 16:15:52 2014 +0200
@@ -853,16 +853,31 @@
                 "</h2>");
     }
 
-    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 (mUpdatesNew->certificates().size()) {
+        mUpdatesNewCertificates->setText("<h3>" +
+                tr("Install new trusted certificates (%1/%2)")
+                .arg(mUpdatesNew->selectedCertCount())
+                .arg(mUpdatesNew->certificates().size()) +
+                "</h3>");
+        mUpdatesDetailsNew->show();
+        mUpdatesNewCertificates->show();
+    } else {
+        mUpdatesDetailsNew->hide();
+        mUpdatesNewCertificates->hide();
+    }
+
+    if (mUpdatesRemove->certificates().size()) {
+        mUpdatesRemoveCertificates->setText("<h3>" +
+                tr("Remove revoked certificates (%1/%2)")
+                .arg(mUpdatesRemove->selectedCertCount())
+                .arg(mUpdatesRemove->certificates().size()) +
+                "</h3>");
+        mUpdatesRemoveCertificates->show();
+        mUpdatesDetailsRemove->show();
+    } else {
+        mUpdatesRemoveCertificates->hide();
+        mUpdatesDetailsRemove->hide();
+    }
 }
 
 void MainWindow::loadCertificateList()

http://wald.intevation.org/projects/trustbridge/