diff options
Diffstat (limited to 'framework/src/domain/mime/attachmentmodel.cpp')
-rw-r--r-- | framework/src/domain/mime/attachmentmodel.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/framework/src/domain/mime/attachmentmodel.cpp b/framework/src/domain/mime/attachmentmodel.cpp index 8b12679b..45013f85 100644 --- a/framework/src/domain/mime/attachmentmodel.cpp +++ b/framework/src/domain/mime/attachmentmodel.cpp | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <mimetreeparser/objecttreeparser.h> | 23 | #include <mimetreeparser/objecttreeparser.h> |
24 | #include <fabric.h> | 24 | #include <fabric.h> |
25 | #include <mailcrypto.h> | ||
25 | 26 | ||
26 | #include <QDebug> | 27 | #include <QDebug> |
27 | #include <KMime/Content> | 28 | #include <KMime/Content> |
@@ -32,9 +33,6 @@ | |||
32 | #include <QUrl> | 33 | #include <QUrl> |
33 | #include <QMimeDatabase> | 34 | #include <QMimeDatabase> |
34 | 35 | ||
35 | #include <QGpgME/ImportJob> | ||
36 | #include <QGpgME/Protocol> | ||
37 | |||
38 | #include <memory> | 36 | #include <memory> |
39 | 37 | ||
40 | QString sizeHuman(float size) | 38 | QString sizeHuman(float size) |
@@ -221,21 +219,17 @@ bool AttachmentModel::importPublicKey(const QModelIndex &index) | |||
221 | const auto part = static_cast<MimeTreeParser::MessagePart *>(index.internalPointer()); | 219 | const auto part = static_cast<MimeTreeParser::MessagePart *>(index.internalPointer()); |
222 | Q_ASSERT(part); | 220 | Q_ASSERT(part); |
223 | auto pkey = part->node()->decodedContent(); | 221 | auto pkey = part->node()->decodedContent(); |
224 | 222 | auto result = MailCrypto::importKey(pkey); | |
225 | const auto *proto = QGpgME::openpgp(); | ||
226 | std::unique_ptr<QGpgME::ImportJob> job(proto->importJob()); | ||
227 | auto result = job->exec(pkey); | ||
228 | 223 | ||
229 | bool success = true; | 224 | bool success = true; |
230 | |||
231 | QString message; | 225 | QString message; |
232 | if(result.numConsidered() == 0) { | 226 | if(result.considered == 0) { |
233 | message = tr("No keys were found in this attachment"); | 227 | message = tr("No keys were found in this attachment"); |
234 | success = false; | 228 | success = false; |
235 | } else { | 229 | } else { |
236 | message = tr("%n Key(s) imported", "", result.numImported()); | 230 | message = tr("%n Key(s) imported", "", result.imported); |
237 | if(result.numUnchanged() != 0) { | 231 | if(result.unchanged != 0) { |
238 | message += "\n" + tr("%n Key(s) were already imported", "", result.numUnchanged()); | 232 | message += "\n" + tr("%n Key(s) were already imported", "", result.unchanged); |
239 | } | 233 | } |
240 | } | 234 | } |
241 | 235 | ||