Commit 2a856a31 authored by Sandro Knauß's avatar Sandro Knauß

Rename ObjectTreeSourceIf to Interface::ObjectTreeSource

An Interface should live inside the Interface namespace and afterwards,
we can get rid of the If suffix.
parent 0df7d3e2
......@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
set(PIM_VERSION "5.2.60")
set(PIM_VERSION "5.2.61")
set(MESSAGELIB_LIB_VERSION ${PIM_VERSION})
set(KF5_VERSION "5.19.0")
......
......@@ -15,7 +15,7 @@ based on WebKit.
\section ObjectTreeParser
The class ObjectTreeParser is used to parse the KMime::Message and create a HTML representation out
of it. An implementation of the ObjectTreeSourceIf interface is passed to the ObjectTreeParser,
of it. An implementation of the ObjectTreeSource interface is passed to the ObjectTreeParser,
which provides an interface for the ObjectTreeParser to interact with the viewer widget. The most
import part of this interface is that it provides a HtmlWriter, which the ObjectTreeParser uses to
write the HTML it generates to.
......@@ -27,7 +27,7 @@ the textual content that the ObjectTreeParser extracted, which can be retrieved
ObjectTreeParser::textualContent(). This is used for example when KMail creates an inline forward
message.
The Viewer of course uses a non-dummy implementation of the ObjectTreeSourceIf, the MailViewerSource.
The Viewer of course uses a non-dummy implementation of the ObjectTreeSource, the MailViewerSource.
The HtmlWriter provided by the MailViewerSource is a WebKitPartHtmlWriter, which writes the HTML
directly to the MailWebView widget, which is a KWebView.
......@@ -35,7 +35,7 @@ The header of the message or the headers of any embedded messages are formatted
The user can chose between many styles of header formatting, like 'fancy' or 'brief'. The creation
of the HTML code for these headers is handled by HeaderStyle. The ObjectTreeParser does not use
the HeaderStyle classes directly; instead, it is delegated to ViewerPrivate::writeMsgHeader() via
ObjectTreeSourceIf::createMessageHeader().
ObjectTreeSource::createMessageHeader().
The 'fancy' header style can display the spam status of the message in a nice way. To extract the
spam information, SpamHeaderAnalyzer, AntiSpamConfig and SpamAgent are used.
......@@ -44,7 +44,7 @@ The HeaderStrategy controls which parts of the header should be shown. Based on
HeaderStyle implementations decide which header fields to include in the HTML code they generate.
Some parts of the appearance of the message can be customized by changing the CSS. For this, the
CSSHelper class is used, which is passed to the ObjectTreeParser with ObjectTreeSourceIf::cssHelper().
CSSHelper class is used, which is passed to the ObjectTreeParser with ObjectTreeSource::cssHelper().
The ObjectTreeParser can have plugins that create the HTML for special MIME parts themselves. Those
plugins are found in kdepim/plugins/messageviewer. Examples are plugins that render the vCard in a
......
......@@ -38,7 +38,7 @@ public:
};
EmptySource::EmptySource()
: MimeTreeParser::ObjectTreeSourceIf(),
: MimeTreeParser::Interface::ObjectTreeSource(),
d(new MessageViewer::EmptySourcePrivate)
{
}
......
......@@ -20,7 +20,7 @@
#ifndef MAILVIEWER_OBJECTTREEEMPTYSOURCE_H
#define MAILVIEWER_OBJECTTREEEMPTYSOURCE_H
#include <MimeTreeParser/ObjectTreeSourceIf>
#include <MimeTreeParser/ObjectTreeSource>
#include "messageviewer_export.h"
class QString;
......@@ -29,7 +29,7 @@ namespace MessageViewer
/** An ObjectTreeSource that does not work on anything */
class EmptySourcePrivate;
class MESSAGEVIEWER_EXPORT EmptySource : public MimeTreeParser::ObjectTreeSourceIf
class MESSAGEVIEWER_EXPORT EmptySource : public MimeTreeParser::Interface::ObjectTreeSource
{
public:
EmptySource();
......
......@@ -28,7 +28,7 @@
namespace MessageViewer
{
MailViewerSource::MailViewerSource(ViewerPrivate *viewer) :
MimeTreeParser::ObjectTreeSourceIf(), mViewer(viewer)
MimeTreeParser::Interface::ObjectTreeSource(), mViewer(viewer)
{
}
......
......@@ -20,7 +20,7 @@
#ifndef MAILVIEWER_OBJECTTREEVIEWERSOURCE_H
#define MAILVIEWER_OBJECTTREEVIEWERSOURCE_H
#include <MimeTreeParser/ObjectTreeSourceIf>
#include <MimeTreeParser/ObjectTreeSource>
class QString;
......@@ -30,7 +30,7 @@ namespace MessageViewer
class ViewerPrivate;
/** An ObjectTreeParser source working on a MailViewer object */
class MailViewerSource : public MimeTreeParser::ObjectTreeSourceIf
class MailViewerSource : public MimeTreeParser::Interface::ObjectTreeSource
{
public:
explicit MailViewerSource(ViewerPrivate *viewer);
......
......@@ -22,7 +22,7 @@
#define MESSAGECORE_TESTS_UTIL_H
#include <gpgme++/key.h>
#include "interfaces/objecttreesourceif.h"
#include "interfaces/objecttreesource.h"
#include <viewer/attachmentstrategy.h>
#include "viewer/bodypartformatterbasefactory.h"
......@@ -41,7 +41,7 @@ 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 MimeTreeParser::ObjectTreeSourceIf
class TestObjectTreeSource : public MimeTreeParser::Interface::ObjectTreeSource
{
public:
TestObjectTreeSource(MimeTreeParser::HtmlWriter *writer,
......
......@@ -20,7 +20,7 @@ set(libmimetreeparser_main_SRCS
bodyformatter/texthtml.cpp
bodyformatter/utils.cpp
interfaces/bodypartformatter.cpp
interfaces/objecttreesourceif.cpp
interfaces/objecttreesource.cpp
interfaces/bodypart.cpp
interfaces/htmlwriter.cpp
job/kleojobexecutor.cpp
......@@ -83,7 +83,7 @@ ecm_generate_headers(MimeTreeParser_Camelcaseinterfaces_HEADERS
BodyPartFormatter
BodyPart
HtmlWriter
ObjectTreeSourceIf
ObjectTreeSource
REQUIRED_HEADERS MimeTreeParser_interfaces_HEADERS
PREFIX MimeTreeParser
RELATIVE interfaces
......
......@@ -49,11 +49,12 @@ namespace MimeTreeParser
class NodeHelper;
class ObjectTreeParser;
class ProcessResult;
class ObjectTreeSourceIf;
namespace Interface
{
class ObjectTreeSource;
/*FIXME(Andras) review, port
class Observer;
class Observable;
......@@ -199,7 +200,7 @@ public:
* For making it easier to refactor, add objectTreeParser
*/
virtual MimeTreeParser::ObjectTreeParser *objectTreeParser() const = 0;
virtual MimeTreeParser::ObjectTreeSourceIf *source() const = 0;
virtual MimeTreeParser::Interface::ObjectTreeSource *source() const = 0;
virtual MimeTreeParser::ProcessResult *processResult() const = 0;
};
......
......@@ -17,8 +17,8 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "objecttreesourceif.h"
#include "objecttreesource.h"
MimeTreeParser::ObjectTreeSourceIf::~ObjectTreeSourceIf()
MimeTreeParser::Interface::ObjectTreeSource::~ObjectTreeSource()
{
}
......@@ -38,16 +38,17 @@ class BodyPartFormatterBaseFactory;
namespace MimeTreeParser
{
namespace Interface
{
/**
* Interface for object tree sources.
* @author Andras Mantia <amantia@kdab.net>
*/
class MIMETREEPARSER_EXPORT ObjectTreeSourceIf
class MIMETREEPARSER_EXPORT ObjectTreeSource
{
public:
virtual ~ObjectTreeSourceIf();
virtual ~ObjectTreeSource();
/**
* Sets the type of mail that is currently displayed. Applications can display this
......@@ -98,5 +99,5 @@ public:
virtual const BodyPartFormatterBaseFactory *bodyPartFormatterFactory() = 0;
};
}
}
#endif
......@@ -126,7 +126,7 @@ CryptoBlock::CryptoBlock(HtmlWriter *writer,
PartMetaData *block,
const NodeHelper *nodeHelper,
const Kleo::CryptoBackend::Protocol *cryptoProto,
ObjectTreeSourceIf *source,
Interface::ObjectTreeSource *source,
const QString &fromAddress,
KMime::Content *node)
: HTMLBlock()
......@@ -265,7 +265,7 @@ void EncryptedBlock::internalExit()
SignedBlock::SignedBlock(MimeTreeParser::HtmlWriter *writer, const PartMetaData &block,
const Kleo::CryptoBackend::Protocol *cryptoProto,
ObjectTreeSourceIf *source,
Interface::ObjectTreeSource *source,
QString fromAddress, bool printing)
: HTMLBlock()
, mBlock(block)
......@@ -1428,7 +1428,7 @@ KMMsgSignatureState TextMessagePart::signatureState() const
//-----HtmlMessageBlock----------------------
HtmlMessagePart::HtmlMessagePart(ObjectTreeParser *otp, KMime::Content *node, ObjectTreeSourceIf *source)
HtmlMessagePart::HtmlMessagePart(ObjectTreeParser *otp, KMime::Content *node, Interface::ObjectTreeSource *source)
: MessagePart(otp, QString())
, mNode(node)
, mSource(source)
......@@ -1843,7 +1843,7 @@ bool CryptoMessagePart::okDecryptMIME(KMime::Content &data)
mMetaData.auditLog.clear();
bool bDecryptionOk = false;
bool cannotDecrypt = false;
ObjectTreeSourceIf *source = mOtp->mSource;
Interface::ObjectTreeSource *source = mOtp->mSource;
NodeHelper *nodeHelper = mOtp->nodeHelper();
assert(decryptMessage());
......@@ -1997,7 +1997,7 @@ void CryptoMessagePart::startDecryption(KMime::Content *data)
bool CryptoMessagePart::okVerify(const QByteArray &data, const QByteArray &signature)
{
NodeHelper *nodeHelper = mOtp->nodeHelper();
ObjectTreeSourceIf *source = mOtp->mSource;
Interface::ObjectTreeSource *source = mOtp->mSource;
mMetaData.isSigned = false;
mMetaData.technicalProblem = (mCryptoProto == 0);
......
......@@ -48,10 +48,14 @@ class Content;
namespace MimeTreeParser
{
class ObjectTreeParser;
class ObjectTreeSourceIf;
class HtmlWriter;
class NodeHelper;
namespace Interface
{
class ObjectTreeSource;
}
class HTMLBlock
{
public:
......@@ -102,7 +106,7 @@ class SignedBlock : public HTMLBlock
public:
SignedBlock(MimeTreeParser::HtmlWriter *writer, const PartMetaData &block,
const Kleo::CryptoBackend::Protocol *cryptoProto,
ObjectTreeSourceIf *source,
Interface::ObjectTreeSource *source,
QString fromAddress, bool printing);
virtual ~SignedBlock();
......@@ -114,7 +118,7 @@ private:
const PartMetaData &mBlock;
HtmlWriter *mWriter;
const Kleo::CryptoBackend::Protocol *mCryptoProto;
ObjectTreeSourceIf *mSource;
Interface::ObjectTreeSource *mSource;
QString mClass;
QString mFromAddress;
bool mPrinting;
......@@ -127,7 +131,7 @@ public:
PartMetaData *block,
const NodeHelper *nodeHelper,
const Kleo::CryptoBackend::Protocol *cryptoProto,
ObjectTreeSourceIf *source,
Interface::ObjectTreeSource *source,
const QString &fromAddress,
KMime::Content *node);
virtual ~CryptoBlock();
......@@ -140,7 +144,7 @@ private:
PartMetaData *mMetaData;
const NodeHelper *mNodeHelper;
const Kleo::CryptoBackend::Protocol *mCryptoProto;
ObjectTreeSourceIf *mSource;
Interface::ObjectTreeSource *mSource;
QString mFromAddress;
KMime::Content *mNode;
QVector<HTMLBlock::Ptr> mInteralBlocks;
......@@ -325,7 +329,7 @@ class HtmlMessagePart : public MessagePart
{
public:
typedef QSharedPointer<HtmlMessagePart> Ptr;
HtmlMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node, MimeTreeParser::ObjectTreeSourceIf *source);
HtmlMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node, MimeTreeParser::Interface::ObjectTreeSource *source);
virtual ~HtmlMessagePart();
QString text() const Q_DECL_OVERRIDE;
......@@ -336,7 +340,7 @@ public:
private:
QString processHtml(const QString &htmlSource, QString &extraHead);
KMime::Content *mNode;
ObjectTreeSourceIf *mSource;
Interface::ObjectTreeSource *mSource;
QString mBodyHTML;
QByteArray mCharset;
};
......
......@@ -90,7 +90,7 @@ ObjectTreeParser::ObjectTreeParser(const ObjectTreeParser *topLevelParser,
init();
}
ObjectTreeParser::ObjectTreeParser(ObjectTreeSourceIf *source,
ObjectTreeParser::ObjectTreeParser(Interface::ObjectTreeSource *source,
MimeTreeParser::NodeHelper *nodeHelper,
bool showOnlyOneMimePart,
const AttachmentStrategy *strategy)
......
......@@ -37,7 +37,7 @@
#include "mimetreeparser_export.h"
#include "mimetreeparser/nodehelper.h"
#include "mimetreeparser/objecttreesourceif.h"
#include "mimetreeparser/objecttreesource.h"
#include <Libkleo/CryptoBackend>
#include <gpgme++/verificationresult.h>
......@@ -126,8 +126,8 @@ KMime::Content.
The ObjectTreeParser basically has two modes: Generating the HTML code for the Viewer, or only
extracting the plainTextContent() for situations where only the message text is needed, for example
when inline forwarding a message. The mode depends on the ObjectTreeSourceIf passed to the
constructor: If ObjectTreeSourceIf::htmlWriter() is not 0, then the HTML code generation mode is
when inline forwarding a message. The mode depends on the Interface::ObjectTreeSource passed to the
constructor: If Interface::ObjectTreeSource::htmlWriter() is not 0, then the HTML code generation mode is
used.
Basically, all the ObjectTreeParser does is going through the tree of MIME parts and operating on
......@@ -190,7 +190,7 @@ For signature and decryption handling, there are functions which help with gener
for the signature header and footer. These are writeDeferredDecryptionBlock(), writeSigstatFooter()
and writeSigstatHeader(). As the name writeDeferredDecryptionBlock() suggests, a setting can cause
the message to not be decrypted unless the user clicks a link. Whether the message should be
decrypted or not can be controlled by ObjectTreeSourceIf::decryptMessage(). When the user clicks the
decrypted or not can be controlled by Interface::ObjectTreeSource::decryptMessage(). When the user clicks the
decryption link, the URLHandler for 'kmail:' URLs sets that variable to true and triggers an update
of the Viewer, which will cause parseObjectTree() to be called again.
......@@ -292,7 +292,7 @@ class MIMETREEPARSER_EXPORT ObjectTreeParser
ObjectTreeParser(const ObjectTreeParser &other);
public:
explicit ObjectTreeParser(ObjectTreeSourceIf *source,
explicit ObjectTreeParser(Interface::ObjectTreeSource *source,
NodeHelper *nodeHelper = 0,
bool showOneMimePart = false,
const AttachmentStrategy *attachmentStrategy = Q_NULLPTR);
......@@ -383,7 +383,7 @@ private:
void copyContentFrom(const ObjectTreeParser *other);
private:
ObjectTreeSourceIf *mSource;
Interface::ObjectTreeSource *mSource;
NodeHelper *mNodeHelper;
HtmlWriter *mHtmlWriter;
QByteArray mPlainTextContentCharset;
......
......@@ -119,7 +119,7 @@ void PartNodeBodyPart::setDefaultDisplay(Interface::BodyPart::Display d)
mDefaultDisplay = d;
}
ObjectTreeSourceIf *PartNodeBodyPart::source() const
Interface::ObjectTreeSource *PartNodeBodyPart::source() const
{
return mObjectTreeParser->mSource;
}
\ No newline at end of file
......@@ -96,7 +96,7 @@ public:
return mProcessResult;
}
ObjectTreeSourceIf *source() const Q_DECL_OVERRIDE;
Interface::ObjectTreeSource *source() const Q_DECL_OVERRIDE;
private:
KMime::Content *mTopLevelContent;
KMime::Content *mContent;
......
Markdown is supported
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