Mercurial > trustbridge
diff ui/mainwindow.cpp @ 718:e7a070e64b80
(Issue26) Make updates tip and install button depend on changes
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 02 Jul 2014 16:27:46 +0200 |
parents | 77c9c2dfc8ac |
children | 49bf73b5c7de |
line wrap: on
line diff
--- a/ui/mainwindow.cpp Wed Jul 02 16:15:52 2014 +0200 +++ b/ui/mainwindow.cpp Wed Jul 02 16:27:46 2014 +0200 @@ -565,29 +565,30 @@ updatesHeaderLayout->setRowMinimumHeight(4, 15); /* Header 2: Action text and buttons */ - QLabel *updatesTip = - new QLabel(tr("You should apply the following, recommended changes to your certificate stores.")); - updatesTip->setWordWrap(true); + mUpdatesTip = + new QLabel(tr("There are currently no changes for your certificate stores.")); + mUpdatesTip->setWordWrap(true); QHBoxLayout *updatesHeaderActionButtonLayout = new QHBoxLayout; mQuitButton = new QPushButton(" " + tr("Quit without saving")); mQuitButton->setIcon(QIcon(":/img/application-exit.png")); mQuitButton->setFixedHeight(30); - QPushButton *installButton = new QPushButton(" " + tr("Apply changes")); - installButton->setFixedHeight(30); + + mInstallButton = new QPushButton(" " + tr("Install certificates again")); + mInstallButton->setFixedHeight(30); #ifdef Q_OS_WIN if (is_admin()) { QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield); - installButton->setIcon(uacShield); + mInstallButton->setIcon(uacShield); } #else - installButton->setIcon(QIcon(":/img/view-refresh.png")); + mInstallButton->setIcon(QIcon(":/img/view-refresh.png")); #endif connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp())); - connect(installButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts())); + connect(mInstallButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts())); // addWidget(*Widget, row, column, rowspan, colspan) - updatesHeaderLayout->addWidget(updatesTip, 5, 0, 1, 2); - updatesHeaderActionButtonLayout->addWidget(installButton); + updatesHeaderLayout->addWidget(mUpdatesTip, 5, 0, 1, 2); + updatesHeaderActionButtonLayout->addWidget(mInstallButton); updatesHeaderActionButtonLayout->addWidget(mQuitButton); updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout, 6, 0, 1, 1); updatesHeaderLayout->setRowMinimumHeight(7, 10); @@ -841,16 +842,31 @@ mUpdatesManualCertificates->hide(); } + /* Show a different tip in case of manual changes, updates aviailable, updates and manual + * changes available */ + if (changeCount() && !mUpdatesManual->certificates().size()) { + mUpdatesTip->setText( + tr("You should apply the following, recommended changes to your certificate stores.")); + } else if (changeCount()) { + mUpdatesTip->setText( + tr("You can apply the following, changes to your certificate stores.")); + } else { + mUpdatesTip->setText( + tr("There are currently no changes for your certificate stores.")); + } + if (!changeCount()) { /* No changes */ mQuitButton->setText(" " + tr("Quit")); mUpdatesHeader->setText("<h2>" + tr("Certificates unchanged") + "</h2>"); + mInstallButton->setText(" " + tr("Install certificates again")); } else { mQuitButton->setText(" " + tr("Quit without saving")); mUpdatesHeader->setText("<h2>" + tr("Changes to certificate stores (%1)") .arg(changeCount()) + "</h2>"); + mInstallButton->setText(" " + tr("Apply changes")); } if (mUpdatesNew->certificates().size()) {