diff options
-rw-r--r-- | client/main.cpp | 2 | ||||
-rw-r--r-- | common/clientapi.cpp | 6 | ||||
-rw-r--r-- | common/clientapi.h | 66 | ||||
-rw-r--r-- | common/domainadaptor.h | 10 | ||||
-rw-r--r-- | common/resourceaccess.cpp | 10 | ||||
-rw-r--r-- | common/resourceaccess.h | 4 | ||||
-rw-r--r-- | dummyresource/domainadaptor.cpp | 8 | ||||
-rw-r--r-- | dummyresource/facade.cpp | 2 | ||||
-rw-r--r-- | synchronizer/listener.cpp | 12 | ||||
-rw-r--r-- | synchronizer/listener.h | 4 | ||||
-rw-r--r-- | tests/domainadaptortest.cpp | 4 |
11 files changed, 64 insertions, 64 deletions
diff --git a/client/main.cpp b/client/main.cpp index 61c1c1a..b4cb081 100644 --- a/client/main.cpp +++ b/client/main.cpp | |||
@@ -41,7 +41,7 @@ int main(int argc, char *argv[]) | |||
41 | } | 41 | } |
42 | 42 | ||
43 | for (const QString &resource: resources) { | 43 | for (const QString &resource: resources) { |
44 | Akonadi2::ResourceAccess *resAccess = new Akonadi2::ResourceAccess(resource); | 44 | Akonadi2::ResourceAccess *resAccess = new Akonadi2::ResourceAccess(resource.toLatin1()); |
45 | QObject::connect(&app, &QCoreApplication::aboutToQuit, | 45 | QObject::connect(&app, &QCoreApplication::aboutToQuit, |
46 | resAccess, &Akonadi2::ResourceAccess::close); | 46 | resAccess, &Akonadi2::ResourceAccess::close); |
47 | resAccess->sendCommand(Akonadi2::Commands::SynchronizeCommand); | 47 | resAccess->sendCommand(Akonadi2::Commands::SynchronizeCommand); |
diff --git a/common/clientapi.cpp b/common/clientapi.cpp index 6f0b421..0281b79 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp | |||
@@ -18,20 +18,20 @@ namespace Domain | |||
18 | { | 18 | { |
19 | 19 | ||
20 | template<> | 20 | template<> |
21 | QString getTypeName<Event>() | 21 | QByteArray getTypeName<Event>() |
22 | { | 22 | { |
23 | return "event"; | 23 | return "event"; |
24 | } | 24 | } |
25 | 25 | ||
26 | template<> | 26 | template<> |
27 | QString getTypeName<Todo>() | 27 | QByteArray getTypeName<Todo>() |
28 | { | 28 | { |
29 | return "todo"; | 29 | return "todo"; |
30 | } | 30 | } |
31 | 31 | ||
32 | } // namespace Domain | 32 | } // namespace Domain |
33 | 33 | ||
34 | void Store::shutdown(const QString &identifier) | 34 | void Store::shutdown(const QByteArray &identifier) |
35 | { | 35 | { |
36 | Akonadi2::ResourceAccess resourceAccess(identifier); | 36 | Akonadi2::ResourceAccess resourceAccess(identifier); |
37 | //FIXME this starts the resource, just to shut it down again if it's not running in the first place. | 37 | //FIXME this starts the resource, just to shut it down again if it's not running in the first place. |
diff --git a/common/clientapi.h b/common/clientapi.h index 0ee934c..37fb185 100644 --- a/common/clientapi.h +++ b/common/clientapi.h | |||
@@ -180,9 +180,9 @@ namespace Domain { | |||
180 | class BufferAdaptor { | 180 | class BufferAdaptor { |
181 | public: | 181 | public: |
182 | virtual ~BufferAdaptor() {} | 182 | virtual ~BufferAdaptor() {} |
183 | virtual QVariant getProperty(const QString &key) const { return QVariant(); } | 183 | virtual QVariant getProperty(const QByteArray &key) const { return QVariant(); } |
184 | virtual void setProperty(const QString &key, const QVariant &value) {} | 184 | virtual void setProperty(const QByteArray &key, const QVariant &value) {} |
185 | virtual QStringList availableProperties() const { return QStringList(); } | 185 | virtual QList<QByteArray> availableProperties() const { return QList<QByteArray>(); } |
186 | }; | 186 | }; |
187 | 187 | ||
188 | class MemoryBufferAdaptor : public BufferAdaptor { | 188 | class MemoryBufferAdaptor : public BufferAdaptor { |
@@ -202,12 +202,12 @@ public: | |||
202 | 202 | ||
203 | virtual ~MemoryBufferAdaptor() {} | 203 | virtual ~MemoryBufferAdaptor() {} |
204 | 204 | ||
205 | virtual QVariant getProperty(const QString &key) const { return mValues.value(key); } | 205 | virtual QVariant getProperty(const QByteArray &key) const { return mValues.value(key); } |
206 | virtual void setProperty(const QString &key, const QVariant &value) { mValues.insert(key, value); } | 206 | virtual void setProperty(const QByteArray &key, const QVariant &value) { mValues.insert(key, value); } |
207 | virtual QStringList availableProperties() const { return mValues.keys(); } | 207 | virtual QByteArrayList availableProperties() const { return mValues.keys(); } |
208 | 208 | ||
209 | private: | 209 | private: |
210 | QHash<QString, QVariant> mValues; | 210 | QHash<QByteArray, QVariant> mValues; |
211 | }; | 211 | }; |
212 | 212 | ||
213 | /** | 213 | /** |
@@ -222,7 +222,7 @@ public: | |||
222 | { | 222 | { |
223 | 223 | ||
224 | } | 224 | } |
225 | AkonadiDomainType(const QString &resourceName, const QString &identifier, qint64 revision, const QSharedPointer<BufferAdaptor> &adaptor) | 225 | AkonadiDomainType(const QByteArray &resourceName, const QByteArray &identifier, qint64 revision, const QSharedPointer<BufferAdaptor> &adaptor) |
226 | : mAdaptor(adaptor), | 226 | : mAdaptor(adaptor), |
227 | mResourceName(resourceName), | 227 | mResourceName(resourceName), |
228 | mIdentifier(identifier), | 228 | mIdentifier(identifier), |
@@ -232,17 +232,17 @@ public: | |||
232 | 232 | ||
233 | virtual ~AkonadiDomainType() {} | 233 | virtual ~AkonadiDomainType() {} |
234 | 234 | ||
235 | virtual QVariant getProperty(const QString &key) const { return mAdaptor->getProperty(key); } | 235 | virtual QVariant getProperty(const QByteArray &key) const { return mAdaptor->getProperty(key); } |
236 | virtual void setProperty(const QString &key, const QVariant &value){ mChangeSet.insert(key, value); mAdaptor->setProperty(key, value); } | 236 | virtual void setProperty(const QByteArray &key, const QVariant &value){ mChangeSet.insert(key, value); mAdaptor->setProperty(key, value); } |
237 | 237 | ||
238 | private: | 238 | private: |
239 | QSharedPointer<BufferAdaptor> mAdaptor; | 239 | QSharedPointer<BufferAdaptor> mAdaptor; |
240 | QHash<QString, QVariant> mChangeSet; | 240 | QHash<QByteArray, QVariant> mChangeSet; |
241 | /* | 241 | /* |
242 | * Each domain object needs to store the resource, identifier, revision triple so we can link back to the storage location. | 242 | * Each domain object needs to store the resource, identifier, revision triple so we can link back to the storage location. |
243 | */ | 243 | */ |
244 | QString mResourceName; | 244 | QString mResourceName; |
245 | QString mIdentifier; | 245 | QByteArray mIdentifier; |
246 | qint64 mRevision; | 246 | qint64 mRevision; |
247 | }; | 247 | }; |
248 | 248 | ||
@@ -274,13 +274,13 @@ class Folder : public AkonadiDomainType { | |||
274 | */ | 274 | */ |
275 | 275 | ||
276 | template<class DomainType> | 276 | template<class DomainType> |
277 | QString getTypeName(); | 277 | QByteArray getTypeName(); |
278 | 278 | ||
279 | template<> | 279 | template<> |
280 | QString getTypeName<Event>(); | 280 | QByteArray getTypeName<Event>(); |
281 | 281 | ||
282 | template<> | 282 | template<> |
283 | QString getTypeName<Todo>(); | 283 | QByteArray getTypeName<Todo>(); |
284 | 284 | ||
285 | } | 285 | } |
286 | 286 | ||
@@ -307,13 +307,13 @@ class Query | |||
307 | public: | 307 | public: |
308 | Query() : syncOnDemand(true), processAll(false) {} | 308 | Query() : syncOnDemand(true), processAll(false) {} |
309 | //Could also be a propertyFilter | 309 | //Could also be a propertyFilter |
310 | QStringList resources; | 310 | QByteArrayList resources; |
311 | //Could also be a propertyFilter | 311 | //Could also be a propertyFilter |
312 | QStringList ids; | 312 | QByteArrayList ids; |
313 | //Filters to apply | 313 | //Filters to apply |
314 | QHash<QString, QVariant> propertyFilter; | 314 | QHash<QByteArray, QVariant> propertyFilter; |
315 | //Properties to retrieve | 315 | //Properties to retrieve |
316 | QSet<QString> requestedProperties; | 316 | QSet<QByteArray> requestedProperties; |
317 | bool syncOnDemand; | 317 | bool syncOnDemand; |
318 | bool processAll; | 318 | bool processAll; |
319 | }; | 319 | }; |
@@ -331,7 +331,7 @@ template<class DomainType> | |||
331 | class StoreFacade { | 331 | class StoreFacade { |
332 | public: | 332 | public: |
333 | virtual ~StoreFacade(){}; | 333 | virtual ~StoreFacade(){}; |
334 | QString type() const { return Domain::getTypeName<DomainType>(); } | 334 | QByteArray type() const { return Domain::getTypeName<DomainType>(); } |
335 | virtual Async::Job<void> create(const DomainType &domainObject) = 0; | 335 | virtual Async::Job<void> create(const DomainType &domainObject) = 0; |
336 | virtual Async::Job<void> modify(const DomainType &domainObject) = 0; | 336 | virtual Async::Job<void> modify(const DomainType &domainObject) = 0; |
337 | virtual Async::Job<void> remove(const DomainType &domainObject) = 0; | 337 | virtual Async::Job<void> remove(const DomainType &domainObject) = 0; |
@@ -354,15 +354,15 @@ public: | |||
354 | return factory; | 354 | return factory; |
355 | } | 355 | } |
356 | 356 | ||
357 | static QString key(const QString &resource, const QString &type) | 357 | static QByteArray key(const QByteArray &resource, const QByteArray &type) |
358 | { | 358 | { |
359 | return resource + type; | 359 | return resource + type; |
360 | } | 360 | } |
361 | 361 | ||
362 | template<class DomainType, class Facade> | 362 | template<class DomainType, class Facade> |
363 | void registerFacade(const QString &resource) | 363 | void registerFacade(const QByteArray &resource) |
364 | { | 364 | { |
365 | const QString typeName = Domain::getTypeName<DomainType>(); | 365 | const QByteArray typeName = Domain::getTypeName<DomainType>(); |
366 | mFacadeRegistry.insert(key(resource, typeName), [](){ return new Facade; }); | 366 | mFacadeRegistry.insert(key(resource, typeName), [](){ return new Facade; }); |
367 | } | 367 | } |
368 | 368 | ||
@@ -376,16 +376,16 @@ public: | |||
376 | * FIXME the factory function should really be returning QSharedPointer<void>, which doesn't work (std::shared_pointer<void> would though). That way i.e. a test could keep the object alive until it's done. | 376 | * FIXME the factory function should really be returning QSharedPointer<void>, which doesn't work (std::shared_pointer<void> would though). That way i.e. a test could keep the object alive until it's done. |
377 | */ | 377 | */ |
378 | template<class DomainType, class Facade> | 378 | template<class DomainType, class Facade> |
379 | void registerFacade(const QString &resource, const std::function<void*(void)> &customFactoryFunction) | 379 | void registerFacade(const QByteArray &resource, const std::function<void*(void)> &customFactoryFunction) |
380 | { | 380 | { |
381 | const QString typeName = Domain::getTypeName<DomainType>(); | 381 | const QByteArray typeName = Domain::getTypeName<DomainType>(); |
382 | mFacadeRegistry.insert(key(resource, typeName), customFactoryFunction); | 382 | mFacadeRegistry.insert(key(resource, typeName), customFactoryFunction); |
383 | } | 383 | } |
384 | 384 | ||
385 | template<class DomainType> | 385 | template<class DomainType> |
386 | QSharedPointer<StoreFacade<DomainType> > getFacade(const QString &resource) | 386 | QSharedPointer<StoreFacade<DomainType> > getFacade(const QByteArray &resource) |
387 | { | 387 | { |
388 | const QString typeName = Domain::getTypeName<DomainType>(); | 388 | const QByteArray typeName = Domain::getTypeName<DomainType>(); |
389 | auto factoryFunction = mFacadeRegistry.value(key(resource, typeName)); | 389 | auto factoryFunction = mFacadeRegistry.value(key(resource, typeName)); |
390 | if (factoryFunction) { | 390 | if (factoryFunction) { |
391 | return QSharedPointer<StoreFacade<DomainType> >(static_cast<StoreFacade<DomainType>* >(factoryFunction())); | 391 | return QSharedPointer<StoreFacade<DomainType> >(static_cast<StoreFacade<DomainType>* >(factoryFunction())); |
@@ -395,7 +395,7 @@ public: | |||
395 | } | 395 | } |
396 | 396 | ||
397 | private: | 397 | private: |
398 | QHash<QString, std::function<void*(void)> > mFacadeRegistry; | 398 | QHash<QByteArray, std::function<void*(void)> > mFacadeRegistry; |
399 | }; | 399 | }; |
400 | 400 | ||
401 | /** | 401 | /** |
@@ -424,7 +424,7 @@ public: | |||
424 | // query tells us in which resources we're interested | 424 | // query tells us in which resources we're interested |
425 | // TODO: queries to individual resources could be parallelized | 425 | // TODO: queries to individual resources could be parallelized |
426 | Async::Job<void> job = Async::null<void>(); | 426 | Async::Job<void> job = Async::null<void>(); |
427 | for(const QString &resource : query.resources) { | 427 | for(const QByteArray &resource : query.resources) { |
428 | auto facade = FacadeFactory::instance().getFacade<DomainType>(resource); | 428 | auto facade = FacadeFactory::instance().getFacade<DomainType>(resource); |
429 | //We have to bind an instance to the function callback. Since we use a shared pointer this keeps the result provider instance (and thus also the emitter) alive. | 429 | //We have to bind an instance to the function callback. Since we use a shared pointer this keeps the result provider instance (and thus also the emitter) alive. |
430 | std::function<void(const typename DomainType::Ptr &)> addCallback = std::bind(&ResultProvider<typename DomainType::Ptr>::add, resultSet, std::placeholders::_1); | 430 | std::function<void(const typename DomainType::Ptr &)> addCallback = std::bind(&ResultProvider<typename DomainType::Ptr>::add, resultSet, std::placeholders::_1); |
@@ -463,7 +463,7 @@ public: | |||
463 | */ | 463 | */ |
464 | //TODO return job that tracks progress until resource has stored the message in it's queue? | 464 | //TODO return job that tracks progress until resource has stored the message in it's queue? |
465 | template <class DomainType> | 465 | template <class DomainType> |
466 | static void create(const DomainType &domainObject, const QString &resourceIdentifier) { | 466 | static void create(const DomainType &domainObject, const QByteArray &resourceIdentifier) { |
467 | //Potentially move to separate thread as well | 467 | //Potentially move to separate thread as well |
468 | auto facade = FacadeFactory::instance().getFacade<DomainType>(resourceIdentifier); | 468 | auto facade = FacadeFactory::instance().getFacade<DomainType>(resourceIdentifier); |
469 | auto job = facade->create(domainObject); | 469 | auto job = facade->create(domainObject); |
@@ -478,7 +478,7 @@ public: | |||
478 | * This includes moving etc. since these are also simple settings on a property. | 478 | * This includes moving etc. since these are also simple settings on a property. |
479 | */ | 479 | */ |
480 | template <class DomainType> | 480 | template <class DomainType> |
481 | static void modify(const DomainType &domainObject, const QString &resourceIdentifier) { | 481 | static void modify(const DomainType &domainObject, const QByteArray &resourceIdentifier) { |
482 | //Potentially move to separate thread as well | 482 | //Potentially move to separate thread as well |
483 | auto facade = FacadeFactory::instance().getFacade<DomainType>(resourceIdentifier); | 483 | auto facade = FacadeFactory::instance().getFacade<DomainType>(resourceIdentifier); |
484 | facade.modify(domainObject); | 484 | facade.modify(domainObject); |
@@ -488,13 +488,13 @@ public: | |||
488 | * Remove an entity. | 488 | * Remove an entity. |
489 | */ | 489 | */ |
490 | template <class DomainType> | 490 | template <class DomainType> |
491 | static void remove(const DomainType &domainObject, const QString &resourceIdentifier) { | 491 | static void remove(const DomainType &domainObject, const QByteArray &resourceIdentifier) { |
492 | //Potentially move to separate thread as well | 492 | //Potentially move to separate thread as well |
493 | auto facade = FacadeFactory::instance().getFacade<DomainType>(resourceIdentifier); | 493 | auto facade = FacadeFactory::instance().getFacade<DomainType>(resourceIdentifier); |
494 | facade.remove(domainObject); | 494 | facade.remove(domainObject); |
495 | } | 495 | } |
496 | 496 | ||
497 | static void shutdown(const QString &resourceIdentifier); | 497 | static void shutdown(const QByteArray &resourceIdentifier); |
498 | }; | 498 | }; |
499 | 499 | ||
500 | } | 500 | } |
diff --git a/common/domainadaptor.h b/common/domainadaptor.h index e46e893..692c8c1 100644 --- a/common/domainadaptor.h +++ b/common/domainadaptor.h | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "entity_generated.h" | 22 | #include "entity_generated.h" |
23 | #include <QVariant> | 23 | #include <QVariant> |
24 | #include <QString> | 24 | #include <QByteArray> |
25 | #include <functional> | 25 | #include <functional> |
26 | #include "clientapi.h" //for domain parts | 26 | #include "clientapi.h" //for domain parts |
27 | 27 | ||
@@ -35,7 +35,7 @@ template<typename BufferType> | |||
35 | class PropertyMapper | 35 | class PropertyMapper |
36 | { | 36 | { |
37 | public: | 37 | public: |
38 | void setProperty(const QString &key, const QVariant &value, BufferType *buffer) | 38 | void setProperty(const QByteArray &key, const QVariant &value, BufferType *buffer) |
39 | { | 39 | { |
40 | if (mWriteAccessors.contains(key)) { | 40 | if (mWriteAccessors.contains(key)) { |
41 | auto accessor = mWriteAccessors.value(key); | 41 | auto accessor = mWriteAccessors.value(key); |
@@ -43,7 +43,7 @@ public: | |||
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | virtual QVariant getProperty(const QString &key, BufferType const *buffer) const | 46 | virtual QVariant getProperty(const QByteArray &key, BufferType const *buffer) const |
47 | { | 47 | { |
48 | if (mReadAccessors.contains(key)) { | 48 | if (mReadAccessors.contains(key)) { |
49 | auto accessor = mReadAccessors.value(key); | 49 | auto accessor = mReadAccessors.value(key); |
@@ -51,8 +51,8 @@ public: | |||
51 | } | 51 | } |
52 | return QVariant(); | 52 | return QVariant(); |
53 | } | 53 | } |
54 | QHash<QString, std::function<QVariant(BufferType const *)> > mReadAccessors; | 54 | QHash<QByteArray, std::function<QVariant(BufferType const *)> > mReadAccessors; |
55 | QHash<QString, std::function<void(const QVariant &, BufferType*)> > mWriteAccessors; | 55 | QHash<QByteArray, std::function<void(const QVariant &, BufferType*)> > mWriteAccessors; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | //The factory should define how to go from an entitybuffer (local + resource buffer), to a domain type adapter. | 58 | //The factory should define how to go from an entitybuffer (local + resource buffer), to a domain type adapter. |
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 7320e50..7a343f9 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp | |||
@@ -64,8 +64,8 @@ public: | |||
64 | class ResourceAccess::Private | 64 | class ResourceAccess::Private |
65 | { | 65 | { |
66 | public: | 66 | public: |
67 | Private(const QString &name, ResourceAccess *ra); | 67 | Private(const QByteArray &name, ResourceAccess *ra); |
68 | QString resourceName; | 68 | QByteArray resourceName; |
69 | QLocalSocket *socket; | 69 | QLocalSocket *socket; |
70 | QTimer *tryOpenTimer; | 70 | QTimer *tryOpenTimer; |
71 | bool startingProcess; | 71 | bool startingProcess; |
@@ -77,7 +77,7 @@ public: | |||
77 | uint messageId; | 77 | uint messageId; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | ResourceAccess::Private::Private(const QString &name, ResourceAccess *q) | 80 | ResourceAccess::Private::Private(const QByteArray &name, ResourceAccess *q) |
81 | : resourceName(name), | 81 | : resourceName(name), |
82 | socket(new QLocalSocket(q)), | 82 | socket(new QLocalSocket(q)), |
83 | tryOpenTimer(new QTimer(q)), | 83 | tryOpenTimer(new QTimer(q)), |
@@ -87,7 +87,7 @@ ResourceAccess::Private::Private(const QString &name, ResourceAccess *q) | |||
87 | { | 87 | { |
88 | } | 88 | } |
89 | 89 | ||
90 | ResourceAccess::ResourceAccess(const QString &resourceName, QObject *parent) | 90 | ResourceAccess::ResourceAccess(const QByteArray &resourceName, QObject *parent) |
91 | : QObject(parent), | 91 | : QObject(parent), |
92 | d(new Private(resourceName, this)) | 92 | d(new Private(resourceName, this)) |
93 | { | 93 | { |
@@ -112,7 +112,7 @@ ResourceAccess::~ResourceAccess() | |||
112 | 112 | ||
113 | } | 113 | } |
114 | 114 | ||
115 | QString ResourceAccess::resourceName() const | 115 | QByteArray ResourceAccess::resourceName() const |
116 | { | 116 | { |
117 | return d->resourceName; | 117 | return d->resourceName; |
118 | } | 118 | } |
diff --git a/common/resourceaccess.h b/common/resourceaccess.h index a5a2547..088bf36 100644 --- a/common/resourceaccess.h +++ b/common/resourceaccess.h | |||
@@ -35,10 +35,10 @@ class ResourceAccess : public QObject | |||
35 | Q_OBJECT | 35 | Q_OBJECT |
36 | 36 | ||
37 | public: | 37 | public: |
38 | ResourceAccess(const QString &resourceName, QObject *parent = 0); | 38 | ResourceAccess(const QByteArray &resourceName, QObject *parent = 0); |
39 | ~ResourceAccess(); | 39 | ~ResourceAccess(); |
40 | 40 | ||
41 | QString resourceName() const; | 41 | QByteArray resourceName() const; |
42 | bool isReady() const; | 42 | bool isReady() const; |
43 | 43 | ||
44 | Async::Job<void> sendCommand(int commandId); | 44 | Async::Job<void> sendCommand(int commandId); |
diff --git a/dummyresource/domainadaptor.cpp b/dummyresource/domainadaptor.cpp index 2182f9a..7a767ca 100644 --- a/dummyresource/domainadaptor.cpp +++ b/dummyresource/domainadaptor.cpp | |||
@@ -27,7 +27,7 @@ public: | |||
27 | 27 | ||
28 | } | 28 | } |
29 | 29 | ||
30 | void setProperty(const QString &key, const QVariant &value) | 30 | void setProperty(const QByteArray &key, const QVariant &value) |
31 | { | 31 | { |
32 | if (mResourceMapper && mResourceMapper->mWriteAccessors.contains(key)) { | 32 | if (mResourceMapper && mResourceMapper->mWriteAccessors.contains(key)) { |
33 | // mResourceMapper->setProperty(key, value, mResourceBuffer); | 33 | // mResourceMapper->setProperty(key, value, mResourceBuffer); |
@@ -36,7 +36,7 @@ public: | |||
36 | } | 36 | } |
37 | } | 37 | } |
38 | 38 | ||
39 | virtual QVariant getProperty(const QString &key) const | 39 | virtual QVariant getProperty(const QByteArray &key) const |
40 | { | 40 | { |
41 | if (mResourceBuffer && mResourceMapper->mReadAccessors.contains(key)) { | 41 | if (mResourceBuffer && mResourceMapper->mReadAccessors.contains(key)) { |
42 | return mResourceMapper->getProperty(key, mResourceBuffer); | 42 | return mResourceMapper->getProperty(key, mResourceBuffer); |
@@ -47,9 +47,9 @@ public: | |||
47 | return QVariant(); | 47 | return QVariant(); |
48 | } | 48 | } |
49 | 49 | ||
50 | virtual QStringList availableProperties() const | 50 | virtual QList<QByteArray> availableProperties() const |
51 | { | 51 | { |
52 | QStringList props; | 52 | QList<QByteArray> props; |
53 | props << mResourceMapper->mReadAccessors.keys(); | 53 | props << mResourceMapper->mReadAccessors.keys(); |
54 | props << mLocalMapper->mReadAccessors.keys(); | 54 | props << mLocalMapper->mReadAccessors.keys(); |
55 | return props; | 55 | return props; |
diff --git a/dummyresource/facade.cpp b/dummyresource/facade.cpp index d196e54..1af735e 100644 --- a/dummyresource/facade.cpp +++ b/dummyresource/facade.cpp | |||
@@ -184,7 +184,7 @@ void DummyResourceFacade::readValue(QSharedPointer<Akonadi2::Storage> storage, c | |||
184 | auto adaptor = mFactory->createAdaptor(buffer.entity()); | 184 | auto adaptor = mFactory->createAdaptor(buffer.entity()); |
185 | //TODO only copy requested properties | 185 | //TODO only copy requested properties |
186 | auto memoryAdaptor = QSharedPointer<Akonadi2::Domain::MemoryBufferAdaptor>::create(*adaptor); | 186 | auto memoryAdaptor = QSharedPointer<Akonadi2::Domain::MemoryBufferAdaptor>::create(*adaptor); |
187 | auto event = QSharedPointer<Akonadi2::Domain::Event>::create("org.kde.dummy", QString::fromUtf8(static_cast<char*>(keyValue), keySize), revision, memoryAdaptor); | 187 | auto event = QSharedPointer<Akonadi2::Domain::Event>::create("org.kde.dummy", QByteArray::fromRawData(static_cast<char*>(keyValue), keySize), revision, memoryAdaptor); |
188 | resultCallback(event); | 188 | resultCallback(event); |
189 | } | 189 | } |
190 | return true; | 190 | return true; |
diff --git a/synchronizer/listener.cpp b/synchronizer/listener.cpp index edd9123..00d9207 100644 --- a/synchronizer/listener.cpp +++ b/synchronizer/listener.cpp | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <QLocalSocket> | 35 | #include <QLocalSocket> |
36 | #include <QTimer> | 36 | #include <QTimer> |
37 | 37 | ||
38 | Listener::Listener(const QString &resourceName, QObject *parent) | 38 | Listener::Listener(const QByteArray &resourceName, QObject *parent) |
39 | : QObject(parent), | 39 | : QObject(parent), |
40 | m_server(new QLocalServer(this)), | 40 | m_server(new QLocalServer(this)), |
41 | m_resourceName(resourceName), | 41 | m_resourceName(resourceName), |
@@ -48,11 +48,11 @@ Listener::Listener(const QString &resourceName, QObject *parent) | |||
48 | this, &Listener::refreshRevision); | 48 | this, &Listener::refreshRevision); |
49 | connect(m_server, &QLocalServer::newConnection, | 49 | connect(m_server, &QLocalServer::newConnection, |
50 | this, &Listener::acceptConnection); | 50 | this, &Listener::acceptConnection); |
51 | Log() << QString("Trying to open %1").arg(resourceName); | 51 | Log() << "Trying to open " << m_resourceName; |
52 | if (!m_server->listen(resourceName)) { | 52 | if (!m_server->listen(QString::fromLatin1(resourceName))) { |
53 | // FIXME: multiple starts need to be handled here | 53 | // FIXME: multiple starts need to be handled here |
54 | m_server->removeServer(resourceName); | 54 | m_server->removeServer(resourceName); |
55 | if (!m_server->listen(resourceName)) { | 55 | if (!m_server->listen(QString::fromLatin1(resourceName))) { |
56 | Warning() << "Utter failure to start server"; | 56 | Warning() << "Utter failure to start server"; |
57 | exit(-1); | 57 | exit(-1); |
58 | } | 58 | } |
@@ -365,10 +365,10 @@ void Listener::loadResource() | |||
365 | Log() << QString("Resource factory: %1").arg((qlonglong)resourceFactory); | 365 | Log() << QString("Resource factory: %1").arg((qlonglong)resourceFactory); |
366 | Log() << QString("\tResource: %1").arg((qlonglong)m_resource); | 366 | Log() << QString("\tResource: %1").arg((qlonglong)m_resource); |
367 | //TODO: this doesn't really list all the facades .. fix | 367 | //TODO: this doesn't really list all the facades .. fix |
368 | Log() << QString("\tFacades: %1").arg(Akonadi2::FacadeFactory::instance().getFacade<Akonadi2::Domain::Event>(m_resourceName)->type()); | 368 | Log() << "\tFacades: " << Akonadi2::FacadeFactory::instance().getFacade<Akonadi2::Domain::Event>(m_resourceName)->type(); |
369 | m_resource->configurePipeline(m_pipeline); | 369 | m_resource->configurePipeline(m_pipeline); |
370 | } else { | 370 | } else { |
371 | Error() << QString("Failed to load resource %1").arg(m_resourceName); | 371 | Error() << "Failed to load resource " << m_resourceName; |
372 | } | 372 | } |
373 | //TODO: on failure ... what? | 373 | //TODO: on failure ... what? |
374 | //Enter broken state? | 374 | //Enter broken state? |
diff --git a/synchronizer/listener.h b/synchronizer/listener.h index 8dad3a4..d2ef0fc 100644 --- a/synchronizer/listener.h +++ b/synchronizer/listener.h | |||
@@ -58,7 +58,7 @@ class Listener : public QObject | |||
58 | Q_OBJECT | 58 | Q_OBJECT |
59 | 59 | ||
60 | public: | 60 | public: |
61 | Listener(const QString &resourceName, QObject *parent = 0); | 61 | Listener(const QByteArray &resourceName, QObject *parent = 0); |
62 | ~Listener(); | 62 | ~Listener(); |
63 | 63 | ||
64 | Q_SIGNALS: | 64 | Q_SIGNALS: |
@@ -87,7 +87,7 @@ private: | |||
87 | QLocalServer *m_server; | 87 | QLocalServer *m_server; |
88 | QVector<Client> m_connections; | 88 | QVector<Client> m_connections; |
89 | flatbuffers::FlatBufferBuilder m_fbb; | 89 | flatbuffers::FlatBufferBuilder m_fbb; |
90 | const QString m_resourceName; | 90 | const QByteArray m_resourceName; |
91 | Akonadi2::Resource *m_resource; | 91 | Akonadi2::Resource *m_resource; |
92 | Akonadi2::Pipeline *m_pipeline; | 92 | Akonadi2::Pipeline *m_pipeline; |
93 | QTimer *m_clientBufferProcessesTimer; | 93 | QTimer *m_clientBufferProcessesTimer; |
diff --git a/tests/domainadaptortest.cpp b/tests/domainadaptortest.cpp index cedbf94..e45a9a3 100644 --- a/tests/domainadaptortest.cpp +++ b/tests/domainadaptortest.cpp | |||
@@ -21,7 +21,7 @@ public: | |||
21 | { | 21 | { |
22 | } | 22 | } |
23 | 23 | ||
24 | void setProperty(const QString &key, const QVariant &value) | 24 | void setProperty(const QByteArray &key, const QVariant &value) |
25 | { | 25 | { |
26 | if (mResourceMapper->mWriteAccessors.contains(key)) { | 26 | if (mResourceMapper->mWriteAccessors.contains(key)) { |
27 | // mResourceMapper.setProperty(key, value, mResourceBuffer); | 27 | // mResourceMapper.setProperty(key, value, mResourceBuffer); |
@@ -30,7 +30,7 @@ public: | |||
30 | } | 30 | } |
31 | } | 31 | } |
32 | 32 | ||
33 | virtual QVariant getProperty(const QString &key) const | 33 | virtual QVariant getProperty(const QByteArray &key) const |
34 | { | 34 | { |
35 | if (mResourceBuffer && mResourceMapper->mReadAccessors.contains(key)) { | 35 | if (mResourceBuffer && mResourceMapper->mReadAccessors.contains(key)) { |
36 | return mResourceMapper->getProperty(key, mResourceBuffer); | 36 | return mResourceMapper->getProperty(key, mResourceBuffer); |