Commit 991eb9c2 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Bug 387061 - Large messages don't display in the viewer pane (eg. New...

Fix Bug 387061 - Large messages don't display in the viewer pane (eg. New Tumbleweed snapshot 20171117 released!)

FIXED-IN: 5.14.0
BUG: 387061
parent 2c2c12e6
......@@ -25,6 +25,8 @@
#include <cassert>
#include <QByteArray>
#include <QTemporaryFile>
#include <QDir>
using namespace MessageViewer;
......@@ -38,6 +40,7 @@ WebEnginePartHtmlWriter::WebEnginePartHtmlWriter(MailWebEngineView *view, QObjec
WebEnginePartHtmlWriter::~WebEnginePartHtmlWriter()
{
delete mTempFile;
}
void WebEnginePartHtmlWriter::begin()
......@@ -47,6 +50,8 @@ void WebEnginePartHtmlWriter::begin()
reset();
}
delete mTempFile;
BufferedHtmlWriter::begin();
MessageViewer::WebEngineEmbedPart::self()->clear();
mState = Begun;
......@@ -63,8 +68,19 @@ void WebEnginePartHtmlWriter::end()
mExtraHead.clear();
}
// see QWebEnginePage::setHtml()
mHtmlView->setContent(data(), QStringLiteral("text/html;charset=UTF-8"), QUrl(QStringLiteral("file:///")));
//mHtmlView->setContent(data(), QStringLiteral("text/html;charset=UTF-8"), QUrl(QStringLiteral("file:///")));
mTempFile = new QTemporaryFile(QDir::tempPath() + QLatin1String("/messageviewer_XXXXXX")+ QLatin1String(".html"));
mTempFile->open();
QTextStream stream(mTempFile);
stream.setCodec("UTF-8");
stream << data();
//Bug 387061
mHtmlView->load(QUrl::fromLocalFile(mTempFile->fileName()));
//qDebug() << " tempFile.fileName()" << mTempFile->fileName();
mHtmlView->show();
mTempFile->close();
clear();
mHtmlView->setUpdatesEnabled(true);
......
......@@ -23,7 +23,7 @@
#include <QString>
#include <QByteArray>
class QTemporaryFile;
namespace MessageViewer {
class MailWebEngineView;
}
......@@ -56,6 +56,7 @@ private:
Queued,
Ended
} mState;
QTemporaryFile *mTempFile = nullptr;
};
}
#endif // WEBENGINEPARTHTMLWRITER_H
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