Mercurial > trustbridge
comparison ui/mainwindow.cpp @ 1102:3d03aaeca6d4
(issue111) Use active property to handle manually changed certificates
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 15 Sep 2014 13:56:43 +0200 |
parents | 3d4a81eff3fd |
children | c4e3498e716f |
comparison
equal
deleted
inserted
replaced
1101:2b3526ef2d69 | 1102:3d03aaeca6d4 |
---|---|
1008 | 1008 |
1009 void MainWindow::listChanged(int selected) | 1009 void MainWindow::listChanged(int selected) |
1010 { | 1010 { |
1011 Q_UNUSED (selected); | 1011 Q_UNUSED (selected); |
1012 setChangeCount(mUpdatesRemove->selectedCertCount() + | 1012 setChangeCount(mUpdatesRemove->selectedCertCount() + |
1013 mUpdatesNew->selectedCertCount() + mUpdatesManual->certificates().size()); | 1013 mUpdatesNew->selectedCertCount() + mUpdatesManual->activeCertificates()); |
1014 | 1014 |
1015 /* Show a different tip in case of manual changes, updates aviailable, updates and manual | 1015 /* Show a different tip in case of manual changes, updates aviailable, updates and manual |
1016 * changes available */ | 1016 * changes available */ |
1017 if (changeCount() && !mUpdatesManual->certificates().size()) { | 1017 if (changeCount() && !mUpdatesManual->activeCertificates()) { |
1018 mUpdatesTip->setText( | 1018 mUpdatesTip->setText( |
1019 tr("You should apply the following, recommended changes to your certificate stores.")); | 1019 tr("You should apply the following, recommended changes to your certificate stores.")); |
1020 } else if (changeCount()) { | 1020 } else if (changeCount()) { |
1021 mUpdatesTip->setText( | 1021 mUpdatesTip->setText( |
1022 tr("You can apply the following, changes to your certificate stores.")); | 1022 tr("You can apply the following, changes to your certificate stores.")); |
1046 } else { | 1046 } else { |
1047 mUpdatesDetailsManual->hide(); | 1047 mUpdatesDetailsManual->hide(); |
1048 mUpdatesManual->hide(); | 1048 mUpdatesManual->hide(); |
1049 } | 1049 } |
1050 mUpdatesManualCertificates->setText("<h2>" + | 1050 mUpdatesManualCertificates->setText("<h2>" + |
1051 tr("Manually changed certificates (%1)").arg(mUpdatesManual->certificates().size()) + | 1051 tr("Manually changed certificates (%1)").arg(mUpdatesManual->activeCertificates()) + |
1052 "</h2>"); | 1052 "</h2>"); |
1053 | 1053 |
1054 if (mUpdatesNew->certificates().size()) { | 1054 if (mUpdatesNew->certificates().size()) { |
1055 mUpdatesNewCertificates->setText("<h3>" + | 1055 mUpdatesNewCertificates->setText("<h3>" + |
1056 tr("Install new trusted certificates (%1/%2)") | 1056 tr("Install new trusted certificates (%1/%2)") |
1341 { | 1341 { |
1342 if (!mUpdatesManual->contains(cert)) { | 1342 if (!mUpdatesManual->contains(cert)) { |
1343 mUpdatesManual->addCertificate(cert, state); | 1343 mUpdatesManual->addCertificate(cert, state); |
1344 } | 1344 } |
1345 else { | 1345 else { |
1346 mUpdatesManual->removeCertificate(cert); | 1346 if (cert.isActive()) { |
1347 mUpdatesManual->deactivateCertificate(cert); | |
1348 } else { | |
1349 mUpdatesManual->activateCertificate(cert); | |
1350 } | |
1347 } | 1351 } |
1348 } | 1352 } |
1349 | 1353 |
1350 void MainWindow::removeFromManual(bool state, const Certificate &cert) | 1354 void MainWindow::removeFromManual(bool state, const Certificate &cert) |
1351 { | 1355 { |
1352 mUpdatesManual->removeCertificate(cert); | 1356 if (cert.isActive()) { |
1357 mUpdatesManual->deactivateCertificate(cert); | |
1358 } else { | |
1359 mUpdatesManual->activateCertificate(cert); | |
1360 } | |
1353 | 1361 |
1354 if (cert.isInstallCert()) { | 1362 if (cert.isInstallCert()) { |
1355 mInstallList->setCertState(state, cert); | 1363 mInstallList->setCertState(state, cert); |
1356 } | 1364 } |
1357 else { | 1365 else { |