summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandro Knauß <[email protected]>2015-10-09 09:20:12 +0200
committerSandro Knauß <[email protected]>2015-10-13 23:55:38 +0200
commite99836c8dcd610c95d7dafc46a63dcdf98f4398e (patch)
tree6337c291ac410e0b479a2d0b7b07cbb2d6334aee
parent5017d43618630d42f508d7b2131b0bcf27357c0c (diff)
Extend Interface::BodyPart with otp and processResults
For the time of refactor, we need the otp and processResults to get rid of otp slowly while processing the nodes.
-rw-r--r--messageviewer/src/interfaces/bodypart.h8
-rw-r--r--messageviewer/src/viewer/messagepart.h1
-rw-r--r--messageviewer/src/viewer/objecttreeparser.cpp2
-rw-r--r--messageviewer/src/viewer/partnodebodypart.cpp5
-rw-r--r--messageviewer/src/viewer/partnodebodypart.h14
-rw-r--r--messageviewer/src/viewer/urlhandlermanager.cpp6
6 files changed, 30 insertions, 6 deletions
diff --git a/messageviewer/src/interfaces/bodypart.h b/messageviewer/src/interfaces/bodypart.h
index 2e5faa8..8460023 100644
--- a/messageviewer/src/interfaces/bodypart.h
+++ b/messageviewer/src/interfaces/bodypart.h
@@ -45,6 +45,8 @@ class Content;
namespace MessageViewer
{
class NodeHelper;
+class ObjectTreeParser;
+class ProcessResult;
namespace Interface
{
@@ -188,6 +190,12 @@ public:
* for real-world plugins. Still, there should be a nicer way for this.
*/
virtual MessageViewer::NodeHelper *nodeHelper() const = 0;
+
+ /**
+ * For making it easier to refactor, add objectTreeParser
+ */
+ virtual MessageViewer::ObjectTreeParser *objectTreeParser() const = 0;
+ virtual MessageViewer::ProcessResult *processResult() const = 0;
};
} // namespace Interface
diff --git a/messageviewer/src/viewer/messagepart.h b/messageviewer/src/viewer/messagepart.h
index 1d6f4dc..261ad4b 100644
--- a/messageviewer/src/viewer/messagepart.h
+++ b/messageviewer/src/viewer/messagepart.h
@@ -62,6 +62,7 @@ private:
KMime::Content *mNode;
};
+
// The attachment mark is a div that is placed around the attchment. It is used for drawing
// a yellow border around the attachment when scrolling to it. When scrolling to it, the border
// color of the div is changed, see KMReaderWin::scrollToAttachment().
diff --git a/messageviewer/src/viewer/objecttreeparser.cpp b/messageviewer/src/viewer/objecttreeparser.cpp
index 4970458..33ff187 100644
--- a/messageviewer/src/viewer/objecttreeparser.cpp
+++ b/messageviewer/src/viewer/objecttreeparser.cpp
@@ -354,7 +354,7 @@ void ObjectTreeParser::parseObjectTreeInternal(KMime::Content *node)
// First, try if an external plugin can handle this MIME part
if (const Interface::BodyPartFormatter * formatter
= BodyPartFormatterFactory::instance()->createFor(mediaType, subType)) {
- PartNodeBodyPart part(mTopLevelContent, node, mNodeHelper, codecFor(node));
+ PartNodeBodyPart part(this, &processResult, mTopLevelContent, node, mNodeHelper, codecFor(node));
// Set the default display strategy for this body part relying on the
// identity of Interface::BodyPart::Display and AttachmentStrategy::Display
part.setDefaultDisplay((Interface::BodyPart::Display) attachmentStrategy()->defaultDisplay(node));
diff --git a/messageviewer/src/viewer/partnodebodypart.cpp b/messageviewer/src/viewer/partnodebodypart.cpp
index 385f684..ca2c89f 100644
--- a/messageviewer/src/viewer/partnodebodypart.cpp
+++ b/messageviewer/src/viewer/partnodebodypart.cpp
@@ -33,6 +33,7 @@
#include "partnodebodypart.h"
#include "messageviewer/nodehelper.h"
+#include "messageviewer/objecttreeparser.h"
#include "messageviewer_debug.h"
#include <kmime/kmime_content.h>
@@ -42,10 +43,12 @@ using namespace MessageViewer;
static int serial = 0;
-PartNodeBodyPart::PartNodeBodyPart(KMime::Content *topLevelContent, KMime::Content *content,
+PartNodeBodyPart::PartNodeBodyPart(ObjectTreeParser *otp, ProcessResult *result, KMime::Content *topLevelContent, KMime::Content *content,
NodeHelper *nodeHelper, const QTextCodec *codec)
: Interface::BodyPart(), mTopLevelContent(topLevelContent), mContent(content), mCodec(codec),
mDefaultDisplay(Interface::BodyPart::None), mNodeHelper(nodeHelper)
+ , mObjectTreeParser(otp)
+ , mProcessResult(result)
{}
QString PartNodeBodyPart::makeLink(const QString &path) const
diff --git a/messageviewer/src/viewer/partnodebodypart.h b/messageviewer/src/viewer/partnodebodypart.h
index 50fcb74..967d995 100644
--- a/messageviewer/src/viewer/partnodebodypart.h
+++ b/messageviewer/src/viewer/partnodebodypart.h
@@ -58,7 +58,7 @@ namespace MessageViewer
class PartNodeBodyPart : public Interface::BodyPart
{
public:
- explicit PartNodeBodyPart(KMime::Content *topLevelContent, KMime::Content *content,
+ explicit PartNodeBodyPart(ObjectTreeParser *otp, ProcessResult *result, KMime::Content *topLevelContent, KMime::Content *content,
NodeHelper *nodeHelper, const QTextCodec *codec = 0);
QString makeLink(const QString &path) const Q_DECL_OVERRIDE;
@@ -87,12 +87,24 @@ public:
return mNodeHelper;
}
+ ObjectTreeParser *objectTreeParser() const Q_DECL_OVERRIDE
+ {
+ return mObjectTreeParser;
+ }
+
+ ProcessResult *processResult() const Q_DECL_OVERRIDE
+ {
+ return mProcessResult;
+ }
+
private:
KMime::Content *mTopLevelContent;
KMime::Content *mContent;
const QTextCodec *mCodec;
BodyPart::Display mDefaultDisplay;
NodeHelper *mNodeHelper;
+ ObjectTreeParser *mObjectTreeParser;
+ ProcessResult *mProcessResult;
};
}
diff --git a/messageviewer/src/viewer/urlhandlermanager.cpp b/messageviewer/src/viewer/urlhandlermanager.cpp
index 779e469..ac21a6b 100644
--- a/messageviewer/src/viewer/urlhandlermanager.cpp
+++ b/messageviewer/src/viewer/urlhandlermanager.cpp
@@ -322,7 +322,7 @@ bool URLHandlerManager::BodyPartURLHandlerManager::handleClick(const QUrl &url,
return false;
}
- PartNodeBodyPart part(w->message().data(), node, w->nodeHelper(), w->overrideCodec());
+ PartNodeBodyPart part(0, 0, w->message().data(), node, w->nodeHelper(), w->overrideCodec());
BodyPartHandlerList::const_iterator end(mHandlers.constEnd());
for (BodyPartHandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it) {
@@ -342,7 +342,7 @@ bool URLHandlerManager::BodyPartURLHandlerManager::handleContextMenuRequest(cons
return false;
}
- PartNodeBodyPart part(w->message().data(), node, w->nodeHelper(), w->overrideCodec());
+ PartNodeBodyPart part(0, 0, w->message().data(), node, w->nodeHelper(), w->overrideCodec());
BodyPartHandlerList::const_iterator end(mHandlers.constEnd());
for (BodyPartHandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it)
if ((*it)->handleContextMenuRequest(&part, path, p)) {
@@ -359,7 +359,7 @@ QString URLHandlerManager::BodyPartURLHandlerManager::statusBarMessage(const QUr
return QString();
}
- PartNodeBodyPart part(w->message().data(), node, w->nodeHelper(), w->overrideCodec());
+ PartNodeBodyPart part(0, 0, w->message().data(), node, w->nodeHelper(), w->overrideCodec());
BodyPartHandlerList::const_iterator end(mHandlers.constEnd());
for (BodyPartHandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it) {
const QString msg = (*it)->statusBarMessage(&part, path);