Mercurial > trustbridge
annotate ui/certificateitemwidget.cpp @ 1361:0f3af6916395
Fix directory change order in coverage script
author | aheinecke@intevation.de |
---|---|
date | Mon, 10 Nov 2014 14:01:23 +0100 |
parents | 9017c524e762 |
children |
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> |
701
31c3d2bc9880
(Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
687
diff
changeset
|
12 #include <QStyleFactory> |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
13 #include <QToolButton> |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
14 #include <QSignalBlocker> |
1293
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
15 #include <QPushButton> |
1297
c2fd36cd4093
(issue123) Use gcr-viewer to view certificate details on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1293
diff
changeset
|
16 #include <QMessageBox> |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
17 |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
18 void CheckLessToolBtn::paintEvent(QPaintEvent * pe) { |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
19 |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
20 /* Hack to always paint the button as if it were |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
21 * not checked. */ |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
22 bool oldchecked = isChecked(); |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
23 QIcon oldIcon = icon(); |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
24 QIcon tmpIcon; |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
25 if (isEnabled()) |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
26 tmpIcon = QIcon(oldIcon.pixmap(QSize(48, 48), QIcon::Normal, oldchecked ? QIcon::On : QIcon::Off)); |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
27 else { |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
28 tmpIcon = QIcon(oldIcon.pixmap(QSize(48, 48), QIcon::Disabled, oldchecked ? QIcon::On : QIcon::Off)); |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
29 } |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
30 QSignalBlocker blk(this); |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
31 setChecked(false); |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
32 setIcon(tmpIcon); |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
33 QToolButton::paintEvent(pe); |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
34 setIcon(oldIcon); |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
35 setChecked(oldchecked); |
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
36 } |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 |
687
973a7ce19658
(issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents:
685
diff
changeset
|
38 CertificateItemWidget::CertificateItemWidget(QWidget *parent, |
973a7ce19658
(issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents:
685
diff
changeset
|
39 const Certificate &cert, |
973a7ce19658
(issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents:
685
diff
changeset
|
40 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
|
41 QToolButton *btn) : |
687
973a7ce19658
(issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents:
685
diff
changeset
|
42 QWidget(parent), |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
43 mButton(btn) |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 { |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 mCertificate = cert; |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
46 mOriginalState = state; |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
47 btn->setCheckable(true); |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
48 /* btn->setStyleSheet("QToolButton:Checked{" |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
49 "border: 1px solid #8f8f91;" |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
50 "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
51 "stop: 0 #f6f7fa, stop: 1 #dadbde);" |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
52 "}" |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
53 );*/ |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
54 setState(state); |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 setupGUI(); |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 } |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 void CertificateItemWidget::setupGUI() |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 { |
786
4eff77851e76
Use minimum size for certificates to avoid scaling in small lists.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
780
diff
changeset
|
60 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); |
4eff77851e76
Use minimum size for certificates to avoid scaling in small lists.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
780
diff
changeset
|
61 |
842
bd33c6585cd0
UI improvements (issue18, 60)
Emanuel Schuetze <emanuel@intevation.de>
parents:
839
diff
changeset
|
62 const QString validity = tr("Validity: %1 until %2").arg( |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
710
diff
changeset
|
63 QLocale::system().toString(mCertificate.validFrom().date(), QLocale::ShortFormat)).arg( |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
710
diff
changeset
|
64 QLocale::system().toString(mCertificate.validTo().date(), QLocale::ShortFormat)); |
842
bd33c6585cd0
UI improvements (issue18, 60)
Emanuel Schuetze <emanuel@intevation.de>
parents:
839
diff
changeset
|
65 const QString fpstring = tr("Fingerprint (SHA1): <code>%1</code>").arg(mCertificate.fingerprint()); |
1293
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
66 |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
67 QVBoxLayout *labelLayout = new QVBoxLayout; |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
68 QLabel *firstLabel = new QLabel(QString::fromLatin1("<big><b>%1</b></big> ").arg |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
69 (mCertificate.subjectCN())); |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
70 |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
71 QHBoxLayout *firstLabelButtonLayout = new QHBoxLayout; |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
72 firstLabelButtonLayout->addWidget(firstLabel); |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
73 QPushButton *detailsBtn = new QPushButton; |
1298
9017c524e762
(issue123) Use document preview icon
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1297
diff
changeset
|
74 detailsBtn->setIcon(QIcon(":/img/document-preview.png")); |
1293
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
75 detailsBtn->setToolTip(tr("Open the Windows certificate information dialog.")); |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
76 |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
77 firstLabelButtonLayout->addWidget(detailsBtn); |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
78 firstLabelButtonLayout->addStretch(-1); |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
79 connect(detailsBtn, SIGNAL(clicked()), this, SLOT(showCertDlg())); |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
80 labelLayout->addLayout(firstLabelButtonLayout); |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
81 QLabel *secondLabel = new QLabel(QString::fromLatin1("%2<br/>%3<br/>%4").arg |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
82 (mCertificate.subjectO()).arg(validity).arg |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
710
diff
changeset
|
83 (fpstring)); |
701
31c3d2bc9880
(Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
687
diff
changeset
|
84 |
1293
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
85 labelLayout->addWidget(secondLabel); |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
86 secondLabel->setTextFormat(Qt::RichText); |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
87 secondLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
780
9f13c00a2647
Make certificate text selectable
Andre Heinecke <andre.heinecke@intevation.de>
parents:
744
diff
changeset
|
88 |
1293
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
89 secondLabel->setTextInteractionFlags( |
780
9f13c00a2647
Make certificate text selectable
Andre Heinecke <andre.heinecke@intevation.de>
parents:
744
diff
changeset
|
90 Qt::TextSelectableByMouse | |
9f13c00a2647
Make certificate text selectable
Andre Heinecke <andre.heinecke@intevation.de>
parents:
744
diff
changeset
|
91 Qt::TextSelectableByKeyboard); |
1293
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
92 firstLabel->setTextFormat(Qt::RichText); |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
93 firstLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
94 |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
95 firstLabel->setTextInteractionFlags( |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
96 Qt::TextSelectableByMouse | |
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
97 Qt::TextSelectableByKeyboard); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
98 mButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
99 connect(mButton, SIGNAL(toggled (bool)), |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
100 this, SLOT(currentStateChanged(bool))); |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
101 |
638
9d806f140bd5
Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
102 QHBoxLayout *layout = new QHBoxLayout; |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
103 layout->addWidget(mButton); |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
104 mButton->setFixedSize(64, 64); |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
105 mButton->setIconSize(QSize(48, 48)); |
1293
d2b32c75efcf
(issue123) Change layout from link to a button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1288
diff
changeset
|
106 layout->addLayout(labelLayout); |
582
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
107 this->setLayout(layout); |
88c9bdc74175
New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
108 } |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
109 |
1288
265583011f24
(issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
110 void CertificateItemWidget::showCertDlg() |
265583011f24
(issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
111 { |
265583011f24
(issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
112 /* This is a totally evil cast but legitimate on Windows |
265583011f24
(issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
113 * HANDLES are only 32 bit even on Windows 64 bit */ |
1297
c2fd36cd4093
(issue123) Use gcr-viewer to view certificate details on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1293
diff
changeset
|
114 if (!mCertificate.showNativeUI((void*)effectiveWinId())) { |
c2fd36cd4093
(issue123) Use gcr-viewer to view certificate details on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1293
diff
changeset
|
115 qDebug() << "Failed to show native dialog"; |
c2fd36cd4093
(issue123) Use gcr-viewer to view certificate details on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1293
diff
changeset
|
116 #ifdef WIN32 |
c2fd36cd4093
(issue123) Use gcr-viewer to view certificate details on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1293
diff
changeset
|
117 // maybe old windows version |
c2fd36cd4093
(issue123) Use gcr-viewer to view certificate details on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1293
diff
changeset
|
118 QMessageBox::warning(this, tr("TrustBridge error"), tr("Failed to open native viewer.")); |
c2fd36cd4093
(issue123) Use gcr-viewer to view certificate details on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1293
diff
changeset
|
119 #else |
c2fd36cd4093
(issue123) Use gcr-viewer to view certificate details on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1293
diff
changeset
|
120 QMessageBox::warning(this, tr("TrustBridge error"), tr("Failed to open 'gcr-viewer'.") + "\n" + |
c2fd36cd4093
(issue123) Use gcr-viewer to view certificate details on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1293
diff
changeset
|
121 tr("TrustBridge uses 'gcr-viewer' to show certificate details. Please ensure that 'gcr-viewer' is installed.")); |
c2fd36cd4093
(issue123) Use gcr-viewer to view certificate details on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1293
diff
changeset
|
122 #endif |
c2fd36cd4093
(issue123) Use gcr-viewer to view certificate details on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1293
diff
changeset
|
123 } |
1288
265583011f24
(issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
124 return; |
265583011f24
(issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
125 } |
265583011f24
(issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
126 |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
127 bool CertificateItemWidget::state() |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
128 { |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
129 if (!mButton->isEnabled()) { |
685
248d4f24e618
(Issue 29) Uneditable items are always selected
Andre Heinecke <andre.heinecke@intevation.de>
parents:
659
diff
changeset
|
130 return true; |
248d4f24e618
(Issue 29) Uneditable items are always selected
Andre Heinecke <andre.heinecke@intevation.de>
parents:
659
diff
changeset
|
131 } |
701
31c3d2bc9880
(Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
687
diff
changeset
|
132 |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
133 return !mButton->isChecked(); |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
134 } |
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
135 |
638
9d806f140bd5
Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
136 void CertificateItemWidget::setState(bool state) |
9d806f140bd5
Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
137 { |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
138 /* The internal state we get here is inverted for Ui reasons the logic |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
139 * is if a certificate is selected for installation the button |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
140 * is disabled (as this is the default) Only those that are |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
141 * unselected have the enabled button. */ |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
142 mButton->blockSignals(true); // code did this and not the user |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
143 mButton->setChecked(!state); |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
144 mButton->blockSignals(false); |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
145 if (mButton->isEnabled()) { |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
146 mButton->setToolTip(mButton->property(!state ? "ToolTip_On" : |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
147 "ToolTip_Off").toString()); |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
148 } |
638
9d806f140bd5
Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
149 } |
9d806f140bd5
Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents:
627
diff
changeset
|
150 |
1108
9bb9932bb819
Revert commit 1101 the inactive manual changes were a bad idea
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1106
diff
changeset
|
151 Certificate CertificateItemWidget::certificate() |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
152 { |
1108
9bb9932bb819
Revert commit 1101 the inactive manual changes were a bad idea
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1106
diff
changeset
|
153 return mCertificate; |
627
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 |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1101
diff
changeset
|
156 void CertificateItemWidget::currentStateChanged(bool state) |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
157 { |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
158 mButton->setToolTip(mButton->property(state ? "ToolTip_On" : |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
159 "ToolTip_Off").toString()); |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1108
diff
changeset
|
160 emit stateChanged(state, mCertificate); |
627
566ee111e331
Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents:
582
diff
changeset
|
161 } |