summaryrefslogtreecommitdiffstats
path: root/examples/maildirresource/maildirresource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/maildirresource/maildirresource.cpp')
-rw-r--r--examples/maildirresource/maildirresource.cpp22
1 files changed, 8 insertions, 14 deletions
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:
90 return mMaildirPath; 90 return mMaildirPath;
91 } 91 }
92 QString folderPath; 92 QString folderPath;
93 auto db = Sink::Storage::DataStore::mainDatabase(transaction, ENTITY_TYPE_FOLDER); 93 const auto folder = entityStore().readLatest<ApplicationDomain::Folder>(folderIdentifier);
94 db.findLatest(folderIdentifier, [&](const QByteArray &, const QByteArray &value) { 94 if (mMaildirPath.endsWith(folder.getName())) {
95 Sink::EntityBuffer buffer(value); 95 folderPath = mMaildirPath;
96 const Sink::Entity &entity = buffer.entity(); 96 } else {
97 const auto adaptor = Sink::AdaptorFactoryRegistry::instance().getFactory<Sink::ApplicationDomain::Folder>(PLUGIN_NAME)->createAdaptor(entity); 97 auto folderName = folder.getName();
98 auto parentFolder = adaptor->getProperty("parent").toString(); 98 //FIXME handle non toplevel folders
99 if (mMaildirPath.endsWith(adaptor->getProperty("name").toString())) { 99 folderPath = mMaildirPath + "/" + folderName;
100 folderPath = mMaildirPath; 100 }
101 } else {
102 auto folderName = adaptor->getProperty("name").toString();
103 //FIXME handle non toplevel folders
104 folderPath = mMaildirPath + "/" + folderName;
105 }
106 });
107 return folderPath; 101 return folderPath;
108 } 102 }
109 103