Mercurial > trustbridge
annotate ui/certificateitemwidget.cpp @ 582:88c9bdc74175 trustbridge-refactor
New widgets to display certificates in lists.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 27 May 2014 16:16:21 +0200 |
parents | |
children | 566ee111e331 |
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 "certificateitemwidget.h" |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 #include <QHBoxLayout> |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 #include <QDebug> |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 CertificateItemWidget::CertificateItemWidget( |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 QWidget *parent, |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 const Certificate &cert) : QWidget(parent) |
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 mCertificate = cert; |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 setupGUI(); |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 } |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 void CertificateItemWidget::setupGUI() |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 { |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 mLabel = new QLabel(mCertificate.subjectCN()); |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 mComboBox = new QComboBox; |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 mComboBox->setFixedWidth(46); |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 if (mCertificate.isInstallCert()) { |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 mComboBox->addItem(QIcon(":/img/list-add.png"), tr("add"), QVariant("true")); |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 mComboBox->addItem(QIcon(":/img/list-remove.png"), |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 tr("remove"), QVariant("false")); |
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 else { |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 mComboBox->addItem(QIcon(":/img/list-add.png"), tr("add"), QVariant("true")); |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 mComboBox->addItem(QIcon(":/img/list-remove.png"), |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 tr("remove"), QVariant("false")); |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 } |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 QHBoxLayout *layout = new QHBoxLayout; |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 layout->addWidget(mComboBox); |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 layout->addWidget(mLabel); |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 this->setLayout(layout); |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 } |