diff options
Diffstat (limited to 'framework/src/domain/composercontroller.cpp')
-rw-r--r-- | framework/src/domain/composercontroller.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/framework/src/domain/composercontroller.cpp b/framework/src/domain/composercontroller.cpp index 09d4c154..5581dfa9 100644 --- a/framework/src/domain/composercontroller.cpp +++ b/framework/src/domain/composercontroller.cpp | |||
@@ -99,19 +99,21 @@ class AddresseeController : public Kube::ListPropertyController | |||
99 | public: | 99 | public: |
100 | 100 | ||
101 | bool mFoundAllKeys = true; | 101 | bool mFoundAllKeys = true; |
102 | |||
102 | QSet<QByteArray> mMissingKeys; | 103 | QSet<QByteArray> mMissingKeys; |
103 | AddresseeController() | 104 | AddresseeController() : Kube::ListPropertyController{{"name", "keyFound", "key"}} |
104 | : Kube::ListPropertyController{{"name", "keyFound", "key"}} | ||
105 | { | 105 | { |
106 | QObject::connect(this, &Kube::ListPropertyController::added, this, [this] (const QByteArray &id, const QVariantMap &map) { | 106 | setProperty("foundAllKeys", true); |
107 | findKey(id, map.value("name").toString()); | 107 | |
108 | }); | 108 | QObject::connect( |
109 | this, &Kube::ListPropertyController::added, this, [this](const QByteArray &id, const QVariantMap &map) { | ||
110 | findKey(id, map.value("name").toString()); | ||
111 | }); | ||
112 | |||
109 | QObject::connect(this, &Kube::ListPropertyController::removed, this, [this] (const QByteArray &id) { | 113 | QObject::connect(this, &Kube::ListPropertyController::removed, this, [this] (const QByteArray &id) { |
110 | mMissingKeys.remove(id); | 114 | mMissingKeys.remove(id); |
111 | setFoundAllKeys(mMissingKeys.isEmpty()); | 115 | setFoundAllKeys(mMissingKeys.isEmpty()); |
112 | }); | 116 | }); |
113 | |||
114 | |||
115 | } | 117 | } |
116 | 118 | ||
117 | bool foundAllKeys() | 119 | bool foundAllKeys() |
@@ -133,12 +135,13 @@ public: | |||
133 | mb.fromUnicodeString(addressee); | 135 | mb.fromUnicodeString(addressee); |
134 | 136 | ||
135 | SinkLog() << "Searching key for: " << mb.address(); | 137 | SinkLog() << "Searching key for: " << mb.address(); |
136 | asyncRun<std::vector<GpgME::Key>>(this, [mb] { | 138 | asyncRun<std::vector<GpgME::Key>>(this, |
139 | [mb] { | ||
137 | return MailCrypto::findKeys(QStringList{} << mb.address(), false, false, MailCrypto::OPENPGP); | 140 | return MailCrypto::findKeys(QStringList{} << mb.address(), false, false, MailCrypto::OPENPGP); |
138 | }, | 141 | }, |
139 | [this, addressee, id](const std::vector<GpgME::Key> &keys) { | 142 | [this, addressee, id](const std::vector<GpgME::Key> &keys) { |
140 | if (!keys.empty()) { | 143 | if (!keys.empty()) { |
141 | if (keys.size() > 1 ) { | 144 | if (keys.size() > 1) { |
142 | SinkWarning() << "Found more than one key, encrypting to all of them."; | 145 | SinkWarning() << "Found more than one key, encrypting to all of them."; |
143 | } | 146 | } |
144 | SinkLog() << "Found key: " << keys.front().primaryFingerprint(); | 147 | SinkLog() << "Found key: " << keys.front().primaryFingerprint(); |
@@ -149,12 +152,14 @@ public: | |||
149 | } else { | 152 | } else { |
150 | SinkWarning() << "Failed to find key for recipient."; | 153 | SinkWarning() << "Failed to find key for recipient."; |
151 | } | 154 | } |
155 | |||
156 | setProperty("foundAllKeys", mMissingKeys.isEmpty()); | ||
152 | }); | 157 | }); |
153 | } | 158 | } |
154 | 159 | ||
155 | void set(const QStringList &list) | 160 | void set(const QStringList &list) |
156 | { | 161 | { |
157 | for (const auto &email: list) { | 162 | for (const auto &email : list) { |
158 | add({{"name", email}}); | 163 | add({{"name", email}}); |
159 | } | 164 | } |
160 | } | 165 | } |