[PATCH] (issue111) Use active property to handle manually changed certificates

Wald Commits scm-commit at wald.intevation.org
Mon Sep 15 13:56:46 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1410782203 -7200
# Node ID 3d03aaeca6d4eed6d8630d782bee5627a7257e7b
# Parent  2b3526ef2d696dfdb868116bbf43d5009e57f6fe
(issue111) Use active property to handle manually changed certificates

diff -r 2b3526ef2d69 -r 3d03aaeca6d4 ui/mainwindow.cpp
--- 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);


More information about the Trustbridge-commits mailing list