From 67ec34a8df3a2c3fe5ffbfd74ef06ee8a52ed2bb Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 19 Oct 2016 15:48:09 +0200 Subject: Fixed maildir message moving --- examples/maildirresource/maildirresource.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'examples') diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index 920bd28..e0462b7 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp @@ -90,20 +90,14 @@ public: return mMaildirPath; } QString folderPath; - auto db = Sink::Storage::DataStore::mainDatabase(transaction, ENTITY_TYPE_FOLDER); - db.findLatest(folderIdentifier, [&](const QByteArray &, const QByteArray &value) { - Sink::EntityBuffer buffer(value); - const Sink::Entity &entity = buffer.entity(); - const auto adaptor = Sink::AdaptorFactoryRegistry::instance().getFactory(PLUGIN_NAME)->createAdaptor(entity); - auto parentFolder = adaptor->getProperty("parent").toString(); - if (mMaildirPath.endsWith(adaptor->getProperty("name").toString())) { - folderPath = mMaildirPath; - } else { - auto folderName = adaptor->getProperty("name").toString(); - //FIXME handle non toplevel folders - folderPath = mMaildirPath + "/" + folderName; - } - }); + const auto folder = entityStore().readLatest(folderIdentifier); + if (mMaildirPath.endsWith(folder.getName())) { + folderPath = mMaildirPath; + } else { + auto folderName = folder.getName(); + //FIXME handle non toplevel folders + folderPath = mMaildirPath + "/" + folderName; + } return folderPath; } -- cgit v1.2.3