Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 7f0ab386 authored by Laurent Montel's avatar Laurent Montel 😁

Allow to generate email

parent 20be1e68
......@@ -155,22 +155,34 @@ void RichTextComposerNgPrivate::fixHtmlFontSize(QString &cleanHtml)
}
}
bool RichTextComposerNg::convertPlainText(MessageComposer::TextPart *textPart)
{
return false;
}
void RichTextComposerNg::fillComposerTextPart(MessageComposer::TextPart *textPart)
{
if (composerControler()->isFormattingUsed() && MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessage()) {
Grantlee::PlainTextMarkupBuilder *pb = new Grantlee::PlainTextMarkupBuilder();
Grantlee::MarkupDirector *pmd = new Grantlee::MarkupDirector(pb);
pmd->processDocument(document());
const QString plainText = pb->getResult();
textPart->setCleanPlainText(composerControler()->toCleanPlainText(plainText));
QTextDocument *doc = new QTextDocument(plainText);
doc->adjustSize();
textPart->setWrappedPlainText(composerControler()->toWrappedPlainText(doc));
delete doc;
delete pmd;
delete pb;
if (composerControler()->isFormattingUsed()) {
if (!convertPlainText(textPart)) {
if (MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessage()) {
Grantlee::PlainTextMarkupBuilder *pb = new Grantlee::PlainTextMarkupBuilder();
Grantlee::MarkupDirector *pmd = new Grantlee::MarkupDirector(pb);
pmd->processDocument(document());
const QString plainText = pb->getResult();
textPart->setCleanPlainText(composerControler()->toCleanPlainText(plainText));
QTextDocument *doc = new QTextDocument(plainText);
doc->adjustSize();
textPart->setWrappedPlainText(composerControler()->toWrappedPlainText(doc));
delete doc;
delete pmd;
delete pb;
} else {
textPart->setCleanPlainText(composerControler()->toCleanPlainText());
textPart->setWrappedPlainText(composerControler()->toWrappedPlainText());
}
}
} else {
textPart->setCleanPlainText(composerControler()->toCleanPlainText());
textPart->setWrappedPlainText(composerControler()->toWrappedPlainText());
......
......@@ -50,6 +50,9 @@ public:
QString toCleanHtml() const;
void forceAutoCorrection(bool selectedText = false) override;
virtual bool convertPlainText(MessageComposer::TextPart *textPart);
private:
bool processAutoCorrection(QKeyEvent *event) override;
RichTextComposerNgPrivate *const d;
......
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