Messagelib

messagefactoryforwardjob.cpp
1/*
2 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "messagefactoryforwardjob.h"
8#include <KIdentityManagementCore/IdentityManager>
9#include <TemplateParser/TemplateParserJob>
10
11using namespace MessageComposer;
12
13MessageFactoryForwardJob::MessageFactoryForwardJob(QObject *parent)
14 : QObject(parent)
15{
16}
17
18MessageFactoryForwardJob::~MessageFactoryForwardJob() = default;
19
20void MessageFactoryForwardJob::start()
21{
22 auto parser = new TemplateParser::TemplateParserJob(mMsg, TemplateParser::TemplateParserJob::Forward, this);
23 connect(parser, &TemplateParser::TemplateParserJob::parsingDone, this, &MessageFactoryForwardJob::slotParsingDone);
24 connect(parser, &TemplateParser::TemplateParserJob::parsingFailed, this, &MessageFactoryForwardJob::slotParsingDone);
25 parser->setIdentityManager(mIdentityManager);
26 parser->setSelection(mSelection);
27 if (!mTemplate.isEmpty()) {
28 parser->process(mTemplate, mOrigMsg);
29 } else {
30 parser->process(mOrigMsg, mCollection.id());
31 }
32}
33
34void MessageFactoryForwardJob::slotParsingDone()
35{
36 Q_EMIT forwardDone(mMsg);
38}
39
40void MessageFactoryForwardJob::setCollection(const Akonadi::Collection &collection)
41{
42 mCollection = collection;
43}
44
45void MessageFactoryForwardJob::setMsg(const KMime::Message::Ptr &msg)
46{
47 mMsg = msg;
48}
49
50void MessageFactoryForwardJob::setTemplate(const QString &tmpl)
51{
52 mTemplate = tmpl;
53}
54
55void MessageFactoryForwardJob::setSelection(const QString &selection)
56{
57 mSelection = selection;
58}
59
60void MessageFactoryForwardJob::setOrigMsg(const KMime::Message::Ptr &origMsg)
61{
62 mOrigMsg = origMsg;
63}
64
65void MessageFactoryForwardJob::setIdentityManager(KIdentityManagementCore::IdentityManager *identityManager)
66{
67 mIdentityManager = identityManager;
68}
69
70#include "moc_messagefactoryforwardjob.cpp"
The TemplateParser transforms a message with a given template.
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void deleteLater()
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.