diff options
author | Ingo Klöcker <[email protected]> | 2022-01-04 14:38:49 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2022-01-04 14:44:16 +0000 |
commit | 4e80563fabfdf1d1c136d65252e5353fdd1e9092 (patch) | |
tree | f1edc3ecd890387f94e2bb5ef4b14b88f4394906 /lang/qt/src/protocol_p.h | |
parent | cpp: Allow export of secret keys (diff) | |
download | gpgme-4e80563fabfdf1d1c136d65252e5353fdd1e9092.tar.gz gpgme-4e80563fabfdf1d1c136d65252e5353fdd1e9092.zip |
qt: Use QGpgMEExportJob also for export of secret keys
* lang/qt/src/protocol.h (Protocol::secretKeyExportJob): Document
charset argument as ignored.
* lang/qt/src/protocol_p.h (Protocol::secretKeyExportJob): Use
QGpgMEExportJob instead of QGpgMESecretKeyExportJob.
* lang/qt/src/qgpgmeexportjob.h (class QGpgMEExportJob): Add c'tor
taking an export mode. Add member m_exportMode. Rename member m_flags to
m_additionalExportModeFlags.
(QGpgMEExportJob::~QGpgMEExportJob): Mark as override.
* lang/qt/src/qgpgmeexportjob.cpp (QGpgMEExportJob::QGpgMEExportJob):
Delegate to new c'tor. Implement new c'tor.
(QGpgMEExportJob::~QGpgMEExportJob): Use default.
(export_qba): Rename argument flags to mode.
(QGpgMEExportJob::start): Pass combination of export mode and additional
mode flags to export_qba.
(QGpgMEExportJob::setExportFlags): Adapt to renaming of member.
* lang/qt/tests/run-exportjob.cpp: New.
--
This change makes it possible to export secret OpenPGP keys.
GnuPG-bug-id: 5757
Diffstat (limited to 'lang/qt/src/protocol_p.h')
-rw-r--r-- | lang/qt/src/protocol_p.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lang/qt/src/protocol_p.h b/lang/qt/src/protocol_p.h index da5ce011..054fec6e 100644 --- a/lang/qt/src/protocol_p.h +++ b/lang/qt/src/protocol_p.h @@ -5,6 +5,8 @@ Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik Software engineering by Intevation GmbH + Copyright (c) 2022 by g10 Code GmbH + Software engineering by Ingo Klöcker <[email protected]> QGpgME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -42,7 +44,6 @@ #include "qgpgmedecryptverifyjob.h" #include "qgpgmerefreshkeysjob.h" #include "qgpgmedeletejob.h" -#include "qgpgmesecretkeyexportjob.h" #include "qgpgmedownloadjob.h" #include "qgpgmesignencryptjob.h" #include "qgpgmeencryptjob.h" @@ -242,14 +243,15 @@ public: return new QGpgME::QGpgMEExportJob(context); } - QGpgME::ExportJob *secretKeyExportJob(bool armor, const QString &charset) const Q_DECL_OVERRIDE + QGpgME::ExportJob *secretKeyExportJob(bool armor, const QString &) const Q_DECL_OVERRIDE { - if (mProtocol != GpgME::CMS) { // fixme: add support for gpg, too + GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol); + if (!context) { return nullptr; } - // this operation is not supported by gpgme, so we have to call gpgsm ourselves: - return new QGpgME::QGpgMESecretKeyExportJob(armor, charset); + context->setArmor(armor); + return new QGpgME::QGpgMEExportJob(context, GpgME::Context::ExportSecret); } QGpgME::RefreshKeysJob *refreshKeysJob() const Q_DECL_OVERRIDE |