Commit 07380825 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Bug 419448 - MS Exchange sqeeze spaces in HTML messages

BUG:419448
FIXED-IN: 5.14.0
parent 823ee8ff
......@@ -30,7 +30,7 @@ set(KLDAP_LIB_VERSION "5.13.90")
set(KMAILTRANSPORT_LIB_VERSION "5.13.90")
set(KMBOX_LIB_VERSION "5.13.90")
set(KMIME_LIB_VERSION "5.13.90")
set(KPIMTEXTEDIT_LIB_VERSION "5.13.90")
set(KPIMTEXTEDIT_LIB_VERSION "5.13.91")
set(LIBKDEPIM_LIB_VERSION "5.13.90")
set(LIBKLEO_LIB_VERSION "5.13.90")
set(PIMCOMMON_LIB_VERSION "5.13.90")
......
......@@ -26,6 +26,7 @@
#include "settings/messagecomposersettings.h"
#include <grantlee/markupdirector.h>
#include <grantlee/plaintextmarkupbuilder.h>
#include <KPIMTextEdit/TextHTMLBuilder>
using namespace MessageComposer;
......@@ -159,6 +160,8 @@ MessageComposer::PluginEditorConvertTextInterface::ConvertTextStatus RichTextCom
return MessageComposer::PluginEditorConvertTextInterface::ConvertTextStatus::NotConverted;
}
#define USE_TEXTHTML_BUILDER 1
void RichTextComposerNg::fillComposerTextPart(MessageComposer::TextPart *textPart)
{
bool wasConverted
......@@ -192,17 +195,31 @@ void RichTextComposerNg::fillComposerTextPart(MessageComposer::TextPart *textPar
}
textPart->setWordWrappingEnabled(lineWrapMode() == QTextEdit::FixedColumnWidth);
if (composerControler()->isFormattingUsed() && !wasConverted) {
#ifdef USE_TEXTHTML_BUILDER
KPIMTextEdit::TextHTMLBuilder *pb = new KPIMTextEdit::TextHTMLBuilder();
Grantlee::MarkupDirector *pmd = new Grantlee::MarkupDirector(pb);
pmd->processDocument(document());
QString cleanHtml = QStringLiteral("<html>\n<head>\n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n</head>\n<body>%1</body>\n</html>").arg(pb->getResult());
delete pmd;
delete pb;
d->fixHtmlFontSize(cleanHtml);
textPart->setCleanHtml(cleanHtml);
#else
QString cleanHtml = d->toCleanHtml();
d->fixHtmlFontSize(cleanHtml);
textPart->setCleanHtml(cleanHtml);
#endif
textPart->setEmbeddedImages(composerControler()->composerImages()->embeddedImages());
}
}
QString RichTextComposerNgPrivate::toCleanHtml() const
{
QString result = richtextComposer->toHtml();
static const QString EMPTYLINEHTML = QStringLiteral(
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; "
"margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \">&nbsp;</p>");
......
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