Skip to content
GitLab
Menu
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
5fc494bc
Commit
5fc494bc
authored
Jan 14, 2021
by
Ingo Klöcker
Browse files
Add support for groups of keys to SignEncryptWidget
GnuPG-bug-id: 5175, 5241, 5249
parent
810d9223
Pipeline
#48183
failed with stage
in 12 minutes and 7 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
5fc494bc
...
...
@@ -11,6 +11,7 @@ endif()
option
(
FORCE_DISABLE_KCMUTILS
"Force building Kleopatra without KCMUtils. Doing this will disable configuration KCM Plugins. [default=OFF]"
OFF
)
option
(
DISABLE_KWATCHGNUPG
"Don't build the kwatchgnupg tool [default=OFF]"
OFF
)
option
(
ENABLE_GROUP_SUPPORT
"Enable experimental support for groups of keys [default=OFF]"
OFF
)
# Standalone build. Find / include everything necessary.
set
(
KF5_MIN_VERSION
"5.78.0"
)
...
...
@@ -145,6 +146,11 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif
()
add_definitions
(
-DQT_NO_EMIT
)
if
(
ENABLE_GROUP_SUPPORT
)
message
(
STATUS
"Enabling experimental group support"
)
add_definitions
(
-DGROUP_SUPPORT
)
endif
()
kde_enable_exceptions
()
option
(
USE_UNITY_CMAKE_SUPPORT
"Use UNITY cmake support (speedup compile time)"
FALSE
)
...
...
src/crypto/gui/signencryptwidget.cpp
View file @
5fc494bc
...
...
@@ -23,6 +23,7 @@
#include <Libkleo/DefaultKeyFilter>
#include <Libkleo/KeyCache>
#include <Libkleo/KeyGroup>
#include <Libkleo/KeyListModel>
#include <Libkleo/KeySelectionCombo>
#include <Libkleo/KeyListSortFilterProxyModel>
...
...
@@ -94,7 +95,11 @@ SignEncryptWidget::SignEncryptWidget(QWidget *parent, bool sigEncExclusive)
QVBoxLayout
*
lay
=
new
QVBoxLayout
(
this
);
lay
->
setContentsMargins
(
0
,
0
,
0
,
0
);
mModel
->
useKeyCache
(
true
,
false
);
#ifdef GROUP_SUPPORT
mModel
->
useKeyCache
(
true
,
KeyList
::
IncludeGroups
);
#else
mModel
->
useKeyCache
(
true
,
KeyList
::
AllKeys
);
#endif
/* The signature selection */
QHBoxLayout
*
sigLay
=
new
QHBoxLayout
;
...
...
@@ -302,7 +307,7 @@ void SignEncryptWidget::recipientsChanged()
{
bool
oneEmpty
=
false
;
for
(
const
CertificateLineEdit
*
w
:
qAsConst
(
mRecpWidgets
))
{
if
(
w
->
key
().
isNull
())
{
if
(
w
->
key
().
isNull
()
&&
w
->
group
().
isNull
()
)
{
oneEmpty
=
true
;
break
;
}
...
...
@@ -338,8 +343,12 @@ QVector <Key> SignEncryptWidget::recipients() const
break
;
}
const
Key
k
=
w
->
key
();
const
KeyGroup
g
=
w
->
group
();
if
(
!
k
.
isNull
())
{
ret
<<
k
;
}
else
if
(
!
g
.
isNull
())
{
const
auto
keys
=
g
.
keys
();
std
::
copy
(
keys
.
begin
(),
keys
.
end
(),
std
::
back_inserter
(
ret
));
}
}
const
Key
k
=
selfKey
();
...
...
@@ -510,7 +519,7 @@ void SignEncryptWidget::setProtocol(GpgME::Protocol proto)
bool
SignEncryptWidget
::
validate
()
{
for
(
const
auto
edit
:
qAsConst
(
mRecpWidgets
))
{
if
(
!
edit
->
isEmpty
()
&&
edit
->
key
().
isNull
())
{
if
(
!
edit
->
isEmpty
()
&&
edit
->
key
().
isNull
()
&&
edit
->
group
().
isNull
()
)
{
KMessageBox
::
error
(
this
,
i18nc
(
"%1 is user input that could not be found"
,
"Could not find a key for '%1'"
,
edit
->
text
().
toHtmlEscaped
()),
i18n
(
"Failed to find recipient"
),
KMessageBox
::
Notify
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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