Mercurial > trustbridge
changeset 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 | 345805165d9b |
children | 77c9c2dfc8ac |
files | ui/mainwindow.cpp ui/mainwindow.h |
diffstat | 2 files changed, 22 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/mainwindow.cpp Wed Jul 02 16:08:55 2014 +0200 +++ b/ui/mainwindow.cpp Wed Jul 02 16:09:19 2014 +0200 @@ -829,7 +829,8 @@ void MainWindow::listChanged(int selected) { - int totalCount = mUpdatesRemove->selectedCertCount() + + Q_UNUSED (selected); + mChangeCount = mUpdatesRemove->selectedCertCount() + mUpdatesNew->selectedCertCount() + mUpdatesManual->certificates().size(); if (mUpdatesManual->certificates().size()) { @@ -840,7 +841,7 @@ mUpdatesManualCertificates->hide(); } - if (!totalCount) { + if (!changeCount()) { /* No changes */ mQuitButton->setText(" " + tr("Quit")); mUpdatesHeader->setText("<h2>" + tr("Certificates unchanged") + @@ -848,7 +849,7 @@ } else { mQuitButton->setText(" " + tr("Quit without saving")); mUpdatesHeader->setText("<h2>" + tr("Changes to certificate stores (%1)") - .arg(totalCount) + + .arg(changeCount()) + "</h2>"); } @@ -1190,3 +1191,8 @@ syslog_info_printf(tr("Sucessfully checked for updates.").toUtf8().constData()); } } + +int MainWindow::changeCount() +{ + return mChangeCount; +}
--- a/ui/mainwindow.h Wed Jul 02 16:08:55 2014 +0200 +++ b/ui/mainwindow.h Wed Jul 02 16:09:19 2014 +0200 @@ -82,6 +82,14 @@ void toggleUpdatesNew(); void toggleUpdatesRemove(); void toggleUpdatesManual(); + + /** Reflect change list states in the UI + * + * This slot should be called each time the contents or selection + * state of one of the certificate lists change to update the + * UI elements accordingly. + * + * @param[in] selected unused. */ void listChanged(int selected); /** @brief check for running software that needs to close before installing @@ -154,6 +162,9 @@ void installNewSW(const QString& fileName, const QDateTime& modDate); private: + /** @brief the combined number of changes made in all lists */ + int changeCount(); + /** @brief check the integrity of available certificate lists. * * Note: Do not use this as a local trust check as this only works on @@ -231,6 +242,8 @@ QPushButton *mUpdatesDetailsNew; QPushButton *mUpdatesDetailsRemove; QPushButton *mUpdatesDetailsManual; + + int mChangeCount; }; #endif // MAINWINDOW_H