summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/domain/applicationdomaintype.h2
-rw-r--r--common/store.cpp13
2 files changed, 12 insertions, 3 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h
index fee6344..be04db9 100644
--- a/common/domain/applicationdomaintype.h
+++ b/common/domain/applicationdomaintype.h
@@ -418,6 +418,8 @@ struct SINK_EXPORT ImapResource {
418 418
419namespace ResourceCapabilities { 419namespace ResourceCapabilities {
420namespace Mail { 420namespace Mail {
421 static constexpr const char *mail = "mail";
422 static constexpr const char *folder = "folder";
421 static constexpr const char *storage = "mail.storage"; 423 static constexpr const char *storage = "mail.storage";
422 static constexpr const char *drafts = "mail.drafts"; 424 static constexpr const char *drafts = "mail.drafts";
423 static constexpr const char *sent = "mail.sent"; 425 static constexpr const char *sent = "mail.sent";
diff --git a/common/store.cpp b/common/store.cpp
index 9550d3e..1c8620b 100644
--- a/common/store.cpp
+++ b/common/store.cpp
@@ -96,14 +96,21 @@ QPair<typename AggregatingResultEmitter<typename DomainType::Ptr>::Ptr, typenam
96 SinkTraceCtx(ctx) << "Listening for new resources."; 96 SinkTraceCtx(ctx) << "Listening for new resources.";
97 resourceQuery.setFlags(Query::LiveQuery); 97 resourceQuery.setFlags(Query::LiveQuery);
98 } 98 }
99 resourceQuery.setFilter(query.getResourceFilter()); 99
100 //Filter resources by available content types (unless the query already specifies a capability filter)
101 auto resourceFilter = query.getResourceFilter();
102 if (!resourceFilter.propertyFilter.contains(ApplicationDomain::SinkResource::Capabilities::name)) {
103 resourceFilter.propertyFilter.insert(ApplicationDomain::SinkResource::Capabilities::name, Query::Comparator{ApplicationDomain::getTypeName<DomainType>(), Query::Comparator::Contains});
104 }
105 resourceQuery.setFilter(resourceFilter);
106
100 auto result = facade->load(resourceQuery, resourceCtx); 107 auto result = facade->load(resourceQuery, resourceCtx);
101 auto emitter = result.second; 108 auto emitter = result.second;
102 emitter->onAdded([query, aggregatingEmitter, resourceCtx](const ApplicationDomain::SinkResource::Ptr &resource) { 109 emitter->onAdded([=](const ApplicationDomain::SinkResource::Ptr &resource) {
103 SinkTraceCtx(resourceCtx) << "Found new resources: " << resource->identifier(); 110 SinkTraceCtx(resourceCtx) << "Found new resources: " << resource->identifier();
104 const auto resourceType = ResourceConfig::getResourceType(resource->identifier()); 111 const auto resourceType = ResourceConfig::getResourceType(resource->identifier());
105 Q_ASSERT(!resourceType.isEmpty()); 112 Q_ASSERT(!resourceType.isEmpty());
106 queryResource<DomainType>(resourceType, resource->identifier(), query, aggregatingEmitter, resourceCtx).exec(); 113 queryResource<DomainType>(resourceType, resource->identifier(), query, aggregatingEmitter, ctx).exec();
107 }); 114 });
108 emitter->onModified([](const ApplicationDomain::SinkResource::Ptr &) { 115 emitter->onModified([](const ApplicationDomain::SinkResource::Ptr &) {
109 }); 116 });