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/maildirresource/maildirresource.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'examples/maildirresource') 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)); -- cgit v1.2.3