From 9f6751df8e6f483b112c2b24c0bc725924f17356 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 9 Dec 2016 16:31:30 +0100 Subject: Move the BLOB property handling to the entitystore. This is really part of the storage, and will help us to cleanly implement features like moving properties into a temporary place when reading in a clean way as well. --- examples/dummyresource/resourcefactory.cpp | 2 +- examples/imapresource/imapresource.cpp | 2 +- examples/maildirresource/maildirresource.cpp | 14 +++++++++++--- examples/mailtransportresource/mailtransportresource.cpp | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp index 07021b9..03238ef 100644 --- a/examples/dummyresource/resourcefactory.cpp +++ b/examples/dummyresource/resourcefactory.cpp @@ -163,7 +163,7 @@ DummyResource::DummyResource(const Sink::ResourceContext &resourceContext, const setupSynchronizer(QSharedPointer::create(resourceContext)); setupInspector(QSharedPointer::create(resourceContext)); setupPreprocessors(ENTITY_TYPE_MAIL, - QVector() << new MailPropertyExtractor << new MimeMessageMover << new SpecialPurposeProcessor{resourceContext.resourceType, resourceContext.instanceId()}); + QVector() << new MailPropertyExtractor << new SpecialPurposeProcessor{resourceContext.resourceType, resourceContext.instanceId()}); setupPreprocessors(ENTITY_TYPE_FOLDER, QVector()); setupPreprocessors(ENTITY_TYPE_EVENT, diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index 238fb0c..252b910 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp @@ -737,7 +737,7 @@ ImapResource::ImapResource(const ResourceContext &resourceContext) inspector->mPassword = password; setupInspector(inspector); - setupPreprocessors(ENTITY_TYPE_MAIL, QVector() << new SpecialPurposeProcessor(resourceContext.resourceType, resourceContext.instanceId()) << new MimeMessageMover << new MailPropertyExtractor); + setupPreprocessors(ENTITY_TYPE_MAIL, QVector() << new SpecialPurposeProcessor(resourceContext.resourceType, resourceContext.instanceId()) << new MailPropertyExtractor); setupPreprocessors(ENTITY_TYPE_FOLDER, QVector()); } diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index a05afc6..6a03263 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp @@ -132,7 +132,10 @@ public: auto mail = newEntity.cast(); const auto mimeMessage = mail.getMimeMessagePath(); if (!mimeMessage.isNull()) { - mail.setMimeMessagePath(moveMessage(mimeMessage, mail.getFolder())); + const auto path = moveMessage(mimeMessage, mail.getFolder()); + auto blob = ApplicationDomain::BLOB{path}; + blob.isExternal = false; + mail.setProperty(ApplicationDomain::Mail::MimeMessage::name, QVariant::fromValue(blob)); } } @@ -149,7 +152,9 @@ public: auto newPath = moveMessage(mimeMessage, newMail.getFolder()); if (newPath != oldMail.getMimeMessagePath()) { const auto oldPath = getFilePathFromMimeMessagePath(oldMail.getMimeMessagePath()); - newMail.setMimeMessagePath(newPath); + auto blob = ApplicationDomain::BLOB{newPath}; + blob.isExternal = false; + newMail.setProperty(ApplicationDomain::Mail::MimeMessage::name, QVariant::fromValue(blob)); //Remove the olde mime message if there is a new one QFile::remove(oldPath); } @@ -323,7 +328,10 @@ public: Sink::ApplicationDomain::Mail mail; mail.setFolder(folderLocalId); //We only store the directory path + key, so we facade can add the changing bits (flags) - mail.setMimeMessagePath(KPIM::Maildir::getDirectoryFromFile(filePath) + maildirKey); + auto path = KPIM::Maildir::getDirectoryFromFile(filePath) + maildirKey; + auto blob = ApplicationDomain::BLOB{path}; + blob.isExternal = false; + mail.setProperty(ApplicationDomain::Mail::MimeMessage::name, QVariant::fromValue(blob)); mail.setUnread(!flags.testFlag(KPIM::Maildir::Seen)); mail.setImportant(flags.testFlag(KPIM::Maildir::Flagged)); diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp index 08a8748..b7ee77a 100644 --- a/examples/mailtransportresource/mailtransportresource.cpp +++ b/examples/mailtransportresource/mailtransportresource.cpp @@ -182,7 +182,7 @@ MailtransportResource::MailtransportResource(const Sink::ResourceContext &resour setupSynchronizer(synchronizer); setupInspector(QSharedPointer::create(resourceContext)); - setupPreprocessors(ENTITY_TYPE_MAIL, QVector() << new MimeMessageMover << new MailPropertyExtractor); + setupPreprocessors(ENTITY_TYPE_MAIL, QVector() << new MailPropertyExtractor); } MailtransportResourceFactory::MailtransportResourceFactory(QObject *parent) -- cgit v1.2.3