10#include "job/attachmentjob.h"
11#include "contentjobbase_p.h"
12#include "job/singlepartjob.h"
13#include "part/globalpart.h"
14#include "utils/util.h"
16#include "messagecomposer_debug.h"
19using namespace MessageCore;
21class MessageComposer::AttachmentJobPrivate :
public ContentJobBasePrivate
25 : ContentJobBasePrivate(qq)
41AttachmentJob::~AttachmentJob() =
default;
55void AttachmentJob::doStart()
60 if (d->part->mimeType() ==
"multipart/digest" || d->part->mimeType() ==
"message/rfc822") {
68 d->subjobContents << part;
75 sjob->setData(d->part->data());
80 if (d->part->mimeType() ==
"message/rfc822") {
81 sjob->contentTransferEncoding()->setEncoding(KMime::Headers::CE7Bit);
83 sjob->contentTransferEncoding()->setEncoding(d->part->encoding());
86 auto ct = sjob->contentType();
87 ct->setMimeType(d->part->mimeType());
88 ct->setName(d->part->name());
98 qCWarning(MESSAGECOMPOSER_LOG) <<
"No charset specified. Using UTF-8.";
99 textCharset =
"utf-8";
101 ct->setCharset(textCharset);
104 sjob->contentDescription()->fromUnicodeString(d->part->description());
106 auto contentDisposition = sjob->contentDisposition();
107 contentDisposition->setFilename(d->part->fileName());
108 contentDisposition->setRFC2047Charset(
"utf-8");
109 if (d->part->isInline()) {
110 contentDisposition->setDisposition(KMime::Headers::CDinline);
112 contentDisposition->setDisposition(KMime::Headers::CDattachment);
118void AttachmentJob::process()
122 Q_ASSERT(d->subjobContents.count() == 1);
123 d->resultContent = d->subjobContents.constFirst();
127#include "moc_attachmentjob.cpp"
void setContent(const QByteArray &s)
The ContentJobBase class.
virtual void doStart()
Reimplement to do additional stuff before processing children, such as adding more subjobs.
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
bool isEmpty() const const