summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/domain/applicationdomaintype.cpp7
-rw-r--r--common/domain/applicationdomaintype.h3
-rw-r--r--common/store.cpp6
3 files changed, 12 insertions, 4 deletions
diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp
index ce113c2..4d63cc8 100644
--- a/common/domain/applicationdomaintype.cpp
+++ b/common/domain/applicationdomaintype.cpp
@@ -336,6 +336,13 @@ QByteArray getTypeName<Folder>()
336 return "folder"; 336 return "folder";
337} 337}
338 338
339bool isGlobalType(const QByteArray &type) {
340 if (type == ApplicationDomain::getTypeName<SinkResource>() || type == ApplicationDomain::getTypeName<SinkAccount>() || type == ApplicationDomain::getTypeName<Identity>()) {
341 return true;
342 }
343 return false;
344}
345
339} 346}
340} 347}
341 348
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h
index 5efb936..d969cc8 100644
--- a/common/domain/applicationdomaintype.h
+++ b/common/domain/applicationdomaintype.h
@@ -342,6 +342,9 @@ QByteArray SINK_EXPORT getTypeName<Mail>();
342template<> 342template<>
343QByteArray SINK_EXPORT getTypeName<Folder>(); 343QByteArray SINK_EXPORT getTypeName<Folder>();
344 344
345bool SINK_EXPORT isGlobalType(const QByteArray &type);
346
347
345/** 348/**
346 * Type implementation. 349 * Type implementation.
347 * 350 *
diff --git a/common/store.cpp b/common/store.cpp
index a58287b..d7b277d 100644
--- a/common/store.cpp
+++ b/common/store.cpp
@@ -65,7 +65,7 @@ static QMap<QByteArray, QByteArray> getResources(const QList<QByteArray> &resour
65 65
66 QMap<QByteArray, QByteArray> resources; 66 QMap<QByteArray, QByteArray> resources;
67 // Return the global resource (signified by an empty name) for types that don't belong to a specific resource 67 // Return the global resource (signified by an empty name) for types that don't belong to a specific resource
68 if (type == "sinkresource" || type == "sinkaccount" || type == "identity") { 68 if (ApplicationDomain::isGlobalType(type)) {
69 resources.insert("", ""); 69 resources.insert("", "");
70 return resources; 70 return resources;
71 } 71 }
@@ -145,9 +145,7 @@ QSharedPointer<QAbstractItemModel> Store::loadModel(Query query)
145template <class DomainType> 145template <class DomainType>
146static std::shared_ptr<StoreFacade<DomainType>> getFacade(const QByteArray &resourceInstanceIdentifier) 146static std::shared_ptr<StoreFacade<DomainType>> getFacade(const QByteArray &resourceInstanceIdentifier)
147{ 147{
148 148 if (ApplicationDomain::isGlobalType(ApplicationDomain::getTypeName<DomainType>())) {
149 const auto type = ApplicationDomain::getTypeName<DomainType>();
150 if (type == "sinkresource" || type == "sinkaccount") {
151 if (auto facade = FacadeFactory::instance().getFacade<DomainType>("", "")) { 149 if (auto facade = FacadeFactory::instance().getFacade<DomainType>("", "")) {
152 return facade; 150 return facade;
153 } 151 }