annotate ui/certificatelistwidget.cpp @ 1107:51d3b361f17a

Revert commit 1102
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 15 Sep 2014 17:46:22 +0200
parents 6f7b7d88f048
children 9bb9932bb819
rev   line source
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 *
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6 * See LICENSE.txt for details.
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 */
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 #include "certificatelistwidget.h"
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 #include <QDebug>
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 #include <QVBoxLayout>
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 #include <QGroupBox>
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 #include <QLabel>
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
13 #include <QApplication>
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 #include "certificateitemwidget.h"
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 CertificateListWidget::CertificateListWidget(QWidget *parent, Qt::WindowFlags flags) :
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 QWidget(parent, flags)
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 {
842
bd33c6585cd0 UI improvements (issue18, 60)
Emanuel Schuetze <emanuel@intevation.de>
parents: 757
diff changeset
20 QVBoxLayout *outerLayout = new QVBoxLayout(this);
bd33c6585cd0 UI improvements (issue18, 60)
Emanuel Schuetze <emanuel@intevation.de>
parents: 757
diff changeset
21 outerLayout->addLayout(&mLayout);
bd33c6585cd0 UI improvements (issue18, 60)
Emanuel Schuetze <emanuel@intevation.de>
parents: 757
diff changeset
22 outerLayout->addStretch();
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 }
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24
639
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
25 void CertificateListWidget::addCertificate(
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
26 const Certificate &certificate,
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
27 bool state,
1106
6f7b7d88f048 (issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1101
diff changeset
28 QToolButton *button)
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 {
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 CertificateItemWidget *widget =
1106
6f7b7d88f048 (issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1101
diff changeset
31 new CertificateItemWidget(this, certificate, state, button);
627
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
32 connect(widget, SIGNAL(stateChanged(bool, const Certificate&)),
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
33 this, SLOT(certStateChanged(bool, const Certificate&)));
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
34
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
35 mCertificateWidgets << widget;
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
36 mLayout.addWidget(widget);
695
0f4c480c41f4 Emit list changed when certificates are added or removed
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
37 emit certListChanged(-1);
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 }
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39
1101
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
40 int CertificateListWidget::activeCertificates()
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
41 {
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
42 int ret = 0;
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
43 for (int i = 0; i < mCertificateWidgets.size(); i++) {
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
44 if (mCertificateWidgets[i]->certificate()->isActive()) {
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
45 ret++;
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
46 }
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
47 }
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
48 return ret;
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
49 }
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
50
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
51 void CertificateListWidget::activateCertificate(const Certificate &cert)
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
52 {
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
53 for (int i = 0; i < mCertificateWidgets.size(); i++) {
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
54 if (*(mCertificateWidgets[i]->certificate()) == cert) {
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
55 mCertificateWidgets[i]->certificate()->setActive(true);
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
56 break;
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
57 }
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
58 }
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
59 emit certListChanged(-1);
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
60 }
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
61
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
62 void CertificateListWidget::deactivateCertificate(const Certificate &cert)
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
63 {
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
64 for (int i = 0; i < mCertificateWidgets.size(); i++) {
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
65 if (*(mCertificateWidgets[i]->certificate()) == cert) {
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
66 mCertificateWidgets[i]->certificate()->setActive(false);
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
67 break;
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
68 }
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
69 }
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
70 emit certListChanged(-1);
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
71 }
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
72
639
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
73 void CertificateListWidget::removeCertificate(const Certificate &cert)
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 {
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
75 for (int i = 0; i < mCertificateWidgets.size(); i++) {
1101
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
76 if (*(mCertificateWidgets[i]->certificate()) == cert) {
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
77 mLayout.removeWidget(mCertificateWidgets[i]);
757
9bfaced5cf59 (issue56) Do not delete the certificate immediately
Andre Heinecke <andre.heinecke@intevation.de>
parents: 743
diff changeset
78 mCertificateWidgets[i]->deleteLater();
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
79 mCertificateWidgets.removeAt(i);
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
80 break;
639
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
81 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
82 }
695
0f4c480c41f4 Emit list changed when certificates are added or removed
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
83 emit certListChanged(-1);
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 }
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85
627
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
86 void CertificateListWidget::clear()
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 {
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
88 foreach (CertificateItemWidget * item, mCertificateWidgets) {
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
89 mLayout.removeWidget(item);
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
90 delete item;
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
91 }
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
92 mCertificateWidgets.clear();
627
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
93 }
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
94
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
95 QStringList CertificateListWidget::certificates()
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
96 {
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
97 QStringList list;
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
98 foreach (CertificateItemWidget * item, mCertificateWidgets) {
1101
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
99 list << item->certificate()->base64Line();
639
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
100 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
101 return list;
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
102 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
103
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
104 QStringList CertificateListWidget::selectedCertificates() {
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
105 QStringList list;
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
106 foreach (CertificateItemWidget * item, mCertificateWidgets) {
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
107 if (item->state()) {
1101
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
108 list << item->certificate()->base64Line();
627
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
109 }
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
110 }
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
111 return list;
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 }
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113
639
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
114 QStringList CertificateListWidget::unselectedCertificates() {
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
115 QStringList list;
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
116 foreach (CertificateItemWidget * item, mCertificateWidgets) {
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
117 if (!item->state()) {
1101
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
118 list << item->certificate()->base64Line();
639
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
119 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
120 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
121 return list;
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
122 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
123
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
124 QList<Certificate> CertificateListWidget::certificateList()
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
125 {
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
126 QList<Certificate> list;
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
127 foreach (CertificateItemWidget * item, mCertificateWidgets) {
1101
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
128 list << *(item->certificate());
639
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
129 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
130 return list;
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
131 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
132
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
133 void CertificateListWidget::setCertState(bool state, const Certificate &cert)
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
134 {
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
135 foreach (CertificateItemWidget * item, mCertificateWidgets) {
1101
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
136 if (*(item->certificate()) == cert &&
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
137 item->state() != state) {
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
138 item->setState(state);
639
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
139 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
140 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
141 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
142
627
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
143
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
144 void CertificateListWidget::certStateChanged(bool state, const Certificate &cert)
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
145 {
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
146 emit certListChanged(-1);
639
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
147 emit certChanged(state, cert);
627
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
148 }
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
149
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
150 int CertificateListWidget::selectedCertCount()
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
151 {
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
152 int selected = 0;
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
153 foreach (CertificateItemWidget * item, mCertificateWidgets) {
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
154 if (item->state()) {
627
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
155 selected++;
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
156 }
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
157 }
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
158 return selected;
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
159 }
639
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
160
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
161 bool CertificateListWidget::contains(const Certificate &cert)
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
162 {
743
a467204a35f5 Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 720
diff changeset
163 foreach (CertificateItemWidget * item, mCertificateWidgets) {
1101
2b3526ef2d69 (issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 842
diff changeset
164 if (*(item->certificate()) == cert) {
639
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
165 return true;
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
166 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
167 }
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
168 return false;
c1b35edb097f New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
169 }

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