Commit 7f9b2dc2 authored by Sandro Knauß's avatar Sandro Knauß
Browse files

get rid of usage of ObjectTreeSource::sourceObject

The only usecase if to trigger an update of the rendering, that should
be done via MimeTreeParser::NodeHelper::Update
parent 309560bf
......@@ -166,10 +166,6 @@ public:
return QString(); //do nothing
}
QObject *sourceObject() Q_DECL_OVERRIDE {
return nullptr;
}
private:
MimeTreeParser::HtmlWriter *mWriter;
MessageViewer::CSSHelperBase *mCSSHelper;
......
......@@ -104,11 +104,6 @@ QString EmptySource::createMessageHeader(KMime::Message *message)
return QString(); //do nothing
}
QObject *EmptySource::sourceObject()
{
return nullptr;
}
const MimeTreeParser::AttachmentStrategy *EmptySource::attachmentStrategy()
{
return MimeTreeParser::AttachmentStrategy::smart();
......
......@@ -47,7 +47,6 @@ public:
const MimeTreeParser::AttachmentStrategy *attachmentStrategy() Q_DECL_OVERRIDE;
MimeTreeParser::HtmlWriter *htmlWriter() Q_DECL_OVERRIDE;
virtual CSSHelperBase *cssHelper();
QObject *sourceObject() Q_DECL_OVERRIDE;
bool autoImportKeys() const Q_DECL_OVERRIDE;
bool showEmoticons() const Q_DECL_OVERRIDE;
......
......@@ -92,11 +92,6 @@ QString MailViewerSource::createMessageHeader(KMime::Message *message)
return mViewer->writeMsgHeader(message);
}
QObject *MailViewerSource::sourceObject()
{
return mViewer;
}
const MimeTreeParser::AttachmentStrategy *MailViewerSource::attachmentStrategy()
{
return mViewer->attachmentStrategy();
......
......@@ -45,7 +45,6 @@ public:
QString createMessageHeader(KMime::Message *message) Q_DECL_OVERRIDE;
const MimeTreeParser::AttachmentStrategy *attachmentStrategy() Q_DECL_OVERRIDE;
MimeTreeParser::HtmlWriter *htmlWriter() Q_DECL_OVERRIDE;
QObject *sourceObject() Q_DECL_OVERRIDE;
bool autoImportKeys() const Q_DECL_OVERRIDE;
bool showEmoticons() const Q_DECL_OVERRIDE;
......
......@@ -146,10 +146,6 @@ public:
return QString(); //do nothing
}
QObject *sourceObject() Q_DECL_OVERRIDE {
return nullptr;
}
Interface::MessagePartRenderer::Ptr messagePartTheme(Interface::MessagePart::Ptr msgPart) Q_DECL_OVERRIDE {
Q_UNUSED(msgPart);
return Interface::MessagePartRenderer::Ptr();
......
......@@ -25,4 +25,9 @@ using namespace MimeTreeParser;
Interface::ObjectTreeSource::~ObjectTreeSource()
{
}
\ No newline at end of file
}
QObject* Interface::ObjectTreeSource::sourceObject()
{
return nullptr;
}
......@@ -89,8 +89,16 @@ public:
/** Return the html write object */
virtual HtmlWriter *htmlWriter() = 0;
/** The source object behind the interface. */
virtual QObject *sourceObject() = 0;
/** The source object behind the interface.
The usage of this method to make it possible that parser plugins can trigger render updates,
if the parser updates asyncly. Nowadays this update should be triggerd of MimeTreeParser::NodeHelper.
because deletion triggers an API change kube build would break so keep it for a release.
TODO: delete with 17.12.0
*/
MIMETREEPARSER_DEPRECATED virtual QObject *sourceObject();
/** should keys be imported automatically **/
virtual bool autoImportKeys() const = 0;
......
......@@ -746,7 +746,6 @@ bool SignedMessagePart::isSigned() const
bool SignedMessagePart::okVerify(const QByteArray &data, const QByteArray &signature, KMime::Content *textNode)
{
NodeHelper *nodeHelper = mOtp->nodeHelper();
Interface::ObjectTreeSource *_source = source();
mMetaData.isSigned = false;
mMetaData.technicalProblem = (mCryptoProto == nullptr);
......@@ -775,9 +774,6 @@ bool SignedMessagePart::okVerify(const QByteArray &data, const QByteArray &signa
if (mOtp->allowAsync()) {
QObject::connect(m, &CryptoBodyPartMemento::update,
nodeHelper, &NodeHelper::update);
QObject::connect(m, SIGNAL(update(MimeTreeParser::UpdateMode)),
_source->sourceObject(), SLOT(update(MimeTreeParser::UpdateMode)));
if (m->start()) {
mMetaData.inProgress = true;
mOtp->mHasPendingAsyncJobs = true;
......@@ -1124,7 +1120,6 @@ bool EncryptedMessagePart::okDecryptMIME(KMime::Content &data)
mMetaData.auditLog.clear();
bool bDecryptionOk = false;
bool cannotDecrypt = false;
Interface::ObjectTreeSource *_source = source();
NodeHelper *nodeHelper = mOtp->nodeHelper();
Q_ASSERT(decryptMessage());
......@@ -1146,8 +1141,6 @@ bool EncryptedMessagePart::okDecryptMIME(KMime::Content &data)
if (mOtp->allowAsync()) {
QObject::connect(newM, &CryptoBodyPartMemento::update,
nodeHelper, &NodeHelper::update);
QObject::connect(newM, SIGNAL(update(MimeTreeParser::UpdateMode)), _source->sourceObject(),
SLOT(update(MimeTreeParser::UpdateMode)));
if (newM->start()) {
mMetaData.inProgress = true;
mOtp->mHasPendingAsyncJobs = true;
......
......@@ -231,8 +231,7 @@ bool ObjectTreeParser::processType(KMime::Content *node, ProcessResult &processR
bRendered = true;
break;
} else if (dynamic_cast<MimeTreeParser::Interface::MessagePart *>(result.data())) {
QObject *asyncResultObserver = allowAsync() ? mSource->sourceObject() : nullptr;
const auto r = formatter->format(&part, result->htmlWriter(), asyncResultObserver);
const auto r = formatter->format(&part, result->htmlWriter());
if (r == Interface::BodyPartFormatter::AsIcon) {
processResult.setNeverDisplayInline(true);
formatter->adaptProcessResult(processResult);
......
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