changeset 1108:9bb9932bb819

Revert commit 1101 the inactive manual changes were a bad idea
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 15 Sep 2014 17:47:12 +0200
parents 51d3b361f17a
children 6594e8e63a25
files ui/certificate.cpp ui/certificate.h ui/certificateitemwidget.cpp ui/certificateitemwidget.h ui/certificatelistwidget.cpp ui/certificatelistwidget.h
diffstat 6 files changed, 11 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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,
--- 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)
--- 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();
--- 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;
         }
     }
--- 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:

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