Mercurial > trustbridge
annotate ui/certificatelistwidget.cpp @ 1101:2b3526ef2d69
(issue111) Keep manually changed certificates in the manually changed list.
This invents the new property "active certificate"
an inactive certificate is a certificate that is displayed but
has no impact on the store.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 15 Sep 2014 13:55:47 +0200 |
parents | bd33c6585cd0 |
children | 6f7b7d88f048 |
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, |
687
973a7ce19658
(issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents:
661
diff
changeset
|
28 bool editable, |
973a7ce19658
(issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents:
661
diff
changeset
|
29 const QString &installLabel, |
973a7ce19658
(issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents:
661
diff
changeset
|
30 const QString &removeLabel) |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 { |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 CertificateItemWidget *widget = |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
33 new CertificateItemWidget(this, certificate, state, editable, |
687
973a7ce19658
(issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents:
661
diff
changeset
|
34 installLabel, removeLabel); |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
35 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
|
36 this, SLOT(certStateChanged(bool, const Certificate&))); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
37 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
38 mCertificateWidgets << widget; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
39 mLayout.addWidget(widget); |
695
0f4c480c41f4
Emit list changed when certificates are added or removed
Andre Heinecke <andre.heinecke@intevation.de>
parents:
687
diff
changeset
|
40 emit certListChanged(-1); |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 } |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 |
1101
2b3526ef2d69
(issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
43 int CertificateListWidget::activeCertificates() |
2b3526ef2d69
(issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
44 { |
2b3526ef2d69
(issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
45 int ret = 0; |
2b3526ef2d69
(issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
46 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
|
47 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
|
48 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 return ret; |
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 |
2b3526ef2d69
(issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
54 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
|
55 { |
2b3526ef2d69
(issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
56 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
|
57 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
|
58 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
|
59 break; |
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 emit certListChanged(-1); |
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 |
2b3526ef2d69
(issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
65 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
|
66 { |
2b3526ef2d69
(issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
67 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
|
68 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
|
69 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
|
70 break; |
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 } |
2b3526ef2d69
(issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
73 emit certListChanged(-1); |
2b3526ef2d69
(issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
74 } |
2b3526ef2d69
(issue111) Keep manually changed certificates in the manually changed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
75 |
639
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
76 void CertificateListWidget::removeCertificate(const Certificate &cert) |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
77 { |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
78 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
|
79 if (*(mCertificateWidgets[i]->certificate()) == cert) { |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
80 mLayout.removeWidget(mCertificateWidgets[i]); |
757
9bfaced5cf59
(issue56) Do not delete the certificate immediately
Andre Heinecke <andre.heinecke@intevation.de>
parents:
743
diff
changeset
|
81 mCertificateWidgets[i]->deleteLater(); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
82 mCertificateWidgets.removeAt(i); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
83 break; |
639
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
84 } |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
85 } |
695
0f4c480c41f4
Emit list changed when certificates are added or removed
Andre Heinecke <andre.heinecke@intevation.de>
parents:
687
diff
changeset
|
86 emit certListChanged(-1); |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
87 } |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
88 |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
89 void CertificateListWidget::clear() |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
90 { |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
91 foreach (CertificateItemWidget * item, mCertificateWidgets) { |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
92 mLayout.removeWidget(item); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
93 delete item; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
94 } |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
95 mCertificateWidgets.clear(); |
627
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 |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
98 QStringList CertificateListWidget::certificates() |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
99 { |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
100 QStringList list; |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
101 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
|
102 list << item->certificate()->base64Line(); |
639
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 return list; |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
105 } |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
106 |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
107 QStringList CertificateListWidget::selectedCertificates() { |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
108 QStringList list; |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
109 foreach (CertificateItemWidget * item, mCertificateWidgets) { |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
110 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
|
111 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
|
112 } |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
113 } |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
114 return list; |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
115 } |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
116 |
639
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
117 QStringList CertificateListWidget::unselectedCertificates() { |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
118 QStringList list; |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
119 foreach (CertificateItemWidget * item, mCertificateWidgets) { |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
120 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
|
121 list << item->certificate()->base64Line(); |
639
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 return list; |
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 |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
127 QList<Certificate> CertificateListWidget::certificateList() |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
128 { |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
129 QList<Certificate> list; |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
130 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
|
131 list << *(item->certificate()); |
639
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 return list; |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
134 } |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
135 |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
136 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
|
137 { |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
138 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
|
139 if (*(item->certificate()) == cert && |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
140 item->state() != state) { |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
141 item->setState(state); |
639
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
142 } |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
143 } |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
144 } |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
145 |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
146 |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
147 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
|
148 { |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
149 emit certListChanged(-1); |
639
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
150 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
|
151 } |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
152 |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
153 int CertificateListWidget::selectedCertCount() |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
154 { |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
155 int selected = 0; |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
156 foreach (CertificateItemWidget * item, mCertificateWidgets) { |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
157 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
|
158 selected++; |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
159 } |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
160 } |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
161 return selected; |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
162 } |
639
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
163 |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
164 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
|
165 { |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
720
diff
changeset
|
166 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
|
167 if (*(item->certificate()) == cert) { |
639
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
168 return true; |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
169 } |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
170 } |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
171 return false; |
c1b35edb097f
New methods to modify and use the certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
172 } |