summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/composercontroller.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/domain/composercontroller.cpp')
-rw-r--r--framework/src/domain/composercontroller.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/framework/src/domain/composercontroller.cpp b/framework/src/domain/composercontroller.cpp
index 09d4c154..2286a71b 100644
--- a/framework/src/domain/composercontroller.cpp
+++ b/framework/src/domain/composercontroller.cpp
@@ -99,19 +99,19 @@ class AddresseeController : public Kube::ListPropertyController
99public: 99public:
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 QObject::connect(
107 findKey(id, map.value("name").toString()); 107 this, &Kube::ListPropertyController::added, this, [this](const QByteArray &id, const QVariantMap &map) {
108 }); 108 findKey(id, map.value("name").toString());
109 });
110
109 QObject::connect(this, &Kube::ListPropertyController::removed, this, [this] (const QByteArray &id) { 111 QObject::connect(this, &Kube::ListPropertyController::removed, this, [this] (const QByteArray &id) {
110 mMissingKeys.remove(id); 112 mMissingKeys.remove(id);
111 setFoundAllKeys(mMissingKeys.isEmpty()); 113 setFoundAllKeys(mMissingKeys.isEmpty());
112 }); 114 });
113
114
115 } 115 }
116 116
117 bool foundAllKeys() 117 bool foundAllKeys()
@@ -133,12 +133,13 @@ public:
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, [mb] { 136 asyncRun<std::vector<GpgME::Key>>(this,
137 [mb] {
137 return MailCrypto::findKeys(QStringList{} << mb.address(), false, false, MailCrypto::OPENPGP); 138 return MailCrypto::findKeys(QStringList{} << mb.address(), false, false, MailCrypto::OPENPGP);
138 }, 139 },
139 [this, addressee, id](const std::vector<GpgME::Key> &keys) { 140 [this, addressee, id](const std::vector<GpgME::Key> &keys) {
140 if (!keys.empty()) { 141 if (!keys.empty()) {
141 if (keys.size() > 1 ) { 142 if (keys.size() > 1) {
142 SinkWarning() << "Found more than one key, encrypting to all of them."; 143 SinkWarning() << "Found more than one key, encrypting to all of them.";
143 } 144 }
144 SinkLog() << "Found key: " << keys.front().primaryFingerprint(); 145 SinkLog() << "Found key: " << keys.front().primaryFingerprint();
@@ -154,7 +155,7 @@ public:
154 155
155 void set(const QStringList &list) 156 void set(const QStringList &list)
156 { 157 {
157 for (const auto &email: list) { 158 for (const auto &email : list) {
158 add({{"name", email}}); 159 add({{"name", email}});
159 } 160 }
160 } 161 }