From f042739d3a2ed23a90441a81782e4c3ac6ffb1c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Wed, 28 Oct 2020 17:02:22 +0100 Subject: [PATCH] qt: Add support for revoke signature quick command * lang/qt/src/quickjob.h (QuickJob::startRevokeSignature): New. * lang/qt/src/qgpgmequickjob.h, lang/qt/src/qgpgmequickjob.cpp (QGpgMEQuickJob::startRevokeSignature): New. * lang/qt/src/qgpgmequickjob.cpp (revokeSignatureWorker): New. -- GnuPG-bug-id: 5094 --- NEWS | 3 +++ lang/qt/src/qgpgmequickjob.cpp | 24 ++++++++++++++++++++++-- lang/qt/src/qgpgmequickjob.h | 5 +++++ lang/qt/src/quickjob.h | 11 +++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 87c19b09..d05f3dbe 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ Noteworthy changes in version 1.14.1 (unreleased) * qt: Extended ChangeExpiryJob to support changing the expiry of subkeys. [#4717] + * qt: Extended QuickJob to support revoking of key signatures. [#5094] + * qt: Added QDebug stream operator for GpgME::Error. * Interface changes relative to the 1.14.0 release: @@ -34,6 +36,7 @@ Noteworthy changes in version 1.14.1 (unreleased) cpp: Context::revokeSignature NEW. cpp: Context::startRevokeSignature NEW. qt: operator<<(QDebug debug, const GpgME::Error &err) NEW. + qt: QuickJob::startRevokeSignature NEW. Noteworthy changes in version 1.14.0 (2020-07-16) diff --git a/lang/qt/src/qgpgmequickjob.cpp b/lang/qt/src/qgpgmequickjob.cpp index 93027d94..e29be913 100644 --- a/lang/qt/src/qgpgmequickjob.cpp +++ b/lang/qt/src/qgpgmequickjob.cpp @@ -1,6 +1,9 @@ -/* qgpgmequickjob.cpp +/* qgpgmequickjob.cpp + This file is part of qgpgme, the Qt API binding for gpgme Copyright (c) 2017 Intevation GmbH + Copyright (c) 2020 g10 Code GmbH + Software engineering by Ingo Klöcker QGpgME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -47,7 +50,9 @@ QGpgMEQuickJob::QGpgMEQuickJob(Context *context) lateInitialization(); } -QGpgMEQuickJob::~QGpgMEQuickJob() {} +QGpgMEQuickJob::~QGpgMEQuickJob() +{ +} static QGpgMEQuickJob::result_type createWorker(GpgME::Context *ctx, const QString &uid, @@ -93,6 +98,15 @@ static QGpgMEQuickJob::result_type revUidWorker(GpgME::Context *ctx, return std::make_tuple(err, QString(), Error()); } +static QGpgMEQuickJob::result_type revokeSignatureWorker(Context *ctx, + const Key &key, + const Key &signingKey, + const std::vector &userIds) +{ + const auto err = ctx->revokeSignature(key, signingKey, userIds); + return std::make_tuple(err, QString(), Error()); +} + void QGpgMEQuickJob::startCreate(const QString &uid, const char *algo, const QDateTime &expires, @@ -120,4 +134,10 @@ void QGpgMEQuickJob::startAddSubkey(const GpgME::Key &key, const char *algo, run(std::bind(&addSubkeyWorker, std::placeholders::_1, key, algo, expires, flags)); } + +void QGpgMEQuickJob::startRevokeSignature(const Key &key, const Key &signingKey, const std::vector &userIds) +{ + run(std::bind(&revokeSignatureWorker, std::placeholders::_1, key, signingKey, userIds)); +} + #include "qgpgmequickjob.moc" diff --git a/lang/qt/src/qgpgmequickjob.h b/lang/qt/src/qgpgmequickjob.h index 59181547..b4e2dfa9 100644 --- a/lang/qt/src/qgpgmequickjob.h +++ b/lang/qt/src/qgpgmequickjob.h @@ -1,6 +1,9 @@ /* qgpgmequickjob.h + This file is part of qgpgme, the Qt API binding for gpgme Copyright (c) 2017 Intevation GmbH + Copyright (c) 2020 g10 Code GmbH + Software engineering by Ingo Klöcker QGpgME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -66,6 +69,8 @@ public: void startAddSubkey(const GpgME::Key &key, const char *algo, const QDateTime &expires = QDateTime(), unsigned int flags = 0) Q_DECL_OVERRIDE; + void startRevokeSignature(const GpgME::Key &key, const GpgME::Key &signingKey, + const std::vector &userIds = std::vector()) Q_DECL_OVERRIDE; }; } diff --git a/lang/qt/src/quickjob.h b/lang/qt/src/quickjob.h index c0a655b7..82c9d89d 100644 --- a/lang/qt/src/quickjob.h +++ b/lang/qt/src/quickjob.h @@ -1,6 +1,9 @@ /* quickjob.h + This file is part of qgpgme, the Qt API binding for gpgme Copyright (c) 2017 Intevation GmbH + Copyright (c) 2020 g10 Code GmbH + Software engineering by Ingo Klöcker QGpgME is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -74,6 +77,14 @@ public: const QDateTime &expires = QDateTime(), unsigned int flags = 0) = 0; + /** + Starts the operation to revoke the signatures made with the key \a signingKey on the + user IDs \a userIds of the key \a key. If \a userIds is an empty list, then all + signatures made with \a signingKey on the user IDs of \a key will be revoked. + */ + virtual void startRevokeSignature(const GpgME::Key &key, const GpgME::Key &signingKey, + const std::vector &userIds = std::vector()) = 0; + Q_SIGNALS: void result(const GpgME::Error &error, const QString &auditLogAsHtml, const GpgME::Error &auditLogError);