Commit 3d594846 authored by Sandro Knauß's avatar Sandro Knauß 🐝
Browse files

Move Namespace to MimeTreeParser

parent a955dd92
......@@ -23,7 +23,7 @@
#include <qtest.h>
using namespace MessageViewer;
using namespace MimeTreeParser;
class AttachmentTest : public QObject
{
......@@ -38,7 +38,7 @@ QTEST_MAIN(AttachmentTest)
void AttachmentTest::initTestCase()
{
MessageViewer::Test::setupEnv();
MimeTreeParser::Test::setupEnv();
}
void AttachmentTest::testEncryptedAttachment_data()
......
......@@ -35,20 +35,20 @@ ConvertHtmlToPlainTextTest::~ConvertHtmlToPlainTextTest()
void ConvertHtmlToPlainTextTest::shouldHaveDefaultValue()
{
MessageViewer::ConvertHtmlToPlainText convert;
MimeTreeParser::ConvertHtmlToPlainText convert;
QVERIFY(convert.htmlString().isEmpty());
}
void ConvertHtmlToPlainTextTest::shouldReturnEmptyStringIfInputTextIsEmpty()
{
MessageViewer::ConvertHtmlToPlainText convert;
MimeTreeParser::ConvertHtmlToPlainText convert;
convert.setHtmlString(QString());
QVERIFY(convert.generatePlainText().isEmpty());
}
void ConvertHtmlToPlainTextTest::shouldReturnNotEmptyStringIfInputTextIsNotEmpty()
{
MessageViewer::ConvertHtmlToPlainText convert;
MimeTreeParser::ConvertHtmlToPlainText convert;
const QString str = QStringLiteral("foo bla");
convert.setHtmlString(str);
const QString result = convert.generatePlainText();
......@@ -72,7 +72,7 @@ void ConvertHtmlToPlainTextTest::shouldConvertToPlainText()
QFETCH(QString, inputText);
QFETCH(QString, convertedText);
MessageViewer::ConvertHtmlToPlainText convert;
MimeTreeParser::ConvertHtmlToPlainText convert;
convert.setHtmlString(inputText);
const QString result = convert.generatePlainText();
QVERIFY(!result.isEmpty());
......
......@@ -22,7 +22,7 @@
#include <QTest>
using namespace MessageViewer;
using namespace MimeTreeParser;
void CryptoHelperTest::testPMFDEmpty()
{
......
......@@ -21,7 +21,7 @@
#include <QObject>
namespace MessageViewer
namespace MimeTreeParser
{
class CryptoHelperTest : public QObject
......
......@@ -22,7 +22,7 @@
#include <QTest>
using namespace MessageViewer;
using namespace MimeTreeParser;
QTEST_MAIN(CSSHelperTest)
......
......@@ -22,7 +22,7 @@
#include <qtest.h>
using namespace MessageViewer;
using namespace MimeTreeParser;
NodeHelperTest::NodeHelperTest()
: QObject()
......
......@@ -23,7 +23,7 @@
#include <KMime/Message>
namespace MessageViewer
namespace MimeTreeParser
{
class NodeHelperTest : public QObject
......
......@@ -27,13 +27,13 @@
#include <setupenv.h>
using namespace MessageViewer;
using namespace MimeTreeParser;
QTEST_MAIN(ObjectTreeParserTester)
void ObjectTreeParserTester::initTestCase()
{
MessageViewer::Test::setupEnv();
MimeTreeParser::Test::setupEnv();
}
void ObjectTreeParserTester::test_parsePlainMessage()
......@@ -94,7 +94,7 @@ void ObjectTreeParserTester::test_parseEncapsulatedMessage()
TestHtmlWriter testWriter;
TestCSSHelper testCSSHelper;
NodeHelper nodeHelper;
MessageViewer::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
MimeTreeParser::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
ObjectTreeParser otp(&emptySource, &nodeHelper);
otp.parseObjectTree(msg.data());
......@@ -129,7 +129,7 @@ void ObjectTreeParserTester::test_missingContentTypeHeader()
TestHtmlWriter testWriter;
TestCSSHelper testCSSHelper;
NodeHelper nodeHelper;
MessageViewer::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
MimeTreeParser::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
ObjectTreeParser otp(&emptySource, &nodeHelper);
otp.parseObjectTree(msg.data());
......@@ -147,7 +147,7 @@ void ObjectTreeParserTester::test_inlinePGPDecryption()
TestHtmlWriter testWriter;
TestCSSHelper testCSSHelper;
NodeHelper nodeHelper;
MessageViewer::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
MimeTreeParser::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
ObjectTreeParser otp(&emptySource, &nodeHelper);
emptySource.setAllowDecryption(true);
......@@ -172,7 +172,7 @@ void ObjectTreeParserTester::test_inlinePGPSigned()
TestHtmlWriter testWriter;
TestCSSHelper testCSSHelper;
NodeHelper nodeHelper;
MessageViewer::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
MimeTreeParser::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
ObjectTreeParser otp(&emptySource, &nodeHelper);
emptySource.setAllowDecryption(true);
......@@ -208,7 +208,7 @@ void ObjectTreeParserTester::test_HTMLasText()
TestHtmlWriter testWriter;
TestCSSHelper testCSSHelper;
MessageViewer::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
MimeTreeParser::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
ObjectTreeParser otp(&emptySource);
emptySource.setHtmlMail(false);
otp.parseObjectTree(msg.data());
......@@ -244,7 +244,7 @@ void ObjectTreeParserTester::test_HTMLOnlyText()
TestHtmlWriter testWriter;
TestCSSHelper testCSSHelper;
MessageViewer::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
MimeTreeParser::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
ObjectTreeParser otp(&emptySource);
emptySource.setHtmlMail(false);
......@@ -266,7 +266,7 @@ void ObjectTreeParserTester::test_HTMLExternal()
{
TestHtmlWriter testWriter;
TestCSSHelper testCSSHelper;
MessageViewer::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
MimeTreeParser::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
ObjectTreeParser otp(&emptySource);
otp.parseObjectTree(msg.data());
......@@ -279,7 +279,7 @@ void ObjectTreeParserTester::test_HTMLExternal()
{
TestHtmlWriter testWriter;
TestCSSHelper testCSSHelper;
MessageViewer::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
MimeTreeParser::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
ObjectTreeParser otp(&emptySource);
emptySource.setHtmlLoadExternal(true);
......@@ -309,7 +309,7 @@ void ObjectTreeParserTester::text_quoteHtml()
QFETCH(QString, result);
TestHtmlWriter testWriter;
TestCSSHelper testCSSHelper;
MessageViewer::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
MimeTreeParser::Test::TestObjectTreeSource emptySource(&testWriter, &testCSSHelper);
ObjectTreeParser otp(&emptySource);
QCOMPARE(otp.quotedHTML(data, false), result);
}
......@@ -31,11 +31,11 @@
#include <QProcess>
#include <QTest>
using namespace MessageViewer;
using namespace MimeTreeParser;
void RenderTest::initTestCase()
{
MessageViewer::Test::setupEnv();
MimeTreeParser::Test::setupEnv();
}
void RenderTest::testRenderSmart_data()
......@@ -174,9 +174,9 @@ void RenderTest::testRender()
// render the mail
FileHtmlWriter fileWriter(outFileName);
QImage paintDevice;
MessageViewer::TestCSSHelper cssHelper(&paintDevice);
MimeTreeParser::TestCSSHelper cssHelper(&paintDevice);
NodeHelper nodeHelper;
MessageViewer::Test::TestObjectTreeSource testSource(&fileWriter, &cssHelper);
MimeTreeParser::Test::TestObjectTreeSource testSource(&fileWriter, &cssHelper);
testSource.setAllowDecryption(true);
testSource.setAttachmentStrategy(attachmentStrategy);
ObjectTreeParser otp(&testSource, &nodeHelper);
......
......@@ -25,7 +25,7 @@
#include <QFile>
#include <QDir>
void MessageViewer::Test::setupEnv()
void MimeTreeParser::Test::setupEnv()
{
setenv("LC_ALL", "C", 1);
setenv("KDEHOME", QFile::encodeName(QDir::homePath() + QString::fromLatin1("/.qttest")), 1);
......
......@@ -26,7 +26,7 @@
#include <viewer/attachmentstrategy.h>
#include "viewer/bodypartformatterbasefactory.h"
namespace MessageViewer
namespace MimeTreeParser
{
namespace Test
......@@ -41,11 +41,11 @@ void setupEnv();
// We can't use EmptySource, since we need to control some emelnets of the source for tests to also test
// loadExternal and htmlMail.
class TestObjectTreeSource : public MessageViewer::ObjectTreeSourceIf
class TestObjectTreeSource : public MimeTreeParser::ObjectTreeSourceIf
{
public:
TestObjectTreeSource(MessageViewer::HtmlWriter *writer,
MessageViewer::CSSHelperBase *cssHelper)
TestObjectTreeSource(MimeTreeParser::HtmlWriter *writer,
MimeTreeParser::CSSHelperBase *cssHelper)
: mWriter(writer)
, mCSSHelper(cssHelper)
, mAttachmentStrategy(QStringLiteral("smart"))
......@@ -55,10 +55,10 @@ public:
{
}
MessageViewer::HtmlWriter *htmlWriter() Q_DECL_OVERRIDE {
MimeTreeParser::HtmlWriter *htmlWriter() Q_DECL_OVERRIDE {
return mWriter;
}
MessageViewer::CSSHelperBase *cssHelper() Q_DECL_OVERRIDE {
MimeTreeParser::CSSHelperBase *cssHelper() Q_DECL_OVERRIDE {
return mCSSHelper;
}
......@@ -126,7 +126,7 @@ public:
return false;
}
void setHtmlMode(MessageViewer::Util::HtmlMode mode) Q_DECL_OVERRIDE
void setHtmlMode(MimeTreeParser::Util::HtmlMode mode) Q_DECL_OVERRIDE
{
Q_UNUSED(mode);
}
......@@ -153,8 +153,8 @@ public:
}
private:
MessageViewer::HtmlWriter *mWriter;
MessageViewer::CSSHelperBase *mCSSHelper;
MimeTreeParser::HtmlWriter *mWriter;
MimeTreeParser::CSSHelperBase *mCSSHelper;
QString mAttachmentStrategy;
BodyPartFormatterBaseFactory mBodyPartFormatterBaseFactory;
bool mHtmlLoadExternal;
......
......@@ -36,7 +36,7 @@
#include <QPalette>
#include <QApplication>
namespace MessageViewer
namespace MimeTreeParser
{
TestCSSHelper::TestCSSHelper(const QPaintDevice *pd) :
......
......@@ -34,7 +34,7 @@
#include "viewer/csshelperbase.h"
namespace MessageViewer
namespace MimeTreeParser
{
class TestCSSHelper : public CSSHelperBase
......
......@@ -23,7 +23,7 @@
#include <qtest.h>
using namespace MessageViewer;
using namespace MimeTreeParser;
class UnencryptedMessageTest : public QObject
{
......
......@@ -21,7 +21,7 @@
#include <KMime/Message>
class TestHtmlWriter : public MessageViewer::HtmlWriter
class TestHtmlWriter : public MimeTreeParser::HtmlWriter
{
public:
explicit TestHtmlWriter() {}
......@@ -42,10 +42,10 @@ public:
QString html;
};
class TestCSSHelper : public MessageViewer::CSSHelperBase
class TestCSSHelper : public MimeTreeParser::CSSHelperBase
{
public:
TestCSSHelper() : MessageViewer::CSSHelperBase(0)
TestCSSHelper() : MimeTreeParser::CSSHelperBase(0)
{
for (int i = 0; i < 3; ++i) {
mQuoteColor[i] = QColor(0x00, 0x80 - i * 0x10, 0x00);
......
......@@ -28,7 +28,7 @@
#include "mimetreeparser_debug.h"
using namespace MessageViewer;
using namespace MimeTreeParser;
const MailmanBodyPartFormatter *MailmanBodyPartFormatter::self;
......
......@@ -23,7 +23,7 @@
#include "interfaces/bodypartformatter.h"
#include "interfaces/bodypart.h"
namespace MessageViewer
namespace MimeTreeParser
{
class MailmanBodyPartFormatter : public Interface::BodyPartFormatter
......@@ -41,4 +41,4 @@ private:
}
#endif
\ No newline at end of file
#endif
......@@ -21,9 +21,9 @@
#include <MessageCore/NodeHelper>
using namespace MessageViewer;
using namespace MimeTreeParser;
MimeMessagePart::Ptr MessageViewer::createAndParseTempNode(Interface::BodyPart &part, KMime::Content *parentNode, const char *content, const char *cntDesc)
MimeMessagePart::Ptr MimeTreeParser::createAndParseTempNode(Interface::BodyPart &part, KMime::Content *parentNode, const char *content, const char *cntDesc)
{
KMime::Content *newNode = new KMime::Content();
newNode->setContent(KMime::CRLFtoLF(content));
......@@ -37,7 +37,7 @@ MimeMessagePart::Ptr MessageViewer::createAndParseTempNode(Interface::BodyPart &
return MimeMessagePart::Ptr(new MimeMessagePart(part.objectTreeParser(), newNode, false));
}
KMime::Content *MessageViewer::findType(KMime::Content *content, const QByteArray &mimeType, bool deep, bool wide)
KMime::Content *MimeTreeParser::findType(KMime::Content *content, const QByteArray &mimeType, bool deep, bool wide)
{
if ((!content->contentType()->isEmpty())
&& (mimeType.isEmpty() || (mimeType == content->contentType()->mimeType()))) {
......
......@@ -25,7 +25,7 @@
#include <KMime/Content>
namespace MessageViewer
namespace MimeTreeParser
{
/**
1. Create a new partNode using 'content' data and Content-Description
......@@ -38,4 +38,4 @@ MimeMessagePart::Ptr createAndParseTempNode(Interface::BodyPart &part, KMime::Co
KMime::Content *findType(KMime::Content *content, const QByteArray &mimeType, bool deep, bool wide);
}
#endif
\ No newline at end of file
#endif
......@@ -33,7 +33,7 @@
#include "mimetreeparser_debug.h"
namespace MessageViewer
namespace MimeTreeParser
{
FileHtmlWriter::FileHtmlWriter(const QString &filename)
......
Supports Markdown
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