diff options
Diffstat (limited to 'common/facade.cpp')
-rw-r--r-- | common/facade.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/common/facade.cpp b/common/facade.cpp index 91021db..8cb776c 100644 --- a/common/facade.cpp +++ b/common/facade.cpp | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "queryrunner.h" | 27 | #include "queryrunner.h" |
28 | #include "bufferutils.h" | 28 | #include "bufferutils.h" |
29 | 29 | ||
30 | using namespace Akonadi2; | 30 | using namespace Sink; |
31 | 31 | ||
32 | class ResourceAccessFactory { | 32 | class ResourceAccessFactory { |
33 | public: | 33 | public: |
@@ -40,7 +40,7 @@ public: | |||
40 | return *instance; | 40 | return *instance; |
41 | } | 41 | } |
42 | 42 | ||
43 | Akonadi2::ResourceAccess::Ptr getAccess(const QByteArray &instanceIdentifier) | 43 | Sink::ResourceAccess::Ptr getAccess(const QByteArray &instanceIdentifier) |
44 | { | 44 | { |
45 | if (!mCache.contains(instanceIdentifier)) { | 45 | if (!mCache.contains(instanceIdentifier)) { |
46 | //Reuse the pointer if something else kept the resourceaccess alive | 46 | //Reuse the pointer if something else kept the resourceaccess alive |
@@ -52,8 +52,8 @@ public: | |||
52 | } | 52 | } |
53 | if (!mCache.contains(instanceIdentifier)) { | 53 | if (!mCache.contains(instanceIdentifier)) { |
54 | //Create a new instance if necessary | 54 | //Create a new instance if necessary |
55 | auto sharedPointer = Akonadi2::ResourceAccess::Ptr::create(instanceIdentifier); | 55 | auto sharedPointer = Sink::ResourceAccess::Ptr::create(instanceIdentifier); |
56 | QObject::connect(sharedPointer.data(), &Akonadi2::ResourceAccess::ready, sharedPointer.data(), [this, instanceIdentifier](bool ready) { | 56 | QObject::connect(sharedPointer.data(), &Sink::ResourceAccess::ready, sharedPointer.data(), [this, instanceIdentifier](bool ready) { |
57 | if (!ready) { | 57 | if (!ready) { |
58 | mCache.remove(instanceIdentifier); | 58 | mCache.remove(instanceIdentifier); |
59 | } | 59 | } |
@@ -76,14 +76,14 @@ public: | |||
76 | return mCache.value(instanceIdentifier); | 76 | return mCache.value(instanceIdentifier); |
77 | } | 77 | } |
78 | 78 | ||
79 | QHash<QByteArray, QWeakPointer<Akonadi2::ResourceAccess> > mWeakCache; | 79 | QHash<QByteArray, QWeakPointer<Sink::ResourceAccess> > mWeakCache; |
80 | QHash<QByteArray, Akonadi2::ResourceAccess::Ptr> mCache; | 80 | QHash<QByteArray, Sink::ResourceAccess::Ptr> mCache; |
81 | QHash<QByteArray, QTimer*> mTimer; | 81 | QHash<QByteArray, QTimer*> mTimer; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | template<class DomainType> | 84 | template<class DomainType> |
85 | GenericFacade<DomainType>::GenericFacade(const QByteArray &resourceIdentifier, const DomainTypeAdaptorFactoryInterface::Ptr &adaptorFactory , const QSharedPointer<Akonadi2::ResourceAccessInterface> resourceAccess) | 85 | GenericFacade<DomainType>::GenericFacade(const QByteArray &resourceIdentifier, const DomainTypeAdaptorFactoryInterface::Ptr &adaptorFactory , const QSharedPointer<Sink::ResourceAccessInterface> resourceAccess) |
86 | : Akonadi2::StoreFacade<DomainType>(), | 86 | : Sink::StoreFacade<DomainType>(), |
87 | mResourceAccess(resourceAccess), | 87 | mResourceAccess(resourceAccess), |
88 | mDomainTypeAdaptorFactory(adaptorFactory), | 88 | mDomainTypeAdaptorFactory(adaptorFactory), |
89 | mResourceInstanceIdentifier(resourceIdentifier) | 89 | mResourceInstanceIdentifier(resourceIdentifier) |
@@ -102,7 +102,7 @@ template<class DomainType> | |||
102 | QByteArray GenericFacade<DomainType>::bufferTypeForDomainType() | 102 | QByteArray GenericFacade<DomainType>::bufferTypeForDomainType() |
103 | { | 103 | { |
104 | //We happen to have a one to one mapping | 104 | //We happen to have a one to one mapping |
105 | return Akonadi2::ApplicationDomain::getTypeName<DomainType>(); | 105 | return Sink::ApplicationDomain::getTypeName<DomainType>(); |
106 | } | 106 | } |
107 | 107 | ||
108 | template<class DomainType> | 108 | template<class DomainType> |
@@ -136,7 +136,7 @@ KAsync::Job<void> GenericFacade<DomainType>::remove(const DomainType &domainObje | |||
136 | } | 136 | } |
137 | 137 | ||
138 | template<class DomainType> | 138 | template<class DomainType> |
139 | QPair<KAsync::Job<void>, typename ResultEmitter<typename DomainType::Ptr>::Ptr> GenericFacade<DomainType>::load(const Akonadi2::Query &query) | 139 | QPair<KAsync::Job<void>, typename ResultEmitter<typename DomainType::Ptr>::Ptr> GenericFacade<DomainType>::load(const Sink::Query &query) |
140 | { | 140 | { |
141 | //The runner lives for the lifetime of the query | 141 | //The runner lives for the lifetime of the query |
142 | auto runner = new QueryRunner<DomainType>(query, mResourceAccess, mResourceInstanceIdentifier, mDomainTypeAdaptorFactory, bufferTypeForDomainType()); | 142 | auto runner = new QueryRunner<DomainType>(query, mResourceAccess, mResourceInstanceIdentifier, mDomainTypeAdaptorFactory, bufferTypeForDomainType()); |
@@ -144,8 +144,8 @@ QPair<KAsync::Job<void>, typename ResultEmitter<typename DomainType::Ptr>::Ptr> | |||
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | template class Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Folder>; | 147 | template class Sink::GenericFacade<Sink::ApplicationDomain::Folder>; |
148 | template class Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Mail>; | 148 | template class Sink::GenericFacade<Sink::ApplicationDomain::Mail>; |
149 | template class Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Event>; | 149 | template class Sink::GenericFacade<Sink::ApplicationDomain::Event>; |
150 | 150 | ||
151 | #include "facade.moc" | 151 | #include "facade.moc" |