Commit 945dedb4 authored by Sandro Knauß's avatar Sandro Knauß

Make namespace shift from MessageViewer-> MimeTreeParser

parent 3d594846
......@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
set(MESSAGELIB_LIB_VERSION "5.2.45")
set(MESSAGELIB_LIB_VERSION "5.2.46")
set(KF5_VERSION "5.19.0")
set(KDEPIMLIBS_LIB_VERSION "5.2.40")
......
......@@ -156,14 +156,14 @@ void CryptoComposerTest::testEncryptSameAttachments()
TestCSSHelper testCSSHelper;
MessageComposer::Test::TestObjectTreeSource testSource(&testWriter, &testCSSHelper);
testSource.setAllowDecryption(true);
MessageViewer::NodeHelper *nh = new MessageViewer::NodeHelper;
MessageViewer::ObjectTreeParser otp(&testSource, nh);
MessageViewer::ProcessResult pResult(nh);
MimeTreeParser::NodeHelper *nh = new MimeTreeParser::NodeHelper;
MimeTreeParser::ObjectTreeParser otp(&testSource, nh);
MimeTreeParser::ProcessResult pResult(nh);
otp.parseObjectTree(message.data());
KMime::Message::Ptr unencrypted = nh->unencryptedMessage(message);
KMime::Content *testAttachment = MessageViewer::ObjectTreeParser::findType(unencrypted.data(), "x-some", "x-type", true, true);
KMime::Content *testAttachment = MimeTreeParser::ObjectTreeParser::findType(unencrypted.data(), "x-some", "x-type", true, true);
QCOMPARE(testAttachment->body(), QString::fromLatin1("abc").toUtf8());
QCOMPARE(testAttachment->contentDisposition()->filename(), QString::fromLatin1("anattachment.txt"));
......
......@@ -63,32 +63,32 @@ void ComposerTestUtil::verifySignature(KMime::Content *content, QByteArray signe
TestHtmlWriter testWriter;
TestCSSHelper testCSSHelper;
MessageComposer::Test::TestObjectTreeSource testSource(&testWriter, &testCSSHelper);
MessageViewer::NodeHelper *nh = new MessageViewer::NodeHelper;
MessageViewer::ObjectTreeParser otp(&testSource, nh);
MessageViewer::ProcessResult pResult(nh);
MimeTreeParser::NodeHelper *nh = new MimeTreeParser::NodeHelper;
MimeTreeParser::ObjectTreeParser otp(&testSource, nh);
MimeTreeParser::ProcessResult pResult(nh);
// ensure the signed part exists and is parseable
if (f & Kleo::OpenPGPMIMEFormat) {
// process the result..
otp.parseObjectTree(resultMessage);
KMime::Content *signedPart = MessageViewer::ObjectTreeParser::findType(resultMessage, "application", "pgp-signature", true, true);
KMime::Content *signedPart = MimeTreeParser::ObjectTreeParser::findType(resultMessage, "application", "pgp-signature", true, true);
Q_ASSERT(signedPart);
QCOMPARE(signedPart->contentTransferEncoding()->encoding(), KMime::Headers::CE7Bit);
Q_UNUSED(signedPart);
//Q_ASSERT( nh->signatureState( resultMessage ) == MessageViewer::KMMsgFullySigned );
//Q_ASSERT( nh->signatureState( resultMessage ) == MimeTreeParser::KMMsgFullySigned );
QCOMPARE(MessageCore::NodeHelper::firstChild(resultMessage)->contentTransferEncoding()->encoding(), encoding);
} else if (f & Kleo::InlineOpenPGPFormat) {
// process the result..
otp.parseObjectTree(resultMessage);
QCOMPARE(nh->signatureState(resultMessage), MessageViewer::KMMsgFullySigned);
QCOMPARE(nh->signatureState(resultMessage), MimeTreeParser::KMMsgFullySigned);
QCOMPARE(resultMessage->contentTransferEncoding()->encoding(), encoding);
} else if (f & Kleo::AnySMIME) {
if (f & Kleo::SMIMEFormat) {
KMime::Content *signedPart = MessageViewer::ObjectTreeParser::findType(resultMessage, "application", "pkcs7-signature", true, true);
KMime::Content *signedPart = MimeTreeParser::ObjectTreeParser::findType(resultMessage, "application", "pkcs7-signature", true, true);
Q_ASSERT(signedPart);
QCOMPARE(signedPart->contentTransferEncoding()->encoding(), KMime::Headers::CEbase64);
QCOMPARE(signedPart->contentType()->mimeType(), QByteArray("application/pkcs7-signature"));
......@@ -104,7 +104,7 @@ void ComposerTestUtil::verifySignature(KMime::Content *content, QByteArray signe
QCOMPARE(resultMessage->contentType()->parameter(QString::fromLatin1("micalg")), QString::fromLatin1("sha1"));
} else if (f & Kleo::SMIMEOpaqueFormat) {
KMime::Content *signedPart = MessageViewer::ObjectTreeParser::findType(resultMessage, "application", "pkcs7-mime", true, true);
KMime::Content *signedPart = MimeTreeParser::ObjectTreeParser::findType(resultMessage, "application", "pkcs7-mime", true, true);
Q_ASSERT(signedPart);
QCOMPARE(signedPart->contentTransferEncoding()->encoding(), KMime::Headers::CEbase64);
QCOMPARE(signedPart->contentType()->mimeType(), QByteArray("application/pkcs7-mime"));
......@@ -117,7 +117,7 @@ void ComposerTestUtil::verifySignature(KMime::Content *content, QByteArray signe
// process the result..
otp.parseObjectTree(resultMessage);
//Q_ASSERT( nh->signatureState( resultMessage ) == MessageViewer::KMMsgFullySigned );
//Q_ASSERT( nh->signatureState( resultMessage ) == MimeTreeParser::KMMsgFullySigned );
}
// make sure the good sig is of what we think it is
......@@ -138,19 +138,19 @@ void ComposerTestUtil::verifyEncryption(KMime::Content *content, QByteArray encr
TestCSSHelper testCSSHelper;
MessageComposer::Test::TestObjectTreeSource testSource(&testWriter, &testCSSHelper);
testSource.setAllowDecryption(true);
MessageViewer::NodeHelper *nh = new MessageViewer::NodeHelper;
MessageViewer::ObjectTreeParser otp(&testSource, nh);
MessageViewer::ProcessResult pResult(nh);
MimeTreeParser::NodeHelper *nh = new MimeTreeParser::NodeHelper;
MimeTreeParser::ObjectTreeParser otp(&testSource, nh);
MimeTreeParser::ProcessResult pResult(nh);
if (f & Kleo::OpenPGPMIMEFormat) {
// ensure the enc part exists and is parseable
KMime::Content *encPart = MessageViewer::ObjectTreeParser::findType(resultMessage.data(), "application", "pgp-encrypted", true, true);
KMime::Content *encPart = MimeTreeParser::ObjectTreeParser::findType(resultMessage.data(), "application", "pgp-encrypted", true, true);
Q_ASSERT(encPart);
Q_UNUSED(encPart);
// process the result..
otp.parseObjectTree(resultMessage.data());
QCOMPARE(nh->encryptionState(resultMessage.data()), MessageViewer::KMMsgFullyEncrypted);
QCOMPARE(nh->encryptionState(resultMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
} else if (f & Kleo::InlineOpenPGPFormat) {
if (withAttachment) {
......@@ -162,11 +162,11 @@ void ComposerTestUtil::verifyEncryption(KMime::Content *content, QByteArray encr
otp.processTextPlainSubtype(resultMessage.data(), pResult);
QCOMPARE(pResult.inlineEncryptionState(), MessageViewer::KMMsgFullyEncrypted);
QCOMPARE(pResult.inlineEncryptionState(), MimeTreeParser::KMMsgFullyEncrypted);
} else if (f & Kleo::AnySMIME) {
// ensure the enc part exists and is parseable
KMime::Content *encPart = MessageViewer::ObjectTreeParser::findType(resultMessage.data(), "application", "pkcs7-mime", true, true);
KMime::Content *encPart = MimeTreeParser::ObjectTreeParser::findType(resultMessage.data(), "application", "pkcs7-mime", true, true);
Q_ASSERT(encPart);
QCOMPARE(encPart->contentType()->mimeType(), QByteArray("application/pkcs7-mime"));
......@@ -177,7 +177,7 @@ void ComposerTestUtil::verifyEncryption(KMime::Content *content, QByteArray encr
Q_UNUSED(encPart);
otp.parseObjectTree(resultMessage.data());
QCOMPARE(nh->encryptionState(resultMessage.data()), MessageViewer::KMMsgFullyEncrypted);
QCOMPARE(nh->encryptionState(resultMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
}
QCOMPARE(otp.plainTextContent().trimmed(), QString::fromUtf8(encrContent).trimmed());
......@@ -197,29 +197,29 @@ void ComposerTestUtil::verifySignatureAndEncryption(KMime::Content *content, QBy
TestCSSHelper testCSSHelper;
MessageComposer::Test::TestObjectTreeSource testSource(&testWriter, &testCSSHelper);
testSource.setAllowDecryption(true);
MessageViewer::NodeHelper *nh = new MessageViewer::NodeHelper;
MessageViewer::ObjectTreeParser otp(&testSource, nh);
MessageViewer::ProcessResult pResult(nh);
MimeTreeParser::NodeHelper *nh = new MimeTreeParser::NodeHelper;
MimeTreeParser::ObjectTreeParser otp(&testSource, nh);
MimeTreeParser::ProcessResult pResult(nh);
if (f & Kleo::OpenPGPMIMEFormat) {
// ensure the enc part exists and is parseable
KMime::Content *encPart = MessageViewer::ObjectTreeParser::findType(resultMessage.data(), "application", "pgp-encrypted", true, true);
KMime::Content *encPart = MimeTreeParser::ObjectTreeParser::findType(resultMessage.data(), "application", "pgp-encrypted", true, true);
Q_ASSERT(encPart);
Q_UNUSED(encPart);
otp.parseObjectTree(resultMessage.data());
QCOMPARE(nh->encryptionState(resultMessage.data()), MessageViewer::KMMsgFullyEncrypted);
QCOMPARE(nh->encryptionState(resultMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
QList< KMime::Content * > extra = nh->extraContents(resultMessage.data());
qDebug() << "size:" << extra.size();
QCOMPARE(extra.size(), 1);
QCOMPARE(nh->signatureState(extra[ 0 ]), MessageViewer::KMMsgFullySigned);
QCOMPARE(nh->signatureState(extra[ 0 ]), MimeTreeParser::KMMsgFullySigned);
} else if (f & Kleo::InlineOpenPGPFormat) {
otp.processTextPlainSubtype(resultMessage.data(), pResult);
QCOMPARE(pResult.inlineEncryptionState(), MessageViewer::KMMsgFullyEncrypted);
QCOMPARE(pResult.inlineSignatureState(), MessageViewer::KMMsgFullySigned);
QCOMPARE(pResult.inlineEncryptionState(), MimeTreeParser::KMMsgFullyEncrypted);
QCOMPARE(pResult.inlineSignatureState(), MimeTreeParser::KMMsgFullySigned);
} else if (f & Kleo::AnySMIME) {
KMime::Content *encPart = MessageViewer::ObjectTreeParser::findType(resultMessage.data(), "application", "pkcs7-mime", true, true);
KMime::Content *encPart = MimeTreeParser::ObjectTreeParser::findType(resultMessage.data(), "application", "pkcs7-mime", true, true);
Q_ASSERT(encPart);
QCOMPARE(encPart->contentType()->mimeType(), QByteArray("application/pkcs7-mime"));
QCOMPARE(encPart->contentType()->name(), QString::fromLatin1("smime.p7m"));
......@@ -229,12 +229,12 @@ void ComposerTestUtil::verifySignatureAndEncryption(KMime::Content *content, QBy
Q_UNUSED(encPart);
otp.parseObjectTree(resultMessage.data());
QCOMPARE(nh->encryptionState(resultMessage.data()), MessageViewer::KMMsgFullyEncrypted);
QCOMPARE(nh->encryptionState(resultMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
QList< KMime::Content * > extra = nh->extraContents(resultMessage.data());
qDebug() << "size:" << extra.size();
QCOMPARE(extra.size(), 1);
QCOMPARE(nh->signatureState(extra[ 0 ]), MessageViewer::KMMsgFullySigned);
QCOMPARE(nh->signatureState(extra[ 0 ]), MimeTreeParser::KMMsgFullySigned);
}
QCOMPARE(otp.plainTextContent().trimmed(), QString::fromUtf8(origContent).trimmed());
Q_UNUSED(origContent);
......
......@@ -370,12 +370,12 @@ void MessageFactoryTest::testCreateMDN()
TestHtmlWriter testWriter;
TestCSSHelper testCSSHelper;
TestObjectTreeSource testSource( &testWriter, &testCSSHelper );
MessageViewer::NodeHelper* nh = new MessageViewer::NodeHelper;
MessageViewer::ObjectTreeParser otp( &testSource, nh, 0, false, true, 0 );
MessageViewer::ProcessResult pResult( nh ); */
MimeTreeParser::NodeHelper* nh = new MimeTreeParser::NodeHelper;
MimeTreeParser::ObjectTreeParser otp( &testSource, nh, 0, false, true, 0 );
MimeTreeParser::ProcessResult pResult( nh ); */
// qDebug() << MessageCore::NodeHelper::firstChild( mdn->mainBodyPart() )->encodedContent();
// qDebug() << MessageCore::NodeHelper::next( MessageViewer::ObjectTreeParser::findType( mdn.data(), "multipart", "report", true, true ) )->body();
// qDebug() << MessageCore::NodeHelper::next( MimeTreeParser::ObjectTreeParser::findType( mdn.data(), "multipart", "report", true, true ) )->body();
QString mdnContent = QString::fromLatin1("The message sent on %1 to %2 with subject \"%3\" has been displayed. "
"This is no guarantee that the message has been read or understood.");
......@@ -384,7 +384,7 @@ void MessageFactoryTest::testCreateMDN()
qDebug() << "comparing with:" << mdnContent;
QCOMPARE_OR_DIFF(MessageCore::NodeHelper::next(MessageViewer::ObjectTreeParser::findType(mdn.data(), "multipart", "report", true, true))->body(),
QCOMPARE_OR_DIFF(MessageCore::NodeHelper::next(MimeTreeParser::ObjectTreeParser::findType(mdn.data(), "multipart", "report", true, true))->body(),
mdnContent.toLatin1());
}
......
......@@ -50,24 +50,24 @@ std::vector<GpgME::Key> getKeys(bool smime = false);
class TestObjectTreeSource : public MessageViewer::EmptySource
{
public:
TestObjectTreeSource(MessageViewer::HtmlWriter *writer,
MessageViewer::CSSHelperBase *cssHelper)
TestObjectTreeSource(MimeTreeParser::HtmlWriter *writer,
MimeTreeParser::CSSHelperBase *cssHelper)
: mWriter(writer), mCSSHelper(cssHelper)
{
}
virtual MessageViewer::HtmlWriter *htmlWriter()
virtual MimeTreeParser::HtmlWriter *htmlWriter()
{
return mWriter;
}
virtual MessageViewer::CSSHelperBase *cssHelper()
virtual MimeTreeParser::CSSHelperBase *cssHelper()
{
return mCSSHelper;
}
private:
MessageViewer::HtmlWriter *mWriter;
MessageViewer::CSSHelperBase *mCSSHelper;
MimeTreeParser::HtmlWriter *mWriter;
MimeTreeParser::CSSHelperBase *mCSSHelper;
};
}
......
......@@ -25,7 +25,7 @@
// Objecttreeparser needs a valid html writer othewise it doesn't parse
// inline messages, so give it one to chew on.
class TestHtmlWriter : public MessageViewer::HtmlWriter
class TestHtmlWriter : public MimeTreeParser::HtmlWriter
{
public:
explicit TestHtmlWriter() {}
......
......@@ -909,7 +909,7 @@ void AttachmentControllerBase::showAddAttachmentFileDialog()
d->wParent,
i18nc("@title:window", "Attach File"));
if (!result.URLs.isEmpty()) {
const QString encoding = MessageViewer::NodeHelper::fixEncoding(result.encoding);
const QString encoding = MimeTreeParser::NodeHelper::fixEncoding(result.encoding);
const int numberOfFiles(result.URLs.count());
for (int i = 0; i < numberOfFiles; ++i) {
const QUrl url = result.URLs.at(i);
......
......@@ -181,7 +181,7 @@ void MessageComposer::ComposerViewBase::setMessage(const KMime::Message::Ptr &ms
msgContent->setContent(m_msg->encodedContent());
msgContent->parse();
MessageViewer::EmptySource emptySource;
MessageViewer::ObjectTreeParser otp(&emptySource); //All default are ok
MimeTreeParser::ObjectTreeParser otp(&emptySource); //All default are ok
emptySource.setAllowDecryption(allowDecryption);
otp.parseObjectTree(msgContent);
......@@ -229,7 +229,7 @@ void MessageComposer::ComposerViewBase::updateTemplate(const KMime::Message::Ptr
msgContent->setContent(msg->encodedContent());
msgContent->parse();
MessageViewer::EmptySource emptySource;
MessageViewer::ObjectTreeParser otp(&emptySource); //All default are ok
MimeTreeParser::ObjectTreeParser otp(&emptySource); //All default are ok
otp.parseObjectTree(msgContent);
// Set the HTML text and collect HTML images
if (!otp.htmlContent().isEmpty()) {
......@@ -1650,7 +1650,7 @@ int MessageComposer::ComposerViewBase::autoSaveInterval() const
//-----------------------------------------------------------------------------
void MessageComposer::ComposerViewBase::collectImages(KMime::Content *root)
{
if (KMime::Content *n = MessageViewer::ObjectTreeParser::findType(root, "multipart/alternative", true, true)) {
if (KMime::Content *n = MimeTreeParser::ObjectTreeParser::findType(root, "multipart/alternative", true, true)) {
KMime::Content *parentnode = n->parent();
if (parentnode &&
parentnode->contentType()->isMultipart() &&
......
......@@ -43,8 +43,8 @@ void setupEnv();
class TestObjectTreeSource : public MessageViewer::EmptySource
{
public:
TestObjectTreeSource(MessageViewer::HtmlWriter *writer,
MessageViewer::CSSHelperBase *cssHelper)
TestObjectTreeSource(MimeTreeParser::HtmlWriter *writer,
MimeTreeParser::CSSHelperBase *cssHelper)
: mWriter(writer)
, mCSSHelper(cssHelper)
, mAttachmentStrategy(QStringLiteral("smart"))
......@@ -53,10 +53,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;
}
......@@ -85,8 +85,8 @@ public:
mAttachmentStrategy = strategy;
}
const AttachmentStrategy *attachmentStrategy() Q_DECL_OVERRIDE {
return AttachmentStrategy::create(mAttachmentStrategy);
const MimeTreeParser::AttachmentStrategy *attachmentStrategy() Q_DECL_OVERRIDE {
return MimeTreeParser::AttachmentStrategy::create(mAttachmentStrategy);
}
bool autoImportKeys() const Q_DECL_OVERRIDE
......@@ -105,8 +105,8 @@ public:
}
private:
MessageViewer::HtmlWriter *mWriter;
MessageViewer::CSSHelperBase *mCSSHelper;
MimeTreeParser::HtmlWriter *mWriter;
MimeTreeParser::CSSHelperBase *mCSSHelper;
QString mAttachmentStrategy;
bool mHtmlLoadExternal;
bool mHtmlMail;
......
......@@ -40,7 +40,7 @@ namespace MessageViewer
{
TestCSSHelper::TestCSSHelper(const QPaintDevice *pd) :
CSSHelperBase(pd)
MimeTreeParser::CSSHelperBase(pd)
{
mRecycleQuoteColors = false;
mBackgroundColor = QColor(0xff, 0xff, 0xff);
......
......@@ -37,7 +37,7 @@
namespace MessageViewer
{
class TestCSSHelper : public CSSHelperBase
class TestCSSHelper : public MimeTreeParser::CSSHelperBase
{
public:
explicit TestCSSHelper(const QPaintDevice *pd);
......
......@@ -21,7 +21,7 @@
#include <KMime/Message>
class TestHtmlWriter : public MessageViewer::HtmlWriter
class TestHtmlWriter : public MimeTreeParser::HtmlWriter
{
public:
explicit TestHtmlWriter() {}
......
......@@ -57,7 +57,7 @@ void ContactDisplayMessageMemento::slotSearchJobFinished(KJob *job)
Akonadi::ContactSearchJob *searchJob = static_cast<Akonadi::ContactSearchJob *>(job);
if (searchJob->error()) {
qCWarning(MESSAGEVIEWER_LOG) << "Unable to fetch contact:" << searchJob->errorText();
Q_EMIT update(Delayed);
Q_EMIT update(MimeTreeParser::Delayed);
return;
}
......@@ -73,7 +73,7 @@ void ContactDisplayMessageMemento::slotSearchJobFinished(KJob *job)
if (!mPhoto.isEmpty()) {
//We have a data raw => we can update message
if (mPhoto.isIntern()) {
Q_EMIT update(Delayed);
Q_EMIT update(MimeTreeParser::Delayed);
} else {
QUrl url = QUrl::fromUserInput(mPhoto.url(), QString(), QUrl::AssumeLocalFile);
QImage image;
......@@ -98,7 +98,7 @@ void ContactDisplayMessageMemento::slotSearchJobFinished(KJob *job)
}
if (ok) {
mImageFromUrl = image;
Q_EMIT update(Delayed);
Q_EMIT update(MimeTreeParser::Delayed);
}
}
}
......@@ -131,7 +131,7 @@ bool ContactDisplayMessageMemento::finished() const
void ContactDisplayMessageMemento::detach()
{
disconnect(this, SIGNAL(update(MessageViewer::UpdateMode)), 0, 0);
disconnect(this, SIGNAL(update(MimeTreeParser::UpdateMode)), 0, 0);
disconnect(this, SIGNAL(changeDisplayMail(Viewer::DisplayFormatMessage,bool)), 0, 0);
}
......@@ -193,6 +193,6 @@ void ContactDisplayMessageMemento::slotGravatarResolvUrlFinished(Gravatar::Grava
{
if (job && job->hasGravatar()) {
mGravatarPixmap = job->pixmap();
Q_EMIT update(Delayed);
Q_EMIT update(MimeTreeParser::Delayed);
}
}
......@@ -41,7 +41,7 @@ class ContactSearchJob;
namespace MessageViewer
{
class ContactDisplayMessageMemento : public QObject, public Interface::BodyPartMemento
class ContactDisplayMessageMemento : public QObject, public MimeTreeParser::Interface::BodyPartMemento
{
Q_OBJECT
public:
......@@ -61,7 +61,7 @@ public:
Q_SIGNALS:
// TODO: Factor our update and detach into base class
void update(MessageViewer::UpdateMode);
void update(MimeTreeParser::UpdateMode);
void changeDisplayMail(Viewer::DisplayFormatMessage displayAsHtml, bool remoteContent);
private Q_SLOTS:
......
......@@ -254,7 +254,7 @@ QString GrantleeHeaderFormatter::format(const QString &absolutePath, const Grant
headerObject.insert(QStringLiteral("hasAttachment"), messageHasAttachment);
if (messageHasAttachment) {
const QString iconPath = IconNameCache::instance()->iconPath(QStringLiteral("mail-attachment"), KIconLoader::Toolbar);
const QString iconPath = MimeTreeParser::IconNameCache::instance()->iconPath(QStringLiteral("mail-attachment"), KIconLoader::Toolbar);
const QString html = QStringLiteral("<img height=\"%2\" width=\"%2\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), QString::number(d->iconSize));
headerObject.insert(QStringLiteral("attachmentIcon"), html);
}
......
......@@ -112,12 +112,12 @@ bool HeaderStyle::isTopLevel() const
return mTopLevel;
}
void HeaderStyle::setNodeHelper(NodeHelper *nodeHelper)
void HeaderStyle::setNodeHelper(MimeTreeParser::NodeHelper *nodeHelper)
{
mNodeHelper = nodeHelper;
}
NodeHelper *HeaderStyle::nodeHelper() const
MimeTreeParser::NodeHelper *HeaderStyle::nodeHelper() const
{
return mNodeHelper;
}
......
......@@ -43,11 +43,15 @@
class QString;
namespace MimeTreeParser
{
class NodeHelper;
}
namespace MessageViewer
{
class HeaderStrategy;
class NodeHelper;
/** This class encapsulates the visual appearance of message
headers. Together with HeaderStrategy, which determines
......@@ -93,8 +97,8 @@ public:
void setTopLevel(bool topLevel);
bool isTopLevel() const;
void setNodeHelper(NodeHelper *nodeHelper);
NodeHelper *nodeHelper() const;
void setNodeHelper(MimeTreeParser::NodeHelper *nodeHelper);
MimeTreeParser::NodeHelper *nodeHelper() const;
void setAllowAsync(bool allowAsync);
bool allowAsync() const;
......@@ -119,7 +123,7 @@ private:
const HeaderStrategy *mStrategy;
QString mVCardName;
QString mCollectionName;
NodeHelper *mNodeHelper;
MimeTreeParser::NodeHelper *mNodeHelper;
QObject *mSourceObject;
Akonadi::MessageStatus mMessageStatus;
bool mPrinting;
......
......@@ -104,7 +104,7 @@ QString HeaderStyleUtil::subjectDirectionString(KMime::Message *message) const
{
QString subjectDir;
if (message->subject(false)) {
subjectDir = directionOf(NodeHelper::cleanSubject(message));
subjectDir = directionOf(MimeTreeParser::NodeHelper::cleanSubject(message));
} else {
subjectDir = directionOf(i18n("No Subject"));
}
......@@ -310,8 +310,8 @@ HeaderStyleUtil::xfaceSettings HeaderStyleUtil::xface(const MessageViewer::Heade
const QString email = QString::fromLatin1(KEmailAddress::firstEmailAddress(message->from()->as7BitString(false)));
photoMemento = new ContactDisplayMessageMemento(email);
style->nodeHelper()->setBodyPartMemento(message, "contactphoto", photoMemento);
QObject::connect(photoMemento, SIGNAL(update(MessageViewer::UpdateMode)),
style->sourceObject(), SLOT(update(MessageViewer::UpdateMode)));
QObject::connect(photoMemento, SIGNAL(update(MimeTreeParser::UpdateMode)),
style->sourceObject(), SLOT(update(MimeTreeParser::UpdateMode)));
QObject::connect(photoMemento, SIGNAL(changeDisplayMail(Viewer::DisplayFormatMessage,bool)),
style->sourceObject(), SIGNAL(changeDisplayMail(Viewer::DisplayFormatMessage,bool)));
......@@ -406,37 +406,37 @@ QString HeaderStyleUtil::mailAction(Viewer::MailAction action) const
QString html;
switch (action) {
case Viewer::Trash: {
const QString iconPath = IconNameCache::instance()->iconPath(QStringLiteral("user-trash"), KIconLoader::Toolbar);
const QString iconPath = MimeTreeParser::IconNameCache::instance()->iconPath(QStringLiteral("user-trash"), KIconLoader::Toolbar);
html = QStringLiteral("<a href=\"kmailaction:trash\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("Move to Trash"), QString::number(mIconSize));
break;
}
case Viewer::Reply: {
const QString iconPath = IconNameCache::instance()->iconPath(QStringLiteral("mail-reply-sender"), KIconLoader::Toolbar);
const QString iconPath = MimeTreeParser::IconNameCache::instance()->iconPath(QStringLiteral("mail-reply-sender"), KIconLoader::Toolbar);
html = QStringLiteral("<a href=\"kmailaction:reply\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("Reply"), QString::number(mIconSize));
break;
}
case Viewer::ReplyToAll: {
const QString iconPath = IconNameCache::instance()->iconPath(QStringLiteral("mail-reply-all"), KIconLoader::Toolbar);
const QString iconPath = MimeTreeParser::IconNameCache::instance()->iconPath(QStringLiteral("mail-reply-all"), KIconLoader::Toolbar);
html = QStringLiteral("<a href=\"kmailaction:replyToAll\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("Reply to All"), QString::number(mIconSize));
break;
}
case Viewer::Forward: {
const QString iconPath = IconNameCache::instance()->iconPath(QStringLiteral("mail-forward"), KIconLoader::Toolbar);
const QString iconPath = MimeTreeParser::IconNameCache::instance()->iconPath(QStringLiteral("mail-forward"), KIconLoader::Toolbar);
html = QStringLiteral("<a href=\"kmailaction:forward\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("Forward"), QString::number(mIconSize));
break;
}
case Viewer::NewMessage: {
const QString iconPath = IconNameCache::instance()->iconPath(QStringLiteral("mail-message-new"), KIconLoader::Toolbar);
const QString iconPath = MimeTreeParser::IconNameCache::instance()->iconPath(QStringLiteral("mail-message-new"), KIconLoader::Toolbar);
html = QStringLiteral("<a href=\"kmailaction:newMessage\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("New Message"), QString::number(mIconSize));
break;
}
case Viewer::Print: {
const QString iconPath = IconNameCache::instance()->iconPath(QStringLiteral("document-print"), KIconLoader::Toolbar);
const QString iconPath = MimeTreeParser::IconNameCache::instance()->iconPath(QStringLiteral("document-print"), KIconLoader::Toolbar);
html = QStringLiteral("<a href=\"kmailaction:print\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("Print"), QString::number(mIconSize));
break;
}
case Viewer::PrintPreview: {
const QString iconPath = IconNameCache::instance()->iconPath(QStringLiteral("document-print-preview"), KIconLoader::Toolbar);
const QString iconPath = MimeTreeParser::IconNameCache::instance()->iconPath(QStringLiteral("document-print-preview"), KIconLoader::Toolbar);
html = QStringLiteral("<a href=\"kmailaction:printpreview\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("Print Preview"), QString::number(mIconSize));
break;
}
......
......@@ -34,8 +34,8 @@
namespace MessageViewer
{
TeeHtmlWriter::TeeHtmlWriter(HtmlWriter *writer1, HtmlWriter *writer2)
: HtmlWriter()
TeeHtmlWriter::TeeHtmlWriter(HtmlWriter *writer1, MimeTreeParser::HtmlWriter *writer2)
: MimeTreeParser::HtmlWriter()
{
if (writer1) {
mWriters.append(writer1);
......
......@@ -44,11 +44,11 @@ namespace MessageViewer
/** @short A HtmlWriter that dispatches all calls to a list of other HtmlWriters
@author Marc Mutz <mutz@kde.org>
**/
class TeeHtmlWriter : public HtmlWriter
class TeeHtmlWriter : public MimeTreeParser::HtmlWriter
{
public:
explicit TeeHtmlWriter(HtmlWriter *writer1 = 0,
HtmlWriter *writer2 = 0);
MimeTreeParser::HtmlWriter *writer2 = 0);
virtual ~TeeHtmlWriter();
void addHtmlWriter(HtmlWriter *writer);
......
......@@ -27,7 +27,7 @@
using namespace MessageViewer;
WebEnginePartHtmlWriter::WebEnginePartHtmlWriter(MailWebEngineView *view, QObject *parent)
: QObject(parent), HtmlWriter(),
: QObject(parent), MimeTreeParser::HtmlWriter(),
mHtmlView(view), mState(Ended)