From ca1c30b6fa29a7a1f18ecda14375b47893a0c1a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Wed, 2 Feb 2022 11:53:29 +0100 Subject: qt: Add job to import keys given by key ids * lang/qt/src/receivekeysjob.h, lang/qt/src/qgpgmereceivekeysjob.h, lang/qt/src/qgpgmereceivekeysjob.cpp: New. * lang/qt/src/protocol.h (class Protocol): Add pure virtual member function receiveKeysJob. * lang/qt/src/protocol_p.h (Protocol::receiveKeysJob): Implement it. * lang/qt/src/job.cpp, lang/qt/src/Makefile.am: Update accordingly. * lang/qt/tests/run-receivekeysjob.cpp: New. * lang/qt/tests/Makefile.am: Add new test runner. -- This job allows importing keys that are given by their key ids (or fingerprints) from keyservers as with gpg's recv-keys command. GnuPG-bug-id: 5808 --- lang/qt/src/protocol_p.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lang/qt/src/protocol_p.h') diff --git a/lang/qt/src/protocol_p.h b/lang/qt/src/protocol_p.h index a9cfd824..4211e001 100644 --- a/lang/qt/src/protocol_p.h +++ b/lang/qt/src/protocol_p.h @@ -64,6 +64,7 @@ #include "qgpgmewkspublishjob.h" #include "qgpgmetofupolicyjob.h" #include "qgpgmequickjob.h" +#include "qgpgmereceivekeysjob.h" namespace { @@ -233,6 +234,19 @@ public: return new QGpgME::QGpgMEImportFromKeyserverJob(context); } + QGpgME::ReceiveKeysJob *receiveKeysJob() const override + { + if (mProtocol != GpgME::OpenPGP) { + return nullptr; + } + + GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol); + if (!context) { + return nullptr; + } + return new QGpgME::QGpgMEReceiveKeysJob{context}; + } + QGpgME::ExportJob *publicKeyExportJob(bool armor) const Q_DECL_OVERRIDE { GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol); -- cgit v1.2.3