changeset 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 2b3526ef2d69
children c4e3498e716f
files ui/mainwindow.cpp
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Mon Sep 15 13:55:47 2014 +0200
+++ b/ui/mainwindow.cpp	Mon Sep 15 13:56:43 2014 +0200
@@ -1010,11 +1010,11 @@
 {
     Q_UNUSED (selected);
     setChangeCount(mUpdatesRemove->selectedCertCount() +
-        mUpdatesNew->selectedCertCount() + mUpdatesManual->certificates().size());
+        mUpdatesNew->selectedCertCount() + mUpdatesManual->activeCertificates());
 
     /* Show a different tip in case of manual changes, updates aviailable, updates and manual
      * changes available */
-    if (changeCount() && !mUpdatesManual->certificates().size()) {
+    if (changeCount() && !mUpdatesManual->activeCertificates()) {
         mUpdatesTip->setText(
                 tr("You should apply the following, recommended changes to your certificate stores."));
     } else if (changeCount()) {
@@ -1048,7 +1048,7 @@
         mUpdatesManual->hide();
     }
     mUpdatesManualCertificates->setText("<h2>" +
-            tr("Manually changed certificates (%1)").arg(mUpdatesManual->certificates().size()) +
+            tr("Manually changed certificates (%1)").arg(mUpdatesManual->activeCertificates()) +
             "</h2>");
 
     if (mUpdatesNew->certificates().size()) {
@@ -1343,13 +1343,21 @@
         mUpdatesManual->addCertificate(cert, state);
     }
     else {
-        mUpdatesManual->removeCertificate(cert);
+        if (cert.isActive()) {
+            mUpdatesManual->deactivateCertificate(cert);
+        } else {
+            mUpdatesManual->activateCertificate(cert);
+        }
     }
 }
 
 void MainWindow::removeFromManual(bool state, const Certificate &cert)
 {
-    mUpdatesManual->removeCertificate(cert);
+    if (cert.isActive()) {
+        mUpdatesManual->deactivateCertificate(cert);
+    } else {
+        mUpdatesManual->activateCertificate(cert);
+    }
 
     if (cert.isInstallCert()) {
         mInstallList->setCertState(state, cert);

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