34 #ifndef __QGPGME_PROTOCOL_P_H__
35 #define __QGPGME_PROTOCOL_P_H__
36 #include "qgpgmenewcryptoconfig.h"
38 #include "qgpgmekeygenerationjob.h"
39 #include "qgpgmekeylistjob.h"
40 #include "qgpgmelistallkeysjob.h"
41 #include "qgpgmedecryptjob.h"
42 #include "qgpgmedecryptverifyjob.h"
43 #include "qgpgmerefreshkeysjob.h"
44 #include "qgpgmedeletejob.h"
45 #include "qgpgmesecretkeyexportjob.h"
46 #include "qgpgmedownloadjob.h"
47 #include "qgpgmesignencryptjob.h"
48 #include "qgpgmeencryptjob.h"
49 #include "qgpgmesignjob.h"
50 #include "qgpgmesignkeyjob.h"
51 #include "qgpgmeexportjob.h"
52 #include "qgpgmeverifydetachedjob.h"
53 #include "qgpgmeimportjob.h"
54 #include "qgpgmeimportfromkeyserverjob.h"
55 #include "qgpgmeverifyopaquejob.h"
56 #include "qgpgmechangeexpiryjob.h"
57 #include "qgpgmechangeownertrustjob.h"
58 #include "qgpgmechangepasswdjob.h"
59 #include "qgpgmeadduseridjob.h"
60 #include "qgpgmekeyformailboxjob.h"
61 #include "qgpgmewkspublishjob.h"
62 #include "qgpgmetofupolicyjob.h"
63 #include "qgpgmequickjob.h"
70 GpgME::Protocol mProtocol;
72 explicit Protocol(GpgME::Protocol proto) : mProtocol(proto) {}
74 QString name() const Q_DECL_OVERRIDE
77 case GpgME::OpenPGP:
return QStringLiteral(
"OpenPGP");
78 case GpgME::CMS:
return QStringLiteral(
"SMIME");
79 default:
return QString();
83 QString displayName() const Q_DECL_OVERRIDE
88 case GpgME::OpenPGP:
return QStringLiteral(
"gpg");
89 case GpgME::CMS:
return QStringLiteral(
"gpgsm");
90 default:
return QStringLiteral(
"unknown");
99 QGpgME::KeyListJob *keyListJob(
bool remote,
bool includeSigs,
bool validate)
const Q_DECL_OVERRIDE
101 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
106 unsigned int mode = context->keyListMode();
108 mode |= GpgME::Extern;
109 mode &= ~GpgME::Local;
111 mode |= GpgME::Local;
112 mode &= ~GpgME::Extern;
115 mode |= GpgME::Signatures;
118 mode |= GpgME::Validate;
120 context->setKeyListMode(mode);
126 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
131 unsigned int mode = context->keyListMode();
132 mode |= GpgME::Local;
133 mode &= ~GpgME::Extern;
135 mode |= GpgME::Signatures;
138 mode |= GpgME::Validate;
145 context->setOffline(
true);
147 context->setKeyListMode(mode);
153 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
158 context->setArmor(armor);
159 context->setTextMode(textmode);
165 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
172 QGpgME::SignJob *signJob(
bool armor,
bool textMode)
const Q_DECL_OVERRIDE
174 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
179 context->setArmor(armor);
180 context->setTextMode(textMode);
186 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
191 context->setTextMode(textMode);
197 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
202 context->setTextMode(textMode);
208 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
217 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
226 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
235 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
240 context->setArmor(armor);
244 QGpgME::ExportJob *secretKeyExportJob(
bool armor,
const QString &charset)
const Q_DECL_OVERRIDE
246 if (mProtocol != GpgME::CMS) {
256 if (mProtocol != GpgME::CMS) {
266 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
271 context->setArmor(armor);
273 context->setKeyListMode(GpgME::Extern);
279 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
288 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
293 context->setArmor(armor);
294 context->setTextMode(textMode);
300 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
305 context->setTextMode(textMode);
311 if (mProtocol != GpgME::OpenPGP) {
315 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
324 if (!GpgME::hasFeature(GpgME::PasswdFeature, 0)) {
327 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
336 if (mProtocol != GpgME::OpenPGP) {
340 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
349 if (mProtocol != GpgME::OpenPGP) {
353 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
362 if (mProtocol != GpgME::OpenPGP) {
366 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
375 if (mProtocol != GpgME::OpenPGP) {
378 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
382 context->setKeyListMode(GpgME::Extern | GpgME::Local | GpgME::Signatures | GpgME::Validate);
388 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
397 if (mProtocol != GpgME::OpenPGP) {
400 auto context = GpgME::Context::createForEngine(GpgME::SpawnEngine);
409 if (mProtocol != GpgME::OpenPGP) {
412 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
421 if (mProtocol != GpgME::OpenPGP) {
424 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);