summaryrefslogtreecommitdiffstats
path: root/common/clientapi.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-05-25 17:00:51 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-05-25 17:00:51 +0200
commit2c0315f31e322c3a951e5aad8816723440ae860d (patch)
tree37fab916e4dcd9e5260968ee6682e0d78ad3cd4c /common/clientapi.h
parenteddacfc5aff36eb3b16f12cba12ba1a88f5ee6e2 (diff)
downloadsink-2c0315f31e322c3a951e5aad8816723440ae860d.tar.gz
sink-2c0315f31e322c3a951e5aad8816723440ae860d.zip
Refactored query in facade
First prepare the result set, then retrieve it.
Diffstat (limited to 'common/clientapi.h')
-rw-r--r--common/clientapi.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/common/clientapi.h b/common/clientapi.h
index 05c4675..ee4ef3f 100644
--- a/common/clientapi.h
+++ b/common/clientapi.h
@@ -112,6 +112,14 @@ public:
112 { 112 {
113 } 113 }
114 114
115 template <typename DomainType>
116 static typename DomainType::Ptr getInMemoryRepresentation(const ApplicationDomainType::Ptr &domainType)
117 {
118 //TODO only copy requested properties
119 auto memoryAdaptor = QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create(*(domainType->mAdaptor));
120 return QSharedPointer<DomainType>::create(domainType->mResourceName, domainType->mIdentifier, domainType->mRevision, memoryAdaptor);
121 }
122
115 virtual ~ApplicationDomainType() {} 123 virtual ~ApplicationDomainType() {}
116 124
117 virtual QVariant getProperty(const QByteArray &key) const { return mAdaptor->getProperty(key); } 125 virtual QVariant getProperty(const QByteArray &key) const { return mAdaptor->getProperty(key); }
@@ -125,7 +133,7 @@ private:
125 /* 133 /*
126 * Each domain object needs to store the resource, identifier, revision triple so we can link back to the storage location. 134 * Each domain object needs to store the resource, identifier, revision triple so we can link back to the storage location.
127 */ 135 */
128 QString mResourceName; 136 QByteArray mResourceName;
129 QByteArray mIdentifier; 137 QByteArray mIdentifier;
130 qint64 mRevision; 138 qint64 mRevision;
131}; 139};