QGpgME  8.1.0.0
Qt API for GpgME
qgpgmesignencryptjob.h
1 /*
2  qgpgmesignencryptjob.h
3 
4  This file is part of qgpgme, the Qt API binding for gpgme
5  Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
6  Copyright (c) 2016 Intevation GmbH
7 
8  QGpgME is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version.
12 
13  QGpgME is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22  In addition, as a special exception, the copyright holders give
23  permission to link the code of this program with any edition of
24  the Qt library by Trolltech AS, Norway (or with modified versions
25  of Qt that use the same license as Qt), and distribute linked
26  combinations including the two. You must obey the GNU General
27  Public License in all respects for all of the code used other than
28  Qt. If you modify this file, you may extend this exception to
29  your version of the file, but you are not obligated to do so. If
30  you do not wish to do so, delete this exception statement from
31  your version.
32 */
33 
34 #ifndef __QGPGME_QGPGMESIGNENCRYPTJOB_H__
35 #define __QGPGME_QGPGMESIGNENCRYPTJOB_H__
36 
37 #include "signencryptjob.h"
38 
39 #include "threadedjobmixin.h"
40 
41 #ifdef BUILDING_QGPGME
42 # include "signingresult.h"
43 #else
44 #include <gpgme++/signingresult.h>
45 #endif
46 #ifdef BUILDING_QGPGME
47 # include "encryptionresult.h"
48 #else
49 #include <gpgme++/encryptionresult.h>
50 #endif
51 #ifdef BUILDING_QGPGME
52 # include "key.h"
53 #else
54 #include <gpgme++/key.h>
55 #endif
56 
57 #include <utility>
58 
59 namespace QGpgME
60 {
61 
63 #ifdef Q_MOC_RUN
64  : public SignEncryptJob
65 #else
66  : public _detail::ThreadedJobMixin<SignEncryptJob, std::tuple<GpgME::SigningResult, GpgME::EncryptionResult, QByteArray, QString, GpgME::Error> >
67 #endif
68 {
69  Q_OBJECT
70 #ifdef Q_MOC_RUN
71 public Q_SLOTS:
72  void slotFinished();
73 #endif
74 public:
75  explicit QGpgMESignEncryptJob(GpgME::Context *context);
77 
78  /* from SignEncryptJob */
79  GpgME::Error start(const std::vector<GpgME::Key> &signers,
80  const std::vector<GpgME::Key> &recipients,
81  const QByteArray &plainText, bool alwaysTrust) Q_DECL_OVERRIDE;
82 
83  /* from SignEncryptJob */
84  void start(const std::vector<GpgME::Key> &signers,
85  const std::vector<GpgME::Key> &recipients,
86  const std::shared_ptr<QIODevice> &plainText,
87  const std::shared_ptr<QIODevice> &cipherText,
88  bool alwaysTrust) Q_DECL_OVERRIDE;
89 
90  void start(const std::vector<GpgME::Key> &signers,
91  const std::vector<GpgME::Key> &recipients,
92  const std::shared_ptr<QIODevice> &plainText,
93  const std::shared_ptr<QIODevice> &cipherText,
94  const GpgME::Context::EncryptionFlags flags) Q_DECL_OVERRIDE;
95 
96  std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
97  exec(const std::vector<GpgME::Key> &signers,
98  const std::vector<GpgME::Key> &recipients,
99  const QByteArray &plainText, bool alwaysTrust,
100  QByteArray &cipherText) Q_DECL_OVERRIDE;
101 
102  std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
103  exec(const std::vector<GpgME::Key> &signers,
104  const std::vector<GpgME::Key> &recipients,
105  const QByteArray &plainText, const GpgME::Context::EncryptionFlags flags,
106  QByteArray &cipherText) Q_DECL_OVERRIDE;
107 
108  /* from SignEncryptJob */
109  void setOutputIsBase64Encoded(bool on) Q_DECL_OVERRIDE;
110 
111  /* from ThreadedJobMixin */
112  void resultHook(const result_type &r) Q_DECL_OVERRIDE;
113 
114 private:
115  bool mOutputIsBase64Encoded;
116  std::pair<GpgME::SigningResult, GpgME::EncryptionResult> mResult;
117 };
118 
119 }
120 
121 #endif // __QGPGME_QGPGMESIGNENCRYPTJOB_H__
Definition: qgpgmesignencryptjob.h:62
An abstract base class for asynchronous combined signing and encrypting.
Definition: signencryptjob.h:79
Definition: threadedjobmixin.h:122
void setOutputIsBase64Encoded(bool on) Q_DECL_OVERRIDE
Definition: qgpgmesignencryptjob.cpp:64
Definition: abstractimportjob.h:47
GpgME::Error start(const std::vector< GpgME::Key > &signers, const std::vector< GpgME::Key > &recipients, const QByteArray &plainText, bool alwaysTrust) Q_DECL_OVERRIDE