Messagelib

qgpgmejobexecutor.h
1 /*
2  SPDX-FileCopyrightText: 2008 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <gpgme++/decryptionresult.h>
10 #include <gpgme++/importresult.h>
11 #include <gpgme++/verificationresult.h>
12 
13 #include <QObject>
14 
15 #include <utility>
16 
17 class QEventLoop;
18 
19 namespace QGpgME
20 {
21 class DecryptVerifyJob;
22 class ImportJob;
23 class VerifyDetachedJob;
24 class VerifyOpaqueJob;
25 }
26 
27 namespace MimeTreeParser
28 {
29 /**
30  Helper class for synchronous execution of Kleo crypto jobs.
31 */
32 class QGpgMEJobExecutor : public QObject
33 {
34  Q_OBJECT
35 public:
36  explicit QGpgMEJobExecutor(QObject *parent = nullptr);
37 
38  GpgME::VerificationResult exec(QGpgME::VerifyDetachedJob *job, const QByteArray &signature, const QByteArray &signedData);
39  GpgME::VerificationResult exec(QGpgME::VerifyOpaqueJob *job, const QByteArray &signedData, QByteArray &plainText);
40  std::pair<GpgME::DecryptionResult, GpgME::VerificationResult> exec(QGpgME::DecryptVerifyJob *job, const QByteArray &cipherText, QByteArray &plainText);
41  GpgME::ImportResult exec(QGpgME::ImportJob *job, const QByteArray &certData);
42 
43  Q_REQUIRED_RESULT GpgME::Error auditLogError() const;
44  Q_REQUIRED_RESULT QString auditLogAsHtml() const;
45 
46 private Q_SLOTS:
47  void verificationResult(const GpgME::VerificationResult &result);
48  void verificationResult(const GpgME::VerificationResult &result, const QByteArray &plainText);
49  void decryptResult(const GpgME::DecryptionResult &decryptionresult, const GpgME::VerificationResult &verificationresult, const QByteArray &plainText);
50  void importResult(const GpgME::ImportResult &result);
51 
52 private:
53  QEventLoop *const mEventLoop;
54  GpgME::VerificationResult mVerificationResult;
55  GpgME::DecryptionResult mDecryptResult;
56  GpgME::ImportResult mImportResult;
57  QByteArray mData;
58  GpgME::Error mAuditLogError;
59  QString mAuditLog;
60 };
61 }
62 
Helper class for synchronous execution of Kleo crypto jobs.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Nov 26 2021 23:16:43 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.