Changeset View
Changeset View
Standalone View
Standalone View
tests/teststore.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
59 | static void createMail(const QVariantMap &object, const QByteArray &folder = {}) | 59 | static void createMail(const QVariantMap &object, const QByteArray &folder = {}) | ||
60 | { | 60 | { | ||
61 | using namespace Sink::ApplicationDomain; | 61 | using namespace Sink::ApplicationDomain; | ||
62 | 62 | | |||
63 | auto toAddresses = toStringList(object["to"].toList()); | 63 | auto toAddresses = toStringList(object["to"].toList()); | ||
64 | auto ccAddresses = toStringList(object["cc"].toList()); | 64 | auto ccAddresses = toStringList(object["cc"].toList()); | ||
65 | auto bccAddresses = toStringList(object["bcc"].toList()); | 65 | auto bccAddresses = toStringList(object["bcc"].toList()); | ||
66 | 66 | | |||
67 | QList<Attachment> attachments = {}; | ||||
68 | if (object.contains("attachments")) { | ||||
69 | auto attachmentSpecs = object["attachments"].toList(); | ||||
70 | for (int i = 0; i < attachmentSpecs.size(); ++i) { | ||||
71 | auto const &spec = attachmentSpecs.at(i).toMap(); | ||||
72 | attachments << Attachment{spec["name"].toString(), | ||||
73 | spec["name"].toString(), | ||||
74 | spec["mimeType"].toByteArray(), | ||||
75 | false, | ||||
76 | spec["data"].toByteArray()}; | ||||
77 | } | ||||
78 | } | ||||
79 | | ||||
67 | KMime::Types::Mailbox mb; | 80 | KMime::Types::Mailbox mb; | ||
68 | mb.fromUnicodeString("identity@example.org"); | 81 | mb.fromUnicodeString("identity@example.org"); | ||
69 | auto msg = MailTemplates::createMessage({}, | 82 | auto msg = MailTemplates::createMessage({}, | ||
70 | toAddresses, | 83 | toAddresses, | ||
71 | ccAddresses, | 84 | ccAddresses, | ||
72 | bccAddresses, | 85 | bccAddresses, | ||
73 | mb, | 86 | mb, | ||
74 | object["subject"].toString(), | 87 | object["subject"].toString(), | ||
75 | object["body"].toString(), | 88 | object["body"].toString(), | ||
76 | object["bodyIsHtml"].toBool(), | 89 | object["bodyIsHtml"].toBool(), | ||
77 | {}, | 90 | attachments, | ||
78 | {}, | 91 | {}, | ||
79 | {}); | 92 | {}); | ||
80 | if (object.contains("messageId")) { | 93 | if (object.contains("messageId")) { | ||
81 | msg->messageID(true)->from7BitString(object["messageId"].toByteArray()); | 94 | msg->messageID(true)->from7BitString(object["messageId"].toByteArray()); | ||
82 | } | 95 | } | ||
83 | if (object.contains("inReplyTo")) { | 96 | if (object.contains("inReplyTo")) { | ||
84 | msg->inReplyTo(true)->from7BitString(object["inReplyTo"].toByteArray()); | 97 | msg->inReplyTo(true)->from7BitString(object["inReplyTo"].toByteArray()); | ||
85 | } | 98 | } | ||
▲ Show 20 Lines • Show All 144 Lines • Show Last 20 Lines |