summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandro Knauß <sknauss@kde.org>2017-01-16 17:36:47 +0100
committerSandro Knauß <sknauss@kde.org>2017-01-30 10:59:30 +0100
commit2486b417dbfb4daf0741f7b870e3d276fac87729 (patch)
tree9008a38b4d95edb46678c9db2f8c4a4c3084a0fd
parentbb624c5ec2ab2e13dedcba67fd60e3d2f03216d7 (diff)
downloadsink-2486b417dbfb4daf0741f7b870e3d276fac87729.tar.gz
sink-2486b417dbfb4daf0741f7b870e3d276fac87729.zip
make contacts suitable for applications like sinksh
-rw-r--r--common/domain/applicationdomaintype.h4
-rw-r--r--common/domain/applicationdomaintype_p.h2
-rw-r--r--common/domainadaptor.h1
-rw-r--r--common/facade.cpp1
-rw-r--r--common/queryrunner.cpp2
-rw-r--r--common/synchronizer.cpp5
-rw-r--r--common/synchronizer.h1
-rw-r--r--sinksh/sinksh_utils.cpp3
8 files changed, 17 insertions, 2 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h
index e4ed05b..8ebf6cb 100644
--- a/common/domain/applicationdomaintype.h
+++ b/common/domain/applicationdomaintype.h
@@ -330,10 +330,10 @@ struct SINK_EXPORT Entity : public ApplicationDomainType {
330 330
331struct SINK_EXPORT Contact : public Entity { 331struct SINK_EXPORT Contact : public Entity {
332 SINK_ENTITY(Contact); 332 SINK_ENTITY(Contact);
333 SINK_EXTRACTED_PROPERTY(QString, Uid, uid); 333 SINK_PROPERTY(QString, Uid, uid);
334 SINK_PROPERTY(QString, Fn, fn); 334 SINK_PROPERTY(QString, Fn, fn);
335 SINK_PROPERTY(QByteArrayList, Emails, emails); 335 SINK_PROPERTY(QByteArrayList, Emails, emails);
336 SINK_BLOB_PROPERTY(Vcard, vcard); 336 SINK_PROPERTY(QByteArray, Vcard, vcard);
337}; 337};
338 338
339struct SINK_EXPORT Event : public Entity { 339struct SINK_EXPORT Event : public Entity {
diff --git a/common/domain/applicationdomaintype_p.h b/common/domain/applicationdomaintype_p.h
index aedf21f..4b06864 100644
--- a/common/domain/applicationdomaintype_p.h
+++ b/common/domain/applicationdomaintype_p.h
@@ -38,6 +38,8 @@ struct TypeHelper {
38 return Func<Sink::ApplicationDomain::Mail>{}(std::forward<Args...>(args...)); 38 return Func<Sink::ApplicationDomain::Mail>{}(std::forward<Args...>(args...));
39 } else if (type == Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Event>()) { 39 } else if (type == Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Event>()) {
40 return Func<Sink::ApplicationDomain::Event>{}(std::forward<Args...>(args...)); 40 return Func<Sink::ApplicationDomain::Event>{}(std::forward<Args...>(args...));
41 } else if (type == Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Contact>()) {
42 return Func<Sink::ApplicationDomain::Contact>{}(std::forward<Args...>(args...));
41 } else { 43 } else {
42 Q_ASSERT(false); 44 Q_ASSERT(false);
43 } 45 }
diff --git a/common/domainadaptor.h b/common/domainadaptor.h
index e7b8c1e..0377ef4 100644
--- a/common/domainadaptor.h
+++ b/common/domainadaptor.h
@@ -26,6 +26,7 @@
26 26
27#include "domaintypeadaptorfactoryinterface.h" 27#include "domaintypeadaptorfactoryinterface.h"
28#include "domain/applicationdomaintype.h" 28#include "domain/applicationdomaintype.h"
29#include "domain/contact.h"
29#include "domain/event.h" 30#include "domain/event.h"
30#include "domain/mail.h" 31#include "domain/mail.h"
31#include "domain/folder.h" 32#include "domain/folder.h"
diff --git a/common/facade.cpp b/common/facade.cpp
index 7f2da56..56271e6 100644
--- a/common/facade.cpp
+++ b/common/facade.cpp
@@ -111,6 +111,7 @@ QPair<KAsync::Job<void>, typename ResultEmitter<typename DomainType::Ptr>::Ptr>
111} 111}
112 112
113 113
114template class Sink::GenericFacade<Sink::ApplicationDomain::Contact>;
114template class Sink::GenericFacade<Sink::ApplicationDomain::Folder>; 115template class Sink::GenericFacade<Sink::ApplicationDomain::Folder>;
115template class Sink::GenericFacade<Sink::ApplicationDomain::Mail>; 116template class Sink::GenericFacade<Sink::ApplicationDomain::Mail>;
116template class Sink::GenericFacade<Sink::ApplicationDomain::Event>; 117template class Sink::GenericFacade<Sink::ApplicationDomain::Event>;
diff --git a/common/queryrunner.cpp b/common/queryrunner.cpp
index 0862378..a86d8a8 100644
--- a/common/queryrunner.cpp
+++ b/common/queryrunner.cpp
@@ -250,9 +250,11 @@ ReplayResult QueryWorker<DomainType>::executeInitialQuery(
250 return {entityStore.maxRevision(), replayResult.replayedEntities, replayResult.replayedAll}; 250 return {entityStore.maxRevision(), replayResult.replayedEntities, replayResult.replayedAll};
251} 251}
252 252
253template class QueryRunner<Sink::ApplicationDomain::Contact>;
253template class QueryRunner<Sink::ApplicationDomain::Folder>; 254template class QueryRunner<Sink::ApplicationDomain::Folder>;
254template class QueryRunner<Sink::ApplicationDomain::Mail>; 255template class QueryRunner<Sink::ApplicationDomain::Mail>;
255template class QueryRunner<Sink::ApplicationDomain::Event>; 256template class QueryRunner<Sink::ApplicationDomain::Event>;
257template class QueryWorker<Sink::ApplicationDomain::Contact>;
256template class QueryWorker<Sink::ApplicationDomain::Folder>; 258template class QueryWorker<Sink::ApplicationDomain::Folder>;
257template class QueryWorker<Sink::ApplicationDomain::Mail>; 259template class QueryWorker<Sink::ApplicationDomain::Mail>;
258template class QueryWorker<Sink::ApplicationDomain::Event>; 260template class QueryWorker<Sink::ApplicationDomain::Event>;
diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp
index e19140c..a8af114 100644
--- a/common/synchronizer.cpp
+++ b/common/synchronizer.cpp
@@ -530,6 +530,11 @@ KAsync::Job<void> Synchronizer::replay(const QByteArray &type, const QByteArray
530 }); 530 });
531} 531}
532 532
533KAsync::Job<QByteArray> Synchronizer::replay(const ApplicationDomain::Contact &, Sink::Operation, const QByteArray &, const QList<QByteArray> &)
534{
535 return KAsync::null<QByteArray>();
536}
537
533KAsync::Job<QByteArray> Synchronizer::replay(const ApplicationDomain::Mail &, Sink::Operation, const QByteArray &, const QList<QByteArray> &) 538KAsync::Job<QByteArray> Synchronizer::replay(const ApplicationDomain::Mail &, Sink::Operation, const QByteArray &, const QList<QByteArray> &)
534{ 539{
535 return KAsync::null<QByteArray>(); 540 return KAsync::null<QByteArray>();
diff --git a/common/synchronizer.h b/common/synchronizer.h
index 73c91a3..4240782 100644
--- a/common/synchronizer.h
+++ b/common/synchronizer.h
@@ -72,6 +72,7 @@ protected:
72 72
73protected: 73protected:
74 ///Implement to write back changes to the server 74 ///Implement to write back changes to the server
75 virtual KAsync::Job<QByteArray> replay(const Sink::ApplicationDomain::Contact &, Sink::Operation, const QByteArray &oldRemoteId, const QList<QByteArray> &);
75 virtual KAsync::Job<QByteArray> replay(const Sink::ApplicationDomain::Mail &, Sink::Operation, const QByteArray &oldRemoteId, const QList<QByteArray> &); 76 virtual KAsync::Job<QByteArray> replay(const Sink::ApplicationDomain::Mail &, Sink::Operation, const QByteArray &oldRemoteId, const QList<QByteArray> &);
76 virtual KAsync::Job<QByteArray> replay(const Sink::ApplicationDomain::Folder &, Sink::Operation, const QByteArray &oldRemoteId, const QList<QByteArray> &); 77 virtual KAsync::Job<QByteArray> replay(const Sink::ApplicationDomain::Folder &, Sink::Operation, const QByteArray &oldRemoteId, const QList<QByteArray> &);
77 78
diff --git a/sinksh/sinksh_utils.cpp b/sinksh/sinksh_utils.cpp
index 71a47b1..9a0d1d8 100644
--- a/sinksh/sinksh_utils.cpp
+++ b/sinksh/sinksh_utils.cpp
@@ -54,6 +54,9 @@ StoreBase &getStore(const QString &type)
54 } else if (type == getTypeName<Identity>()) { 54 } else if (type == getTypeName<Identity>()) {
55 static Store<Identity> store; 55 static Store<Identity> store;
56 return store; 56 return store;
57 } else if (type == getTypeName<Contact>()) {
58 static Store<Contact> store;
59 return store;
57 } 60 }
58 61
59 SinkWarning_("", "") << "Trying to get a store that doesn't exist: " << type; 62 SinkWarning_("", "") << "Trying to get a store that doesn't exist: " << type;