qt: Allow creation of default keys without name

* lang/qt/src/defaultkeygenerationjob.cpp
(DefaultKeyGenerationJob::start): Handle empty name and email.
This commit is contained in:
Andre Heinecke 2017-03-01 11:14:07 +01:00
parent 5b49095b89
commit fbafb5474d
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C

View File

@ -91,6 +91,11 @@ void DefaultKeyGenerationJob::slotCancel()
GpgME::Error DefaultKeyGenerationJob::start(const QString &email, const QString &name)
{
const QString namePart = name.isEmpty() ? QString() :
QStringLiteral("name-real: %1\n").arg(name);
const QString mailPart = email.isEmpty() ? QString() :
QStringLiteral("name-email: %1\n").arg(email);
const QString args = QStringLiteral("<GnupgKeyParms format=\"internal\">\n"
"%ask-passphrase\n"
"key-type: RSA\n"
@ -99,9 +104,9 @@ GpgME::Error DefaultKeyGenerationJob::start(const QString &email, const QString
"subkey-type: RSA\n"
"subkey-length: 2048\n"
"subkey-usage: encrypt\n"
"name-email: %1\n"
"name-real: %2\n"
"</GnupgKeyParms>").arg(email, name);
"%1"
"%2"
"</GnupgKeyParms>").arg(mailPart, namePart);
d->job = openpgp()->keyGenerationJob();
d->job->installEventFilter(this);