Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kleopatra
Commits
e7a526cc
Commit
e7a526cc
authored
May 20, 2021
by
Ingo Klöcker
Browse files
Hide OpenPGP keys section if card does not provide OpenPGP keys
GnuPG-bug-id: 4876
parent
5ea28758
Changes
2
Show whitespace changes
Inline
Side-by-side
src/view/p15cardwidget.cpp
View file @
e7a526cc
...
...
@@ -46,6 +46,7 @@ P15CardWidget::P15CardWidget(QWidget *parent)
,
mSerialNumber
{
new
QLabel
{
this
}}
,
mVersionLabel
{
new
QLabel
{
this
}}
,
mStatusLabel
{
new
QLabel
{
this
}}
,
mOpenPGPKeysSection
{
new
QWidget
{
this
}}
,
mOpenPGPKeysWidget
{
new
OpenPGPKeyCardWidget
{
this
}}
{
// Set up the scroll area
...
...
@@ -82,11 +83,17 @@ P15CardWidget::P15CardWidget(QWidget *parent)
areaVLay
->
addWidget
(
new
KSeparator
(
Qt
::
Horizontal
));
areaVLay
->
addWidget
(
new
QLabel
(
QStringLiteral
(
"<b>%1</b>"
).
arg
(
i18n
(
"OpenPGP keys:"
))));
{
auto
l
=
new
QVBoxLayout
{
mOpenPGPKeysSection
};
l
->
setContentsMargins
(
0
,
0
,
0
,
0
);
l
->
addWidget
(
new
QLabel
(
QStringLiteral
(
"<b>%1</b>"
).
arg
(
i18n
(
"OpenPGP keys:"
))));
mOpenPGPKeysWidget
->
setAllowedActions
(
OpenPGPKeyCardWidget
::
NoAction
);
areaVLay
->
addWidget
(
mOpenPGPKeysWidget
);
l
->
addWidget
(
mOpenPGPKeysWidget
);
l
->
addWidget
(
new
KSeparator
(
Qt
::
Horizontal
));
}
mOpenPGPKeysSection
->
setVisible
(
false
);
areaVLay
->
addWidget
(
mOpenPGPKeysSection
);
areaVLay
->
addWidget
(
new
KSeparator
(
Qt
::
Horizontal
));
areaVLay
->
addStretch
(
1
);
}
...
...
@@ -154,5 +161,10 @@ void P15CardWidget::setCard(const P15Card *card)
}
}
const
bool
cardHasOpenPGPKeys
=
!
card
->
keyFingerprint
(
OpenPGPCard
::
pgpSigKeyRef
()).
empty
()
||
!
card
->
keyFingerprint
(
OpenPGPCard
::
pgpEncKeyRef
()).
empty
();
mOpenPGPKeysSection
->
setVisible
(
cardHasOpenPGPKeys
);
if
(
cardHasOpenPGPKeys
)
{
mOpenPGPKeysWidget
->
update
(
card
);
}
}
src/view/p15cardwidget.h
View file @
e7a526cc
...
...
@@ -40,6 +40,7 @@ private:
QLabel
*
mSerialNumber
=
nullptr
;
QLabel
*
mVersionLabel
=
nullptr
;
QLabel
*
mStatusLabel
=
nullptr
;
QWidget
*
mOpenPGPKeysSection
=
nullptr
;
OpenPGPKeyCardWidget
*
mOpenPGPKeysWidget
=
nullptr
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment