Commit 3d594846 authored by Sandro Knauß's avatar Sandro Knauß

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)
......
......@@ -40,7 +40,7 @@
class QString;
namespace MessageViewer
namespace MimeTreeParser
{
class MIMETREEPARSER_EXPORT FileHtmlWriter : public HtmlWriter
......@@ -65,6 +65,6 @@ private:
QTextStream mStream;
};
} // namespace MessageViewer
} // namespace MimeTreeParser
#endif // __MIMETREEPARSER_FILEHTMLWRITER_H__
......@@ -24,7 +24,7 @@
#include<QByteArray>
#include<QString>
using namespace MessageViewer;
using namespace MimeTreeParser;
QueueHtmlWriter::QueueHtmlWriter(HtmlWriter *base)
: HtmlWriter()
......
......@@ -29,7 +29,7 @@
class QString;
class QByteArray;
namespace MessageViewer
namespace MimeTreeParser
{
/**
\brief Cache HTML output and not write them directy.
......@@ -50,7 +50,7 @@ struct Command {
class MIMETREEPARSER_DEPRECATED_EXPORT QueueHtmlWriter : public HtmlWriter
{
public:
explicit QueueHtmlWriter(MessageViewer::HtmlWriter *base);
explicit QueueHtmlWriter(MimeTreeParser::HtmlWriter *base);
virtual ~QueueHtmlWriter();
void begin(const QString &cssDefs) Q_DECL_OVERRIDE;
......@@ -69,6 +69,6 @@ private:
QVector<Command> mQueue;
};
} // namespace MessageViewer
} // namespace MimeTreeParser
#endif // __MIMETREEPARSER_QUEUEHTMLWRITER_H__
......@@ -42,7 +42,7 @@ namespace KMime
class Content;
}
namespace MessageViewer
namespace MimeTreeParser
{
class NodeHelper;
class ObjectTreeParser;
......@@ -191,14 +191,14 @@ public:
* Ok, this is ugly, exposing the node helper here, but there is too much useful stuff in there
* for real-world plugins. Still, there should be a nicer way for this.
*/
virtual MessageViewer::NodeHelper *nodeHelper() const = 0;
virtual MimeTreeParser::NodeHelper *nodeHelper() const = 0;
/**
* For making it easier to refactor, add objectTreeParser
*/
virtual MessageViewer::ObjectTreeParser *objectTreeParser() const = 0;
virtual MessageViewer::ObjectTreeSourceIf *source() const = 0;
virtual MessageViewer::ProcessResult *processResult() const = 0;
virtual MimeTreeParser::ObjectTreeParser *objectTreeParser() const = 0;
virtual MimeTreeParser::ObjectTreeSourceIf *source() const = 0;
virtual MimeTreeParser::ProcessResult *processResult() const = 0;
};
} // namespace Interface
......
......@@ -36,7 +36,7 @@
#include "htmlwriter/queuehtmlwriter.h"
#include "viewer/objecttreeparser.h"
using namespace MessageViewer::Interface;
using namespace MimeTreeParser::Interface;
MessagePart::MessagePart()
: mHtmlWriter(Q_NULLPTR)
......@@ -66,7 +66,7 @@ QString MessagePart::text() const
return QString();
}
MessageViewer::HtmlWriter *MessagePart::htmlWriter()
MimeTreeParser::HtmlWriter *MessagePart::htmlWriter()
{
if (!mHtmlWriter) {
mHtmlWriter = mPart->objectTreeParser()->htmlWriter();
......
......@@ -41,7 +41,7 @@
#include "mimetreeparser/objecttreeparser.h"
namespace MessageViewer
namespace MimeTreeParser
{
class HtmlWriter;
......@@ -63,9 +63,9 @@ public:
virtual QString text() const;
private:
MessageViewer::HtmlWriter *htmlWriter();
MimeTreeParser::HtmlWriter *htmlWriter();
MessageViewer::HtmlWriter *mHtmlWriter;
MimeTreeParser::HtmlWriter *mHtmlWriter;
const BodyPart *mPart;
friend class BodyPartFormatter;
......@@ -90,7 +90,7 @@ public:
@return the result code (see above)
*/
virtual Result format(BodyPart *part, MessageViewer::HtmlWriter *writer) const = 0;
virtual Result format(BodyPart *part, MimeTreeParser::HtmlWriter *writer) const = 0;
/**
Variant of format that allows implementors to hook notifications up to
......@@ -98,7 +98,7 @@ public:
@return the result code (see above)
*/
virtual Result format(BodyPart *part, MessageViewer::HtmlWriter *writer, QObject *asyncResultObserver) const
virtual Result format(BodyPart *part, MimeTreeParser::HtmlWriter *writer, QObject *asyncResultObserver) const
{
Q_UNUSED(asyncResultObserver);
return format(part, writer);
......
......@@ -36,7 +36,7 @@
class QByteArray;
class QString;
namespace MessageViewer
namespace MimeTreeParser
{
/**
* @short An interface for HTML sinks.
......
......@@ -29,7 +29,7 @@
using namespace Kleo;
using namespace GpgME;
using namespace MessageViewer;
using namespace MimeTreeParser;
using boost::shared_ptr;
KleoJobExecutor::KleoJobExecutor(QObject *parent) : QObject(parent)
......
......@@ -37,7 +37,7 @@ class VerifyDetachedJob;
class VerifyOpaqueJob;
}
namespace MessageViewer
namespace MimeTreeParser
{
/**
......
......@@ -28,7 +28,7 @@
class QObject;
class QTextCodec;
namespace MessageViewer
namespace MimeTreeParser
{
class HtmlWriter;
class CSSHelperBase;
......@@ -36,7 +36,7 @@ class AttachmentStrategy;
class BodyPartFormatterBaseFactory;
}
namespace MessageViewer
namespace MimeTreeParser
{
/**
......@@ -56,7 +56,7 @@ public:
* information to the user, for example KMail displays a HTML status bar.
* Note: This is not called when the mode is "Normal".
*/
virtual void setHtmlMode(MessageViewer::Util::HtmlMode mode) = 0;
virtual void setHtmlMode(MimeTreeParser::Util::HtmlMode mode) = 0;
/** Return true if the mail should be parsed as a html mail */
virtual bool htmlMail() const = 0;
......
......@@ -21,7 +21,7 @@
#include <KIconLoader>
namespace MessageViewer
namespace MimeTreeParser
{
Q_GLOBAL_STATIC(IconNameCache, s_iconNameCache)
......
......@@ -23,7 +23,7 @@
#include <QString>
#include "mimetreeparser_export.h"
namespace MessageViewer
namespace MimeTreeParser
{
/**
......