From e8ce86ccdf23fad155cf4888cb4db657b99c8bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Fri, 15 Jan 2016 13:02:24 +0100 Subject: Render HTML directly to string and not via indirecton of a file --- framework/mail/maillistmodel.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'framework/mail/maillistmodel.cpp') diff --git a/framework/mail/maillistmodel.cpp b/framework/mail/maillistmodel.cpp index c37e2be4..d3b60187 100644 --- a/framework/mail/maillistmodel.cpp +++ b/framework/mail/maillistmodel.cpp @@ -1,6 +1,6 @@ #include "maillistmodel.h" -#include "filehtmlwriter.h" +#include "stringhtmlwriter.h" #include "objecttreesource.h" #include @@ -78,8 +78,7 @@ QVariant MailListModel::data(const QModelIndex &idx, int role) const msg->parse(); // render the mail - const QString fname("/tmp/test.html"); - FileHtmlWriter htmlWriter(fname); + StringHtmlWriter htmlWriter; QImage paintDevice; MessageViewer::CSSHelper cssHelper(&paintDevice); MessageViewer::NodeHelper nodeHelper; @@ -92,16 +91,9 @@ QVariant MailListModel::data(const QModelIndex &idx, int role) const otp.parseObjectTree(msg.data()); htmlWriter.queue(QStringLiteral("")); - htmlWriter.flush(); htmlWriter.end(); - QFile file(fname); - if (file.open(QFile::ReadOnly)) { - const auto content = file.readAll(); - return content; - } else { - qWarning() << "Failed to open the file"; - } + return htmlWriter.html(); } else { qWarning() << "Failed to open the file"; } -- cgit v1.2.3