[PATCH 4 of 7] Revert commit 1101 the inactive manual changes were a bad idea

Wald Commits scm-commit at wald.intevation.org
Mon Sep 15 19:11:22 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1410796032 -7200
# Node ID 9bb9932bb819c71e4118b29f3e0e8ca1ff5b477e
# Parent  51d3b361f17aff915cbeae8e65b120841d6ebd2c
Revert commit 1101 the inactive manual changes were a bad idea

diff -r 51d3b361f17a -r 9bb9932bb819 ui/certificate.cpp
--- a/ui/certificate.cpp	Mon Sep 15 17:46:22 2014 +0200
+++ b/ui/certificate.cpp	Mon Sep 15 17:47:12 2014 +0200
@@ -88,8 +88,7 @@
 
 Certificate::Certificate(const QByteArray& derData) :
     mValid(false),
-    mEditable(false),
-    mActive(true)
+    mEditable(false)
 {
     if (derData.isEmpty()) {
         return;
diff -r 51d3b361f17a -r 9bb9932bb819 ui/certificate.h
--- a/ui/certificate.h	Mon Sep 15 17:46:22 2014 +0200
+++ b/ui/certificate.h	Mon Sep 15 17:47:12 2014 +0200
@@ -136,21 +136,6 @@
     friend inline bool operator==(const Certificate& lhs, const Certificate& rhs) {
         return lhs.base64Line() == rhs.base64Line();
     }
-
-    /** @brief Wether or not the certificate is Active.
-     *
-     * This property is mainly for the manually changed certificate list.
-     * A certificate is active if it should be counted as change in a list
-     * and if it should be written to a certificate store.
-     *
-     * An inctive certificate will only be shown in the manual changes list
-     * but not counted as a changed or changed in the certificate list. */
-    bool isActive() const { return mActive; }
-
-    /** @brief set the active state of a certificate.
-     *
-     * See isActive() for details. */
-    void setActive(bool active) { mActive = active; }
 private:
     /** @brief Helper function to parse the details of a certificate **/
     void parseDetails(const QByteArray& cert);
@@ -158,7 +143,6 @@
     bool mValid;
     /* bool mInstCert; */
     bool mEditable;
-    bool mActive;
 
     QString mSubjectOU,
             mSubjectCN,
diff -r 51d3b361f17a -r 9bb9932bb819 ui/certificateitemwidget.cpp
--- a/ui/certificateitemwidget.cpp	Mon Sep 15 17:46:22 2014 +0200
+++ b/ui/certificateitemwidget.cpp	Mon Sep 15 17:47:12 2014 +0200
@@ -119,9 +119,9 @@
     mButton->setChecked(!state);
 }
 
-Certificate* CertificateItemWidget::certificate()
+Certificate CertificateItemWidget::certificate()
 {
-    return &mCertificate;
+    return mCertificate;
 }
 
 void CertificateItemWidget::currentStateChanged(bool state)
diff -r 51d3b361f17a -r 9bb9932bb819 ui/certificateitemwidget.h
--- a/ui/certificateitemwidget.h	Mon Sep 15 17:46:22 2014 +0200
+++ b/ui/certificateitemwidget.h	Mon Sep 15 17:47:12 2014 +0200
@@ -31,7 +31,7 @@
 
     bool state();
     void setState(bool state);
-    Certificate *certificate();
+    Certificate certificate();
 
 private:
     void setupGUI();
diff -r 51d3b361f17a -r 9bb9932bb819 ui/certificatelistwidget.cpp
--- a/ui/certificatelistwidget.cpp	Mon Sep 15 17:46:22 2014 +0200
+++ b/ui/certificatelistwidget.cpp	Mon Sep 15 17:47:12 2014 +0200
@@ -37,43 +37,10 @@
     emit certListChanged(-1);
 }
 
-int CertificateListWidget::activeCertificates()
-{
-    int ret = 0;
-    for (int i = 0; i < mCertificateWidgets.size(); i++) {
-        if (mCertificateWidgets[i]->certificate()->isActive()) {
-            ret++;
-        }
-    }
-    return ret;
-}
-
-void CertificateListWidget::activateCertificate(const Certificate &cert)
-{
-    for (int i = 0; i < mCertificateWidgets.size(); i++) {
-        if (*(mCertificateWidgets[i]->certificate()) == cert) {
-            mCertificateWidgets[i]->certificate()->setActive(true);
-            break;
-        }
-    }
-    emit certListChanged(-1);
-}
-
-void CertificateListWidget::deactivateCertificate(const Certificate &cert)
-{
-    for (int i = 0; i < mCertificateWidgets.size(); i++) {
-        if (*(mCertificateWidgets[i]->certificate()) == cert) {
-            mCertificateWidgets[i]->certificate()->setActive(false);
-            break;
-        }
-    }
-    emit certListChanged(-1);
-}
-
 void CertificateListWidget::removeCertificate(const Certificate &cert)
 {
     for (int i = 0; i < mCertificateWidgets.size(); i++) {
-        if (*(mCertificateWidgets[i]->certificate()) == cert) {
+        if (mCertificateWidgets[i]->certificate() == cert) {
             mLayout.removeWidget(mCertificateWidgets[i]);
             mCertificateWidgets[i]->deleteLater();
             mCertificateWidgets.removeAt(i);
@@ -96,7 +63,7 @@
 {
     QStringList list;
     foreach (CertificateItemWidget * item, mCertificateWidgets) {
-        list <<  item->certificate()->base64Line();
+        list <<  item->certificate().base64Line();
     }
     return list;
 }
@@ -105,7 +72,7 @@
     QStringList list;
     foreach (CertificateItemWidget * item, mCertificateWidgets) {
         if (item->state()) {
-            list << item->certificate()->base64Line();
+            list << item->certificate().base64Line();
         }
     }
     return list;
@@ -115,7 +82,7 @@
     QStringList list;
     foreach (CertificateItemWidget * item, mCertificateWidgets) {
         if (!item->state()) {
-            list << item->certificate()->base64Line();
+            list << item->certificate().base64Line();
         }
     }
     return list;
@@ -125,7 +92,7 @@
 {
     QList<Certificate> list;
     foreach (CertificateItemWidget * item, mCertificateWidgets) {
-        list <<  *(item->certificate());
+        list <<  item->certificate();
     }
     return list;
 }
@@ -133,7 +100,7 @@
 void CertificateListWidget::setCertState(bool state, const Certificate &cert)
 {
     foreach (CertificateItemWidget * item, mCertificateWidgets) {
-        if (*(item->certificate()) == cert &&
+        if (item->certificate() == cert &&
             item->state() != state) {
             item->setState(state);
         }
@@ -161,7 +128,7 @@
 bool CertificateListWidget::contains(const Certificate &cert)
 {
     foreach (CertificateItemWidget * item, mCertificateWidgets) {
-        if (*(item->certificate()) == cert) {
+        if (item->certificate() == cert) {
             return true;
         }
     }
diff -r 51d3b361f17a -r 9bb9932bb819 ui/certificatelistwidget.h
--- a/ui/certificatelistwidget.h	Mon Sep 15 17:46:22 2014 +0200
+++ b/ui/certificatelistwidget.h	Mon Sep 15 17:47:12 2014 +0200
@@ -34,8 +34,6 @@
     void addCertificate(const Certificate &certificate, bool state,
                         QToolButton *btn);
     void removeCertificate(const Certificate &cert);
-    void activateCertificate(const Certificate &cert);
-    void deactivateCertificate(const Certificate &cert);
     void setCertState(bool state, const Certificate &cert);
     void clear();
     QStringList certificates();
@@ -43,7 +41,6 @@
     QStringList unselectedCertificates();
     QList<Certificate> certificateList();
     int selectedCertCount();
-    int activeCertificates();
     bool contains(const Certificate &cert);
 
 private:


More information about the Trustbridge-commits mailing list