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