Commit f76c9876 authored by Sandro Knauß's avatar Sandro Knauß
Browse files

MessageComposer: Preparation for working with Autocrypt messages.

parent 3be77a17
......@@ -60,6 +60,7 @@ public:
QString gnupgHome;
QVector<QPair<QStringList, std::vector<GpgME::Key>>> encData;
GpgME::Key senderEncryptionKey;
std::vector<GpgME::Key> signers;
AttachmentPart::List attachmentParts;
// attachments with different sign/encrypt settings from
......@@ -83,6 +84,7 @@ public:
bool encrypt = false;
bool noCrypto = false;
bool autoSaving = false;
bool autocryptEnabled = false;
Q_DECLARE_PUBLIC(Composer)
};
......@@ -571,6 +573,20 @@ void Composer::setNoCrypto(bool noCrypto)
d->noCrypto = noCrypto;
}
void Composer::setAutocryptEnabled(bool autocryptEnabled)
{
Q_D(Composer);
d->autocryptEnabled = autocryptEnabled;
}
void Composer::setSenderEncryptionKey(const GpgME::Key &senderKey)
{
Q_D(Composer);
d->senderEncryptionKey = senderKey;
}
void Composer::setGnupgHome(const QString &path)
{
Q_D(Composer);
......
......@@ -56,6 +56,9 @@ public:
void setSigningKeys(std::vector<GpgME::Key> &signers);
void setEncryptionKeys(const QVector<QPair<QStringList, std::vector<GpgME::Key>>> &data);
void setAutocryptEnabled(bool autocryptEnabled);
void setSenderEncryptionKey(const GpgME::Key &senderKey);
void setGnupgHome(const QString &path);
Q_REQUIRED_RESULT QString gnupgHome() const;
......
......@@ -607,6 +607,7 @@ struct FormatInfo {
};
struct Q_DECL_HIDDEN Kleo::KeyResolver::Private {
bool mAutocryptEnabled;
std::set<QByteArray> alreadyWarnedFingerprints;
std::vector<GpgME::Key> mOpenPGPSigningKeys; // signing
......@@ -623,6 +624,7 @@ struct Q_DECL_HIDDEN Kleo::KeyResolver::Private {
// key=email address, value=crypto preferences for this contact (from kabc)
typedef std::map<QString, ContactPreferences> ContactPreferencesMap;
ContactPreferencesMap mContactPreferencesMap;
std::map<QByteArray, QString> mAutocryptMap;
};
Kleo::KeyResolver::KeyResolver(bool encToSelf,
......@@ -1649,6 +1651,16 @@ std::vector<Kleo::KeyResolver::SplitInfo> Kleo::KeyResolver::encryptionItems(Kle
return it != d->mFormatInfoMap.end() ? it->second.splitInfos : std::vector<SplitInfo>();
}
void Kleo::KeyResolver::setAutocryptEnabled(bool autocryptEnabled)
{
d->mAutocryptEnabled = autocryptEnabled;
}
std::map<QByteArray, QString> Kleo::KeyResolver::useAutocrypt() const
{
return d->mAutocryptMap;
}
std::vector<GpgME::Key> Kleo::KeyResolver::signingKeys(CryptoMessageFormat f) const
{
dump();
......
......@@ -227,6 +227,14 @@ public:
*/
Q_REQUIRED_RESULT std::vector<SplitInfo> encryptionItems(CryptoMessageFormat f) const;
std::vector<GpgME::Key> encryptToSelfKeysFor(CryptoMessageFormat f) const;
/** If Autocrypt keys are used to find valid PGP Keys
*/
void setAutocryptEnabled(bool autocryptEnabled);
std::map<QByteArray, QString> useAutocrypt() const;
private:
void dump() const;
std::vector<Item> getEncryptionItems(const QStringList &recipients);
......@@ -252,7 +260,6 @@ private:
void addKeys(const std::vector<Item> &items);
QStringList allRecipients() const;
std::vector<GpgME::Key> signingKeysFor(CryptoMessageFormat f) const;
std::vector<GpgME::Key> encryptToSelfKeysFor(CryptoMessageFormat f) const;
std::vector<GpgME::Key> lookup(const QStringList &patterns, bool secret = false) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment