comparison ui/mainwindow.cpp @ 512:d1812e171d0c

Hide empty seperators in list ui
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 28 Apr 2014 10:44:20 +0000
parents 20973a56d5ec
children a097dd86cb4d
comparison
equal deleted inserted replaced
511:cef732072774 512:d1812e171d0c
531 .arg(mInstalledList.date().toString())); 531 .arg(mInstalledList.date().toString()));
532 mNewListDate->setText(tr("New List Date: %1").arg(mListToInstall.date().toString())); 532 mNewListDate->setText(tr("New List Date: %1").arg(mListToInstall.date().toString()));
533 } 533 }
534 534
535 // Add separators and certificates to list widget. 535 // Add separators and certificates to list widget.
536 mCertListWidget->addItem(createSeparator(tr("New certificates to install"), i++)); 536 if (!newInstallCerts.isEmpty()) {
537 foreach (const Certificate &cert, newInstallCerts) { 537 mCertListWidget->addItem(createSeparator(tr("New certificates to install"), i++));
538 mCertListWidget->addItem(createListItem(cert, Certificate::InstallNew, i++)); 538 foreach (const Certificate &cert, newInstallCerts) {
539 } 539 mCertListWidget->addItem(createListItem(cert, Certificate::InstallNew, i++));
540 540 }
541 mCertListWidget->addItem(createSeparator(tr("New certificates to remove"), i++)); 541 }
542 foreach (const Certificate &cert, newRemoveCerts) { 542
543 mCertListWidget->addItem(createListItem(cert, Certificate::RemoveNew, i++)); 543 if (!newRemoveCerts.isEmpty()) {
544 } 544 mCertListWidget->addItem(createSeparator(tr("New certificates to remove"), i++));
545 545 foreach (const Certificate &cert, newRemoveCerts) {
546 mCertListWidget->addItem(createSeparator(tr("Old certificates to install"), i++)); 546 mCertListWidget->addItem(createListItem(cert, Certificate::RemoveNew, i++));
547 foreach (const Certificate &cert, oldInstallCerts) { 547 }
548 mCertListWidget->addItem(createListItem(cert, Certificate::InstallOld, i++)); 548 }
549 } 549
550 550 if (!oldInstallCerts.isEmpty()) {
551 mCertListWidget->addItem(createSeparator(tr("Old certificates to remove"), i++)); 551 mCertListWidget->addItem(createSeparator(tr("Old certificates to install"), i++));
552 foreach (const Certificate &cert, oldRemoveCerts) { 552 foreach (const Certificate &cert, oldInstallCerts) {
553 mCertListWidget->addItem(createListItem(cert, Certificate::RemoveOld, i++)); 553 mCertListWidget->addItem(createListItem(cert, Certificate::InstallOld, i++));
554 }
555 }
556
557 if (!oldRemoveCerts.isEmpty()) {
558 mCertListWidget->addItem(createSeparator(tr("Old certificates to remove"), i++));
559 foreach (const Certificate &cert, oldRemoveCerts) {
560 mCertListWidget->addItem(createListItem(cert, Certificate::RemoveOld, i++));
561 }
554 } 562 }
555 } 563 }
556 564
557 QListWidgetItem* MainWindow::createSeparator(const QString &text, int index) 565 QListWidgetItem* MainWindow::createSeparator(const QString &text, int index)
558 { 566 {

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