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
c7e4cd81
Commit
c7e4cd81
authored
Nov 15, 2021
by
Ingo Klöcker
Browse files
Use new helpers for writing/reading key groups to/from a file
GnuPG-bug-id: 5638
parent
928e7a25
Pipeline
#97886
failed with stage
in 9 minutes and 30 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
c7e4cd81
...
...
@@ -30,7 +30,7 @@ option(DISABLE_KWATCHGNUPG "Don't build the kwatchgnupg tool [default=OFF]" OFF)
# Standalone build. Find / include everything necessary.
set
(
KF5_MIN_VERSION
"5.88.0"
)
set
(
KMIME_VERSION
"5.19.40"
)
set
(
LIBKLEO_VERSION
"5.19.4
1
"
)
set
(
LIBKLEO_VERSION
"5.19.4
2
"
)
set
(
QT_REQUIRED_VERSION
"5.15.2"
)
set
(
GPGME_REQUIRED_VERSION
"1.13.1"
)
set
(
BOOST_REQUIRED_VERSION
"1.58"
)
...
...
src/commands/exportgroupscommand.cpp
View file @
c7e4cd81
...
...
@@ -17,7 +17,7 @@
#include <Libkleo/Algorithm>
#include <Libkleo/KeyGroup>
#include <Libkleo/KeyGroup
Config
>
#include <Libkleo/KeyGroup
ImportExport
>
#include <Libkleo/KeyHelpers>
#include <KConfigGroup>
...
...
@@ -104,7 +104,7 @@ public:
void
start
();
void
exportGroups
();
bool
exportGroups
();
bool
startExportJob
(
GpgME
::
Protocol
protocol
,
const
std
::
vector
<
Key
>
&
keys
);
void
onExportJobResult
(
const
QGpgME
::
Job
*
job
,
const
GpgME
::
Error
&
err
,
const
QByteArray
&
keyData
);
...
...
@@ -176,7 +176,10 @@ void ExportGroupsCommand::Private::start()
finished
();
return
;
}
exportGroups
();
if
(
!
exportGroups
())
{
finished
();
return
;
}
if
(
!
openpgpKeys
.
empty
())
{
if
(
!
startExportJob
(
GpgME
::
OpenPGP
,
openpgpKeys
))
{
finished
();
...
...
@@ -190,10 +193,14 @@ void ExportGroupsCommand::Private::start()
}
}
void
ExportGroupsCommand
::
Private
::
exportGroups
()
bool
ExportGroupsCommand
::
Private
::
exportGroups
()
{
KeyGroupConfig
config
{
filename
};
config
.
writeGroups
(
groups
);
const
auto
result
=
writeKeyGroups
(
filename
,
groups
);
if
(
result
!=
WriteKeyGroups
::
Success
)
{
error
(
xi18n
(
"Writing groups to file <filename>%1</filename> failed."
,
filename
),
i18nc
(
"@title:window"
,
"Export Failed"
));
}
return
result
==
WriteKeyGroups
::
Success
;
}
bool
ExportGroupsCommand
::
Private
::
startExportJob
(
GpgME
::
Protocol
protocol
,
const
std
::
vector
<
Key
>
&
keys
)
...
...
src/commands/importcertificatescommand.cpp
View file @
c7e4cd81
...
...
@@ -23,7 +23,7 @@
#include <Libkleo/KeyList>
#include <Libkleo/KeyListSortFilterProxyModel>
#include <Libkleo/KeyCache>
#include <Libkleo/KeyGroup
Config
>
#include <Libkleo/KeyGroup
ImportExport
>
#include <Libkleo/Predicates>
#include <Libkleo/Formatting>
#include <Libkleo/Stl_Util>
...
...
@@ -653,8 +653,7 @@ void ImportCertificatesCommand::Private::importGroups()
});
if
(
certificateImportSucceeded
)
{
qCDebug
(
KLEOPATRA_LOG
)
<<
__func__
<<
"Importing groups from file"
<<
path
;
const
KeyGroupConfig
config
{
path
};
const
auto
groups
=
config
.
readGroups
();
const
auto
groups
=
readKeyGroups
(
path
);
std
::
transform
(
std
::
begin
(
groups
),
std
::
end
(
groups
),
std
::
back_inserter
(
importedGroups
),
[
path
](
const
auto
&
group
)
{
...
...
Write
Preview
Markdown
is supported
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