From a547334afca38baae64e0f5774b1eb7f082a08e3 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 12 Apr 2017 11:46:48 +0200 Subject: Allow the preprocessor to move and use in mailtransport --- .../mailtransportresource.cpp | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'examples/mailtransportresource/mailtransportresource.cpp') diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp index 8e5b22e..8a4ef92 100644 --- a/examples/mailtransportresource/mailtransportresource.cpp +++ b/examples/mailtransportresource/mailtransportresource.cpp @@ -66,18 +66,21 @@ public: return targetResource.identifier(); } - void modifiedEntity(const Sink::ApplicationDomain::ApplicationDomainType &oldEntity, Sink::ApplicationDomain::ApplicationDomainType &newEntity) Q_DECL_OVERRIDE + virtual Result processModification(Type type, const ApplicationDomain::ApplicationDomainType ¤t, ApplicationDomain::ApplicationDomainType &diff) Q_DECL_OVERRIDE { - using namespace Sink::ApplicationDomain; - auto mail = newEntity.cast(); - if (mail.changedProperties().contains(Mail::Trash::name)) { - //Move back to regular resource - newEntity.setResource(getTargetResource()); - } else if (mail.changedProperties().contains(Mail::Draft::name)) { - //Move back to regular resource - newEntity.setResource(getTargetResource()); + if (type == Preprocessor::Modification) { + using namespace Sink::ApplicationDomain; + if (diff.changedProperties().contains(Mail::Trash::name)) { + //Move back to regular resource + diff.setResource(getTargetResource()); + return {MoveToResource}; + } else if (diff.changedProperties().contains(Mail::Draft::name)) { + //Move back to regular resource + diff.setResource(getTargetResource()); + return {MoveToResource}; + } } - //TODO this will only copy it back, but not yet move + return {NoAction}; } }; -- cgit v1.2.3