Changeset View
Changeset View
Standalone View
Standalone View
framework/src/domain/composercontroller.cpp
Show First 20 Lines • Show All 129 Lines • ▼ Show 20 Line(s) | 129 | { | |||
---|---|---|---|---|---|
130 | mMissingKeys << id; | 130 | mMissingKeys << id; | ||
131 | setFoundAllKeys(mMissingKeys.isEmpty()); | 131 | setFoundAllKeys(mMissingKeys.isEmpty()); | ||
132 | KMime::Types::Mailbox mb; | 132 | KMime::Types::Mailbox mb; | ||
133 | mb.fromUnicodeString(addressee); | 133 | mb.fromUnicodeString(addressee); | ||
134 | 134 | | |||
135 | SinkLog() << "Searching key for: " << mb.address(); | 135 | SinkLog() << "Searching key for: " << mb.address(); | ||
136 | asyncRun<std::vector<GpgME::Key>>(this, | 136 | asyncRun<std::vector<GpgME::Key>>(this, | ||
137 | [mb] { | 137 | [mb] { | ||
138 | return MailCrypto::findKeys(QStringList{} << mb.address(), false, false, MailCrypto::OPENPGP); | 138 | return MailCrypto::findKeys(QStringList{} << mb.address(), false, false); | ||
139 | }, | 139 | }, | ||
140 | [this, addressee, id](const std::vector<GpgME::Key> &keys) { | 140 | [this, addressee, id](const std::vector<GpgME::Key> &keys) { | ||
141 | if (!keys.empty()) { | 141 | if (!keys.empty()) { | ||
142 | if (keys.size() > 1) { | 142 | if (keys.size() > 1) { | ||
143 | SinkWarning() << "Found more than one key, encrypting to all of them."; | 143 | SinkWarning() << "Found more than one key, encrypting to all of them."; | ||
144 | } | 144 | } | ||
145 | SinkLog() << "Found key: " << keys.front().primaryFingerprint(); | 145 | SinkLog() << "Found key: " << keys.front().primaryFingerprint(); | ||
146 | setValue(id, "keyFound", true); | 146 | setValue(id, "keyFound", true); | ||
▲ Show 20 Lines • Show All 311 Lines • ▼ Show 20 Line(s) | 457 | attachments << Attachment{ | |||
458 | value["name"].toString(), | 458 | value["name"].toString(), | ||
459 | value["filename"].toString(), | 459 | value["filename"].toString(), | ||
460 | value["mimetype"].toByteArray(), | 460 | value["mimetype"].toByteArray(), | ||
461 | value["inline"].toBool(), | 461 | value["inline"].toBool(), | ||
462 | value["content"].toByteArray() | 462 | value["content"].toByteArray() | ||
463 | }; | 463 | }; | ||
464 | }); | 464 | }); | ||
465 | 465 | | |||
466 | GpgME::Key attachedKey; | ||||
466 | std::vector<GpgME::Key> signingKeys; | 467 | std::vector<GpgME::Key> signingKeys; | ||
467 | if (getSign()) { | 468 | if (getSign()) { | ||
468 | signingKeys = getPersonalKeys().value<std::vector<GpgME::Key>>(); | 469 | signingKeys = getPersonalKeys().value<std::vector<GpgME::Key>>(); | ||
470 | Q_ASSERT(!signingKeys.empty()); | ||||
471 | attachedKey = signingKeys[0]; | ||||
469 | } | 472 | } | ||
470 | std::vector<GpgME::Key> encryptionKeys; | 473 | std::vector<GpgME::Key> encryptionKeys; | ||
471 | if (getEncrypt()) { | 474 | if (getEncrypt()) { | ||
472 | //Encrypt to self so we can read the sent message | 475 | //Encrypt to self so we can read the sent message | ||
473 | encryptionKeys += getPersonalKeys().value<std::vector<GpgME::Key>>(); | 476 | auto personalKeys = getPersonalKeys().value<std::vector<GpgME::Key>>(); | ||
477 | | ||||
478 | attachedKey = personalKeys[0]; | ||||
479 | | ||||
480 | encryptionKeys += personalKeys; | ||||
474 | encryptionKeys += getRecipientKeys(); | 481 | encryptionKeys += getRecipientKeys(); | ||
475 | } | 482 | } | ||
476 | 483 | | |||
477 | return MailTemplates::createMessage(mExistingMessage, toAddresses, ccAddresses, bccAddresses, getIdentity(), getSubject(), getBody(), getHtmlBody(), attachments, signingKeys, encryptionKeys); | 484 | return MailTemplates::createMessage(mExistingMessage, toAddresses, ccAddresses, bccAddresses, getIdentity(), getSubject(), getBody(), getHtmlBody(), attachments, signingKeys, encryptionKeys, attachedKey); | ||
478 | } | 485 | } | ||
479 | 486 | | |||
480 | void ComposerController::send() | 487 | void ComposerController::send() | ||
481 | { | 488 | { | ||
482 | auto message = assembleMessage(); | 489 | auto message = assembleMessage(); | ||
483 | if (!message) { | 490 | if (!message) { | ||
484 | SinkWarning() << "Failed to assemble the message."; | 491 | SinkWarning() << "Failed to assemble the message."; | ||
485 | return; | 492 | return; | ||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |