changeset 512:d1812e171d0c

Hide empty seperators in list ui
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 28 Apr 2014 10:44:20 +0000
parents cef732072774
children 5e2af38266f6
files ui/mainwindow.cpp
diffstat 1 files changed, 20 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Mon Apr 28 10:43:59 2014 +0000
+++ b/ui/mainwindow.cpp	Mon Apr 28 10:44:20 2014 +0000
@@ -533,24 +533,32 @@
     }
 
     // Add separators and certificates to list widget.
-    mCertListWidget->addItem(createSeparator(tr("New certificates to install"), i++));
-    foreach (const Certificate &cert, newInstallCerts) {
-        mCertListWidget->addItem(createListItem(cert, Certificate::InstallNew, i++));
+    if (!newInstallCerts.isEmpty()) {
+        mCertListWidget->addItem(createSeparator(tr("New certificates to install"), i++));
+        foreach (const Certificate &cert, newInstallCerts) {
+            mCertListWidget->addItem(createListItem(cert, Certificate::InstallNew, i++));
+        }
     }
 
-    mCertListWidget->addItem(createSeparator(tr("New certificates to remove"), i++));
-    foreach (const Certificate &cert, newRemoveCerts) {
-        mCertListWidget->addItem(createListItem(cert, Certificate::RemoveNew, i++));
+    if (!newRemoveCerts.isEmpty()) {
+        mCertListWidget->addItem(createSeparator(tr("New certificates to remove"), i++));
+        foreach (const Certificate &cert, newRemoveCerts) {
+            mCertListWidget->addItem(createListItem(cert, Certificate::RemoveNew, i++));
+        }
     }
 
-    mCertListWidget->addItem(createSeparator(tr("Old certificates to install"), i++));
-    foreach (const Certificate &cert, oldInstallCerts) {
-        mCertListWidget->addItem(createListItem(cert, Certificate::InstallOld, i++));
+    if (!oldInstallCerts.isEmpty()) {
+        mCertListWidget->addItem(createSeparator(tr("Old certificates to install"), i++));
+        foreach (const Certificate &cert, oldInstallCerts) {
+            mCertListWidget->addItem(createListItem(cert, Certificate::InstallOld, i++));
+        }
     }
 
-    mCertListWidget->addItem(createSeparator(tr("Old certificates to remove"), i++));
-    foreach (const Certificate &cert, oldRemoveCerts) {
-        mCertListWidget->addItem(createListItem(cert, Certificate::RemoveOld, i++));
+    if (!oldRemoveCerts.isEmpty()) {
+        mCertListWidget->addItem(createSeparator(tr("Old certificates to remove"), i++));
+        foreach (const Certificate &cert, oldRemoveCerts) {
+            mCertListWidget->addItem(createListItem(cert, Certificate::RemoveOld, i++));
+        }
     }
 }
 

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