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
c8e8f96b
Verified
Commit
c8e8f96b
authored
Sep 13, 2022
by
Ingo Klöcker
Committed by
Ingo Klöcker
Sep 13, 2022
Browse files
Disable or hide actions that make no sense for remote keys
GnuPG-bug-id: 6201
parent
6bdbc147
Changes
2
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
c8e8f96b
...
...
@@ -34,7 +34,7 @@ set(KF5_MIN_VERSION "5.98.0")
set
(
KIDENTITYMANAGEMENT_VERSION
"5.21.40"
)
set
(
KMAILTRANSPORT_VERSION
"5.21.40"
)
set
(
KMIME_VERSION
"5.21.40"
)
set
(
LIBKLEO_VERSION
"5.21.4
8
"
)
set
(
LIBKLEO_VERSION
"5.21.4
9
"
)
set
(
QT_REQUIRED_VERSION
"5.15.2"
)
set
(
GPGME_REQUIRED_VERSION
"1.16.0"
)
...
...
src/dialogs/certificatedetailswidget.cpp
View file @
c8e8f96b
...
...
@@ -45,6 +45,7 @@
#include
<Libkleo/Formatting>
#include
<Libkleo/Dn>
#include
<Libkleo/KeyCache>
#include
<Libkleo/KeyHelpers>
#include
<Libkleo/GnuPG>
#include
<Libkleo/NavigatableTreeWidget>
...
...
@@ -431,6 +432,7 @@ void CertificateDetailsWidget::Private::setupCommonProperties()
const
bool
isOpenPGP
=
key
.
protocol
()
==
GpgME
::
OpenPGP
;
const
bool
isSMIME
=
key
.
protocol
()
==
GpgME
::
CMS
;
const
bool
isOwnKey
=
key
.
hasSecret
();
const
auto
isLocalKey
=
!
isRemoteKey
(
key
);
// update visibility of UI elements
ui
.
userIDs
->
setVisible
(
isOpenPGP
);
...
...
@@ -464,19 +466,20 @@ void CertificateDetailsWidget::Private::setupCommonProperties()
ui
.
smimeRelatedAddresses
->
setVisible
(
isSMIME
);
ui
.
smimeAddressList
->
setVisible
(
isSMIME
);
//
ui.moreDetailsBtn->setVisible(
true); // always visible
ui
.
moreDetailsBtn
->
setVisible
(
isLocalKey
);
ui
.
trustChainDetailsBtn
->
setVisible
(
isSMIME
);
//
ui.refreshBtn->setVisible(
true); // always visible
ui
.
refreshBtn
->
setVisible
(
isLocalKey
);
ui
.
changePassphraseBtn
->
setVisible
(
isSecretKeyStoredInKeyRing
(
key
));
//
ui.exportBtn->setVisible(
true); // always visible
ui
.
exportBtn
->
setVisible
(
isLocalKey
);
ui
.
genRevokeBtn
->
setVisible
(
isOpenPGP
&&
isOwnKey
);
// update availability of buttons
const
auto
userCanSignUserIDs
=
userHasCertificationKey
();
ui
.
addUserIDBtn
->
setEnabled
(
canBeUsedForSecretKeyOperations
(
key
));
ui
.
setPrimaryUserIDBtn
->
setEnabled
(
false
);
// requires a selected user ID
ui
.
certifyBtn
->
setEnabled
(
userCanSignUserIDs
);
ui
.
revokeCertificationsBtn
->
setEnabled
(
userCanSignUserIDs
);
ui
.
certifyBtn
->
setEnabled
(
userCanSignUserIDs
&&
isLocalKey
);
ui
.
webOfTrustBtn
->
setEnabled
(
isLocalKey
);
ui
.
revokeCertificationsBtn
->
setEnabled
(
userCanSignUserIDs
&&
isLocalKey
);
ui
.
revokeUserIDBtn
->
setEnabled
(
false
);
// requires a selected user ID
ui
.
changeExpirationAction
->
setEnabled
(
canBeUsedForSecretKeyOperations
(
key
));
ui
.
changePassphraseBtn
->
setEnabled
(
isSecretKeyStoredInKeyRing
(
key
));
...
...
@@ -802,6 +805,7 @@ void CertificateDetailsWidget::Private::userIDTableContextMenuRequested(const QP
const
bool
isPrimaryUserID
=
!
singleUserID
.
isNull
()
&&
(
ui
.
userIDTable
->
selectedItems
().
front
()
==
ui
.
userIDTable
->
topLevelItem
(
0
));
#endif
const
bool
canSignUserIDs
=
userHasCertificationKey
();
const
auto
isLocalKey
=
!
isRemoteKey
(
key
);
auto
menu
=
new
QMenu
(
q
);
#ifdef QGPGME_SUPPORTS_SET_PRIMARY_UID
...
...
@@ -825,7 +829,7 @@ void CertificateDetailsWidget::Private::userIDTableContextMenuRequested(const QP
q
,
[
this
]()
{
certifyUserIDs
();
});
action
->
setEnabled
(
canSignUserIDs
);
action
->
setEnabled
(
isLocalKey
&&
canSignUserIDs
);
}
if
(
Kleo
::
Commands
::
RevokeCertificationCommand
::
isSupported
())
{
const
auto
actionText
=
userIDs
.
empty
()
?
i18nc
(
"@action:inmenu"
,
"Revoke Certifications..."
)
...
...
@@ -835,7 +839,7 @@ void CertificateDetailsWidget::Private::userIDTableContextMenuRequested(const QP
q
,
[
this
]()
{
revokeCertifications
();
});
action
->
setEnabled
(
canSignUserIDs
);
action
->
setEnabled
(
isLocalKey
&&
canSignUserIDs
);
}
#ifdef MAILAKONADI_ENABLED
if
(
key
.
hasSecret
())
{
...
...
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