Commit 629f735e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Reply/forward based on display format in viewer

parent eab0855f
Pipeline #21377 passed with stage
in 19 minutes and 34 seconds
cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.14.44")
set(PIM_VERSION "5.14.45")
if (POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
......
......@@ -477,7 +477,8 @@ void MessageFactoryTest::testCreateReplyHtmlAsync()
MessageFactoryNG factory(msg, 0);
factory.setIdentityManager(mIdentMan);
TemplateParser::TemplateParserSettings::self()->setReplyUsingHtml(true);
TemplateParser::TemplateParserSettings::self()->setReplyUsingVisualFormat(true);
factory.setReplyAsHtml(true);
QSignalSpy spy(&factory, &MessageFactoryNG::createReplyDone);
factory.setIdentityManager(mIdentMan);
......@@ -497,7 +498,9 @@ void MessageFactoryTest::testCreateReplyHtmlAsync()
QCOMPARE(reply.msg->contents().count(), 2);
QCOMPARE_OR_DIFF(reply.msg->contents().at(0)->body(), replyStr.toLatin1());
TemplateParser::TemplateParserSettings::self()->setReplyUsingHtml(false);
TemplateParser::TemplateParserSettings::self()->setReplyUsingVisualFormat(false);
factory.setReplyAsHtml(false);
factory.createReplyAsync();
QVERIFY(spy.wait());
QCOMPARE(spy.count(), 2);
......@@ -509,18 +512,20 @@ void MessageFactoryTest::testCreateReplyHtmlAsync()
QCOMPARE(reply.msg->contentType()->mimeType(), QByteArrayLiteral("text/plain"));
QCOMPARE(reply.msg->subject()->asUnicodeString(), QLatin1String("Re: reply to please"));
QCOMPARE(reply.msg->contents().count(), 0);
TemplateParser::TemplateParserSettings::self()->setReplyUsingHtml(true);
TemplateParser::TemplateParserSettings::self()->setReplyUsingVisualFormat(true);
factory.setReplyAsHtml(true);
}
void MessageFactoryTest::testCreateReplyUTF16Base64Async()
{
KMime::Message::Ptr msg = loadMessageFromFile(QStringLiteral("plain_utf16.mbox"));
TemplateParser::TemplateParserSettings::self()->setReplyUsingHtml(true);
MessageFactoryNG factory(msg, 0);
factory.setIdentityManager(mIdentMan);
TemplateParser::TemplateParserSettings::self()->setReplyUsingVisualFormat(true);
factory.setReplyAsHtml(true);
QSignalSpy spy(&factory, &MessageFactoryNG::createReplyDone);
factory.setIdentityManager(mIdentMan);
......
......@@ -301,6 +301,7 @@ void MessageFactoryNG::createReplyAsync()
job->setTemplate(mTemplate);
job->setOrigMsg(mOrigMsg);
job->setCollection(mCollection);
job->setReplyAsHtml(mReplyAsHtml);
job->start();
} else {
slotCreateReplyDone(msg, replyAll);
......
......@@ -40,6 +40,7 @@ void MessageFactoryReplyJob::start()
parser->setIdentityManager(mIdentityManager);
parser->setCharsets(MessageComposerSettings::self()->preferredCharsets());
parser->setWordWrap(MessageComposerSettings::wordWrap(), MessageComposerSettings::lineWrapWidth());
parser->setReplyAsHtml(mReplyAsHtml);
if (MessageComposer::MessageComposerSettings::quoteSelectionOnly()) {
parser->setSelection(mSelection);
}
......
......@@ -15,8 +15,8 @@ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/sta
<label>Use smart &amp;quoting</label>
<default>true</default>
</entry>
<entry name="ReplyUsingHtml" type="Bool" key="replySameFormat">
<label>Reply or forward using HTML if present</label>
<entry name="ReplyUsingVisualFormat" type="Bool" key="replyUsingVisualFormat">
<label>Reply or forward using HTML based on Visual Format</label>
<default>false</default>
</entry>
......
......@@ -1078,9 +1078,10 @@ void TemplateParserJob::slotExtractInfoDone(const TemplateParserExtractHtmlInfoR
// there is no use of FORCED command but a configure setting has ReplyUsingHtml disabled,
// OR the original mail has no HTML part.
const KMime::Content *content = d->mOrigMsg->mainBodyPart("text/html");
qDebug() << " d->mReplyAsHtml" << d->mReplyAsHtml << " TemplateParserSettings::self()->replyUsingVisualFormat()" << TemplateParserSettings::self()->replyUsingVisualFormat();
if (d->mQuotes == ReplyAsPlain
|| (d->mQuotes != ReplyAsHtml && !TemplateParserSettings::self()->replyUsingHtml())
/*|| (!d->mReplyAsHtml && ... TODO add config settings for it ) */
|| (d->mQuotes != ReplyAsHtml)
|| (!d->mReplyAsHtml && TemplateParserSettings::self()->replyUsingVisualFormat())
|| (!content || !content->hasContent())) {
htmlBody.clear();
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment