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
This commit is contained in:
Ingo Klöcker 2020-10-28 17:02:22 +01:00
parent 60328c4690
commit f042739d3a
4 changed files with 41 additions and 2 deletions

3
NEWS
View File

@ -14,6 +14,8 @@ Noteworthy changes in version 1.14.1 (unreleased)
* qt: Extended ChangeExpiryJob to support changing the expiry of * qt: Extended ChangeExpiryJob to support changing the expiry of
subkeys. [#4717] subkeys. [#4717]
* qt: Extended QuickJob to support revoking of key signatures. [#5094]
* qt: Added QDebug stream operator for GpgME::Error. * qt: Added QDebug stream operator for GpgME::Error.
* Interface changes relative to the 1.14.0 release: * 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::revokeSignature NEW.
cpp: Context::startRevokeSignature NEW. cpp: Context::startRevokeSignature NEW.
qt: operator<<(QDebug debug, const GpgME::Error &err) NEW. qt: operator<<(QDebug debug, const GpgME::Error &err) NEW.
qt: QuickJob::startRevokeSignature NEW.
Noteworthy changes in version 1.14.0 (2020-07-16) Noteworthy changes in version 1.14.0 (2020-07-16)

View File

@ -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) 2017 Intevation GmbH
Copyright (c) 2020 g10 Code GmbH
Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
QGpgME is free software; you can redistribute it and/or QGpgME is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@ -47,7 +50,9 @@ QGpgMEQuickJob::QGpgMEQuickJob(Context *context)
lateInitialization(); lateInitialization();
} }
QGpgMEQuickJob::~QGpgMEQuickJob() {} QGpgMEQuickJob::~QGpgMEQuickJob()
{
}
static QGpgMEQuickJob::result_type createWorker(GpgME::Context *ctx, static QGpgMEQuickJob::result_type createWorker(GpgME::Context *ctx,
const QString &uid, const QString &uid,
@ -93,6 +98,15 @@ static QGpgMEQuickJob::result_type revUidWorker(GpgME::Context *ctx,
return std::make_tuple(err, QString(), Error()); return std::make_tuple(err, QString(), Error());
} }
static QGpgMEQuickJob::result_type revokeSignatureWorker(Context *ctx,
const Key &key,
const Key &signingKey,
const std::vector<UserID> &userIds)
{
const auto err = ctx->revokeSignature(key, signingKey, userIds);
return std::make_tuple(err, QString(), Error());
}
void QGpgMEQuickJob::startCreate(const QString &uid, void QGpgMEQuickJob::startCreate(const QString &uid,
const char *algo, const char *algo,
const QDateTime &expires, 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, run(std::bind(&addSubkeyWorker, std::placeholders::_1, key, algo,
expires, flags)); expires, flags));
} }
void QGpgMEQuickJob::startRevokeSignature(const Key &key, const Key &signingKey, const std::vector<UserID> &userIds)
{
run(std::bind(&revokeSignatureWorker, std::placeholders::_1, key, signingKey, userIds));
}
#include "qgpgmequickjob.moc" #include "qgpgmequickjob.moc"

View File

@ -1,6 +1,9 @@
/* qgpgmequickjob.h /* qgpgmequickjob.h
This file is part of qgpgme, the Qt API binding for gpgme
Copyright (c) 2017 Intevation GmbH Copyright (c) 2017 Intevation GmbH
Copyright (c) 2020 g10 Code GmbH
Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
QGpgME is free software; you can redistribute it and/or QGpgME is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as 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, void startAddSubkey(const GpgME::Key &key, const char *algo,
const QDateTime &expires = QDateTime(), const QDateTime &expires = QDateTime(),
unsigned int flags = 0) Q_DECL_OVERRIDE; unsigned int flags = 0) Q_DECL_OVERRIDE;
void startRevokeSignature(const GpgME::Key &key, const GpgME::Key &signingKey,
const std::vector<GpgME::UserID> &userIds = std::vector<GpgME::UserID>()) Q_DECL_OVERRIDE;
}; };
} }

View File

@ -1,6 +1,9 @@
/* quickjob.h /* quickjob.h
This file is part of qgpgme, the Qt API binding for gpgme
Copyright (c) 2017 Intevation GmbH Copyright (c) 2017 Intevation GmbH
Copyright (c) 2020 g10 Code GmbH
Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
QGpgME is free software; you can redistribute it and/or QGpgME is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@ -74,6 +77,14 @@ public:
const QDateTime &expires = QDateTime(), const QDateTime &expires = QDateTime(),
unsigned int flags = 0) = 0; 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<GpgME::UserID> &userIds = std::vector<GpgME::UserID>()) = 0;
Q_SIGNALS: Q_SIGNALS:
void result(const GpgME::Error &error, void result(const GpgME::Error &error,
const QString &auditLogAsHtml, const GpgME::Error &auditLogError); const QString &auditLogAsHtml, const GpgME::Error &auditLogError);