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 @@ ...@@ -25,6 +25,8 @@
#include <cassert> #include <cassert>
#include <QByteArray> #include <QByteArray>
#include <QTemporaryFile>
#include <QDir>
using namespace MessageViewer; using namespace MessageViewer;
...@@ -38,6 +40,7 @@ WebEnginePartHtmlWriter::WebEnginePartHtmlWriter(MailWebEngineView *view, QObjec ...@@ -38,6 +40,7 @@ WebEnginePartHtmlWriter::WebEnginePartHtmlWriter(MailWebEngineView *view, QObjec
WebEnginePartHtmlWriter::~WebEnginePartHtmlWriter() WebEnginePartHtmlWriter::~WebEnginePartHtmlWriter()
{ {
delete mTempFile;
} }
void WebEnginePartHtmlWriter::begin() void WebEnginePartHtmlWriter::begin()
...@@ -47,6 +50,8 @@ void WebEnginePartHtmlWriter::begin() ...@@ -47,6 +50,8 @@ void WebEnginePartHtmlWriter::begin()
reset(); reset();
} }
delete mTempFile;
BufferedHtmlWriter::begin(); BufferedHtmlWriter::begin();
MessageViewer::WebEngineEmbedPart::self()->clear(); MessageViewer::WebEngineEmbedPart::self()->clear();
mState = Begun; mState = Begun;
...@@ -63,8 +68,19 @@ void WebEnginePartHtmlWriter::end() ...@@ -63,8 +68,19 @@ void WebEnginePartHtmlWriter::end()
mExtraHead.clear(); mExtraHead.clear();
} }
// see QWebEnginePage::setHtml() // 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(); mHtmlView->show();
mTempFile->close();
clear(); clear();
mHtmlView->setUpdatesEnabled(true); mHtmlView->setUpdatesEnabled(true);
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <QString> #include <QString>
#include <QByteArray> #include <QByteArray>
class QTemporaryFile;
namespace MessageViewer { namespace MessageViewer {
class MailWebEngineView; class MailWebEngineView;
} }
...@@ -56,6 +56,7 @@ private: ...@@ -56,6 +56,7 @@ private:
Queued, Queued,
Ended Ended
} mState; } mState;
QTemporaryFile *mTempFile = nullptr;
}; };
} }
#endif // WEBENGINEPARTHTMLWRITER_H #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