summaryrefslogtreecommitdiffstats
path: root/common/domain/mail.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-10-18 12:44:12 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-10-21 09:18:49 +0200
commit71a0167e0216f84588b492c84e92667847fbe5a5 (patch)
tree016718fe0ab13359e9738b9ddbf2450b05bb4603 /common/domain/mail.cpp
parent2a9c738b813133d398683596df6d41d355e3cb3b (diff)
downloadsink-71a0167e0216f84588b492c84e92667847fbe5a5.tar.gz
sink-71a0167e0216f84588b492c84e92667847fbe5a5.zip
Use the ApplicationDomainType in the queries as well.
We have to access properties, so we need the mapper anyways, and the ApplicationDomainType type shouldn't be a large overhead anyways.
Diffstat (limited to 'common/domain/mail.cpp')
-rw-r--r--common/domain/mail.cpp23
1 files changed, 0 insertions, 23 deletions
diff --git a/common/domain/mail.cpp b/common/domain/mail.cpp
index 9e3a824..b0a3aae 100644
--- a/common/domain/mail.cpp
+++ b/common/domain/mail.cpp
@@ -225,26 +225,3 @@ QSharedPointer<WritePropertyMapper<TypeImplementation<Mail>::BufferBuilder> > Ty
225} 225}
226 226
227 227
228DataStoreQuery::Ptr TypeImplementation<Mail>::prepareQuery(const Sink::Query &query, Sink::Storage::EntityStore::Ptr store)
229{
230 auto mapper = initializeReadPropertyMapper();
231 return DataStoreQuery::Ptr::create(query, ApplicationDomain::getTypeName<Mail>(), store, [mapper, store](const Sink::Entity &entity, const QByteArray &property) -> QVariant {
232 if (property == Mail::ThreadId::name) {
233 const auto localBuffer = Sink::EntityBuffer::readBuffer<Buffer>(entity.local());
234 Q_ASSERT(localBuffer);
235 auto messageId = mapper->getProperty(Mail::MessageId::name, localBuffer);
236 //FIXME
237 //This is an index property that we have too lookup
238 /* auto thread = getIndex().secondaryLookup<Mail::MessageId, Mail::ThreadId>(messageId); */
239 /* auto thread = store->secondaryLookup<Mail::MessageId, Mail::ThreadId>(messageId); */
240 /* Q_ASSERT(!thread.isEmpty()); */
241 /* return thread.first(); */
242 return QVariant();
243 } else {
244 const auto localBuffer = Sink::EntityBuffer::readBuffer<Buffer>(entity.local());
245 Q_ASSERT(localBuffer);
246 return mapper->getProperty(property, localBuffer);
247 }
248 });
249}
250