From ed7e7df2e14feb443e84d87e518ff61b1f7aa6d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Mon, 13 Dec 2021 10:48:52 +0100 Subject: qt: Support WKD lookup without implicit import * lang/qt/src/Makefile.am (qgpgme_sources): Add qgpgmewkdlookupjob.cpp, wkdlookupresult.cpp. (qgpgme_headers): Add wkdlookupjob.h, wkdlookupresult.h. (camelcase_headers): Add WKDLookupJob, WKDLookupResult. (private_qgpgme_headers): Add qgpgmewkdlookupjob.h. (qgpgme_moc_sources): Add qgpgmewkdlookupjob.moc, wkdlookupjob.moc. * lang/qt/src/job.cpp: Define c'tor and d'tor of WKDLookupJob. * lang/qt/src/protocol.h (Protocol::wkdLookupJob): New. * lang/qt/src/protocol_p.h (Protocol::wkdLookupJob): New. * lang/qt/src/qgpgmewkdlookupjob.cpp, lang/qt/src/qgpgmewkdlookupjob.h, lang/qt/src/wkdlookupjob.h, lang/qt/src/wkdlookupresult.cpp, lang/qt/src/wkdlookupresult.h: New. * lang/qt/tests/Makefile.am (EXTRA_DIST): Add final.test. (the_tests): New. (TESTS): Remove all t-*. Add $(the_tests) and final.test. (moc_files): Add t-wkdlookup.moc. (t_wkdlookup_SOURCES): New. (noinst_PROGRAMS): Add t-wkdlookup. * lang/qt/tests/final.test: New. * lang/qt/tests/t-support.h (QTest::toString): New template specialization for std::string. * lang/qt/tests/t-wkdlookup.cpp: New. -- The new WKDLookupJob allows running a WKD lookup without implicit import of the retrieved key. This makes it possible to do WKD lookups similar to keyserver lookups (aka external keylistings). The new final.test pseudo test stops a dirmngr that may have been started by the tests. The toString() template specialization enables printing of the actual and expected values in case of failed QCOMPARE. GnuPG-bug-id: 5728 --- lang/qt/src/protocol_p.h | 13 +++++++++++++ 1 file changed, 13 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 57c1ed81..da5ce011 100644 --- a/lang/qt/src/protocol_p.h +++ b/lang/qt/src/protocol_p.h @@ -58,6 +58,7 @@ #include "qgpgmechangepasswdjob.h" #include "qgpgmeadduseridjob.h" #include "qgpgmekeyformailboxjob.h" +#include "qgpgmewkdlookupjob.h" #include "qgpgmewkspublishjob.h" #include "qgpgmetofupolicyjob.h" #include "qgpgmequickjob.h" @@ -392,6 +393,18 @@ public: return new QGpgME::QGpgMEKeyForMailboxJob(context); } + QGpgME::WKDLookupJob *wkdLookupJob() const Q_DECL_OVERRIDE + { + if (mProtocol != GpgME::OpenPGP) { + return nullptr; + } + auto context = GpgME::Context::createForEngine(GpgME::AssuanEngine); + if (!context) { + return nullptr; + } + return new QGpgME::QGpgMEWKDLookupJob(context.release()); + } + QGpgME::WKSPublishJob *wksPublishJob() const Q_DECL_OVERRIDE { if (mProtocol != GpgME::OpenPGP) { -- cgit v1.2.3