[PATCH 2 of 7] Hide empty seperators in list ui

Wald Commits scm-commit at wald.intevation.org
Mon Apr 28 19:15:54 CEST 2014


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1398681860 0
# Node ID d1812e171d0ce39ff16a8bd8b45cfa0fa4d4fb90
# Parent  cef7320727743af31a4e3ca301b5e3b15c95c3b2
Hide empty seperators in list ui

diff -r cef732072774 -r d1812e171d0c ui/mainwindow.cpp
--- 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++));
+        }
     }
 }
 


More information about the Trustbridge-commits mailing list