From e452707fdfbd61be1e5633b516b653b7337e7865 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 29 May 2017 16:17:04 +0200 Subject: Reduced the messagetreeparser to aproximately what we actually require While in a much more managable state it's still not pretty. However, further refactoring can now gradually happen as we need to do further work on it. Things that should happen eventually: * Simplify the logic that creates the messageparts (we don't need the whole formatter plugin complexity) * Get rid of the nodehelper (let the parts hold the necessary data) * Get rid of partmetadata (let the part handleit) --- .../mime/mimetreeparser/otp/queuehtmlwriter.cpp | 136 --------------------- 1 file changed, 136 deletions(-) delete mode 100644 framework/src/domain/mime/mimetreeparser/otp/queuehtmlwriter.cpp (limited to 'framework/src/domain/mime/mimetreeparser/otp/queuehtmlwriter.cpp') diff --git a/framework/src/domain/mime/mimetreeparser/otp/queuehtmlwriter.cpp b/framework/src/domain/mime/mimetreeparser/otp/queuehtmlwriter.cpp deleted file mode 100644 index ea17bf5c..00000000 --- a/framework/src/domain/mime/mimetreeparser/otp/queuehtmlwriter.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - Copyright (c) 2015 Sandro Knauß - - This library is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published by - the Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - This library is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public - License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - -#include "queuehtmlwriter.h" - -#include "mimetreeparser_debug.h" - -#include -#include - -using namespace MimeTreeParser; - -QueueHtmlWriter::QueueHtmlWriter(HtmlWriter *base) - : HtmlWriter() - , mBase(base) -{ -} - -QueueHtmlWriter::~QueueHtmlWriter() -{ -} - -void QueueHtmlWriter::setBase(HtmlWriter *base) -{ - mBase = base; -} - -void QueueHtmlWriter::begin(const QString &css) -{ - Command cmd; - cmd.type = Command::Begin; - cmd.s = css; - mQueue.append(cmd); -} - -void QueueHtmlWriter::end() -{ - Command cmd; - cmd.type = Command::End; - mQueue.append(cmd); -} - -void QueueHtmlWriter::reset() -{ - Command cmd; - cmd.type = Command::Reset; - mQueue.append(cmd); -} - -void QueueHtmlWriter::write(const QString &str) -{ - Command cmd; - cmd.type = Command::Write; - cmd.s = str; - mQueue.append(cmd); -} - -void QueueHtmlWriter::queue(const QString &str) -{ - Command cmd; - cmd.type = Command::Queue; - cmd.s = str; - mQueue.append(cmd); -} - -void QueueHtmlWriter::flush() -{ - Command cmd; - cmd.type = Command::Flush; - mQueue.append(cmd); -} - -void QueueHtmlWriter::replay() -{ - foreach (const auto &entry, mQueue) { - switch (entry.type) { - case Command::Begin: - mBase->begin(entry.s); - break; - case Command::End: - mBase->end(); - break; - case Command::Reset: - mBase->reset(); - break; - case Command::Write: - mBase->write(entry.s); - break; - case Command::Queue: - mBase->queue(entry.s); - break; - case Command::Flush: - mBase->flush(); - break; - case Command::EmbedPart: - mBase->embedPart(entry.b, entry.s); - break; - case Command::ExtraHead: - mBase->extraHead(entry.s); - break; - } - } -} - -void QueueHtmlWriter::embedPart(const QByteArray &contentId, const QString &url) -{ - Command cmd; - cmd.type = Command::EmbedPart; - cmd.s = url; - cmd.b = contentId; - mQueue.append(cmd); -} -void QueueHtmlWriter::extraHead(const QString &extra) -{ - Command cmd; - cmd.type = Command::ExtraHead; - cmd.s = extra; - mQueue.append(cmd); -} - -- cgit v1.2.3