comparison ui/mainwindow.cpp @ 716:929c3db85eb7

Add central place to obtain current change count.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 02 Jul 2014 16:09:19 +0200
parents 57bd73145e48
children 77c9c2dfc8ac
comparison
equal deleted inserted replaced
715:345805165d9b 716:929c3db85eb7
827 setCentralWidget(base); 827 setCentralWidget(base);
828 } 828 }
829 829
830 void MainWindow::listChanged(int selected) 830 void MainWindow::listChanged(int selected)
831 { 831 {
832 int totalCount = mUpdatesRemove->selectedCertCount() + 832 Q_UNUSED (selected);
833 mChangeCount = mUpdatesRemove->selectedCertCount() +
833 mUpdatesNew->selectedCertCount() + mUpdatesManual->certificates().size(); 834 mUpdatesNew->selectedCertCount() + mUpdatesManual->certificates().size();
834 835
835 if (mUpdatesManual->certificates().size()) { 836 if (mUpdatesManual->certificates().size()) {
836 mUpdatesDetailsManual->show(); 837 mUpdatesDetailsManual->show();
837 mUpdatesManualCertificates->show(); 838 mUpdatesManualCertificates->show();
838 } else { 839 } else {
839 mUpdatesDetailsManual->hide(); 840 mUpdatesDetailsManual->hide();
840 mUpdatesManualCertificates->hide(); 841 mUpdatesManualCertificates->hide();
841 } 842 }
842 843
843 if (!totalCount) { 844 if (!changeCount()) {
844 /* No changes */ 845 /* No changes */
845 mQuitButton->setText(" " + tr("Quit")); 846 mQuitButton->setText(" " + tr("Quit"));
846 mUpdatesHeader->setText("<h2>" + tr("Certificates unchanged") + 847 mUpdatesHeader->setText("<h2>" + tr("Certificates unchanged") +
847 "</h2>"); 848 "</h2>");
848 } else { 849 } else {
849 mQuitButton->setText(" " + tr("Quit without saving")); 850 mQuitButton->setText(" " + tr("Quit without saving"));
850 mUpdatesHeader->setText("<h2>" + tr("Changes to certificate stores (%1)") 851 mUpdatesHeader->setText("<h2>" + tr("Changes to certificate stores (%1)")
851 .arg(totalCount) + 852 .arg(changeCount()) +
852 "</h2>"); 853 "</h2>");
853 } 854 }
854 855
855 mUpdatesNewCertificates->setText("<h3>" + 856 mUpdatesNewCertificates->setText("<h3>" +
856 tr("Install new trusted certificates (%1/%2)") 857 tr("Install new trusted certificates (%1/%2)")
1188 QLocale::system().toString(now, DATETIME_FORMAT))); 1189 QLocale::system().toString(now, DATETIME_FORMAT)));
1189 mLastUpdateCheck->show(); 1190 mLastUpdateCheck->show();
1190 syslog_info_printf(tr("Sucessfully checked for updates.").toUtf8().constData()); 1191 syslog_info_printf(tr("Sucessfully checked for updates.").toUtf8().constData());
1191 } 1192 }
1192 } 1193 }
1194
1195 int MainWindow::changeCount()
1196 {
1197 return mChangeCount;
1198 }

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