summaryrefslogtreecommitdiffstats
path: root/examples/maildirresource/maildirresource.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-11-21 23:13:38 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-11-21 23:51:24 +0100
commit1d713d9e2dbaf27de9da087f9270d260dfc40c31 (patch)
tree666d8edd42e44df3eaa674a35b6e938b99c2f4b4 /examples/maildirresource/maildirresource.cpp
parent0adba61a00491b96dadaa6d4719cb46831356222 (diff)
downloadsink-1d713d9e2dbaf27de9da087f9270d260dfc40c31.tar.gz
sink-1d713d9e2dbaf27de9da087f9270d260dfc40c31.zip
Folded the SourceWriteback into the Synchronizer.
By concentrating all communication to the source in one place we get rid of several oddities. * Quite a bit of duplication since both need access to the synchronizationStore and the source. * We currently have an akward locking in place because both classes access the ync store. This is not easier to resolve cleanly. * The live of resource implementers becomes easier. * An implementation could elect to not use changereplay and always do a full sync... (maybe?)
Diffstat (limited to 'examples/maildirresource/maildirresource.cpp')
-rw-r--r--examples/maildirresource/maildirresource.cpp16
1 files changed, 0 insertions, 16 deletions
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp
index fc77315..fed18c4 100644
--- a/examples/maildirresource/maildirresource.cpp
+++ b/examples/maildirresource/maildirresource.cpp
@@ -28,7 +28,6 @@
28#include "libmaildir/maildir.h" 28#include "libmaildir/maildir.h"
29#include "inspection.h" 29#include "inspection.h"
30#include "synchronizer.h" 30#include "synchronizer.h"
31#include "sourcewriteback.h"
32 31
33#include "facadefactory.h" 32#include "facadefactory.h"
34#include "adaptorfactoryregistry.h" 33#include "adaptorfactoryregistry.h"
@@ -383,18 +382,6 @@ public:
383 return job; 382 return job;
384 } 383 }
385 384
386public:
387 QString mMaildirPath;
388};
389
390class MaildirWriteback : public Sink::SourceWriteBack
391{
392public:
393 MaildirWriteback(const Sink::ResourceContext &resourceContext) : Sink::SourceWriteBack(resourceContext)
394 {
395
396 }
397
398 KAsync::Job<QByteArray> replay(const ApplicationDomain::Mail &mail, Sink::Operation operation, const QByteArray &oldRemoteId, const QList<QByteArray> &changedProperties) Q_DECL_OVERRIDE 385 KAsync::Job<QByteArray> replay(const ApplicationDomain::Mail &mail, Sink::Operation operation, const QByteArray &oldRemoteId, const QList<QByteArray> &changedProperties) Q_DECL_OVERRIDE
399 { 386 {
400 if (operation == Sink::Operation_Creation) { 387 if (operation == Sink::Operation_Creation) {
@@ -453,9 +440,6 @@ MaildirResource::MaildirResource(const Sink::ResourceContext &resourceContext, c
453 auto synchronizer = QSharedPointer<MaildirSynchronizer>::create(resourceContext); 440 auto synchronizer = QSharedPointer<MaildirSynchronizer>::create(resourceContext);
454 synchronizer->mMaildirPath = mMaildirPath; 441 synchronizer->mMaildirPath = mMaildirPath;
455 setupSynchronizer(synchronizer); 442 setupSynchronizer(synchronizer);
456 auto changereplay = QSharedPointer<MaildirWriteback>::create(resourceContext);
457 changereplay->mMaildirPath = mMaildirPath;
458 setupChangereplay(changereplay);
459 443
460 setupPreprocessors(ENTITY_TYPE_MAIL, QVector<Sink::Preprocessor*>() << new SpecialPurposeProcessor(resourceContext.resourceType, resourceContext.instanceId()) << new MaildirMimeMessageMover(resourceContext.instanceId(), mMaildirPath) << new MaildirMailPropertyExtractor); 444 setupPreprocessors(ENTITY_TYPE_MAIL, QVector<Sink::Preprocessor*>() << new SpecialPurposeProcessor(resourceContext.resourceType, resourceContext.instanceId()) << new MaildirMimeMessageMover(resourceContext.instanceId(), mMaildirPath) << new MaildirMailPropertyExtractor);
461 setupPreprocessors(ENTITY_TYPE_FOLDER, QVector<Sink::Preprocessor*>() << new FolderPreprocessor(mMaildirPath)); 445 setupPreprocessors(ENTITY_TYPE_FOLDER, QVector<Sink::Preprocessor*>() << new FolderPreprocessor(mMaildirPath));