7#include <config-libkleo.h>
9#include "defaultkeygenerationjob.h"
11#include <QGpgME/KeyGenerationJob>
12#include <QGpgME/Protocol>
22class DefaultKeyGenerationJob::DefaultKeyGenerationJobPrivate
25 DefaultKeyGenerationJobPrivate()
29 ~DefaultKeyGenerationJobPrivate()
37 QPointer<QGpgME::KeyGenerationJob> job;
41DefaultKeyGenerationJob::DefaultKeyGenerationJob(
QObject *parent)
47DefaultKeyGenerationJob::~DefaultKeyGenerationJob() =
default;
49QString DefaultKeyGenerationJob::auditLogAsHtml()
const
51 return d->job ? d->job->auditLogAsHtml() : QString();
54GpgME::Error DefaultKeyGenerationJob::auditLogError()
const
56 return d->job ? d->job->auditLogError() : GpgME::Error();
59void DefaultKeyGenerationJob::slotCancel()
79 return QStringLiteral(
"%ask-passphrase");
80 }
else if (passphrase.
isEmpty()) {
81 return QStringLiteral(
"%no-protection");
83 return QStringLiteral(
"passphrase: %1").arg(passphrase);
88GpgME::Error DefaultKeyGenerationJob::start(
const QString &email,
const QString &name)
90 const QString passphrase = passphraseParameter(d->passphrase);
91 const QString args = QStringLiteral(
92 "<GnupgKeyParms format=\"internal\">\n"
97 "subkey-length: 2048\n"
98 "subkey-usage: encrypt\n"
103 .arg(passphrase, email, name);
105 d->job = QGpgME::openpgp()->keyGenerationJob();
106 d->job->installEventFilter(
this);
107 connect(d->job.data(), &QGpgME::KeyGenerationJob::result,
this, &DefaultKeyGenerationJob::result);
108 connect(d->job.data(), &QGpgME::KeyGenerationJob::done,
this, &DefaultKeyGenerationJob::done);
110 return d->job->start(args);
113bool DefaultKeyGenerationJob::eventFilter(QObject *watched, QEvent *event)
122 return Job::eventFilter(watched, event);
125#include "moc_defaultkeygenerationjob.cpp"
Generates a PGP RSA/2048 bit key pair for given name and email address.
void setPassphrase(const QString &passphrase)
Set key passphrase.
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
bool isEmpty() const const
bool isNull() const const
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)