summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/CMakeLists.txt1
-rw-r--r--common/domain/applicationdomaintype.cpp10
-rw-r--r--common/domain/applicationdomaintype.h24
-rw-r--r--common/domain/applicationdomaintype_p.h2
-rw-r--r--common/domain/calendar.fbs8
-rw-r--r--common/domain/event.fbs3
-rw-r--r--common/domain/typeimplementations.cpp25
-rw-r--r--common/domain/typeimplementations.h12
8 files changed, 76 insertions, 9 deletions
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 76579dd..9c4d4f1 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -104,6 +104,7 @@ generate_flatbuffers(
104 domain/contact 104 domain/contact
105 domain/addressbook 105 domain/addressbook
106 domain/event 106 domain/event
107 domain/calendar
107 domain/mail 108 domain/mail
108 domain/folder 109 domain/folder
109 domain/dummy 110 domain/dummy
diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp
index ff2990d..9a213dd 100644
--- a/common/domain/applicationdomaintype.cpp
+++ b/common/domain/applicationdomaintype.cpp
@@ -395,7 +395,15 @@ SinkResource ImapResource::create(const QByteArray &account)
395SinkResource CardDavResource::create(const QByteArray &account) 395SinkResource CardDavResource::create(const QByteArray &account)
396{ 396{
397 auto &&resource = ApplicationDomainType::createEntity<SinkResource>(); 397 auto &&resource = ApplicationDomainType::createEntity<SinkResource>();
398 resource.setResourceType("sink.dav"); 398 resource.setResourceType("sink.carddav");
399 resource.setAccount(account);
400 return resource;
401}
402
403SinkResource CalDavResource::create(const QByteArray &account)
404{
405 auto &&resource = ApplicationDomainType::createEntity<SinkResource>();
406 resource.setResourceType("sink.caldav");
399 resource.setAccount(account); 407 resource.setAccount(account);
400 return resource; 408 return resource;
401} 409}
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h
index d05e981..e05acaa 100644
--- a/common/domain/applicationdomaintype.h
+++ b/common/domain/applicationdomaintype.h
@@ -389,22 +389,24 @@ struct SINK_EXPORT Contact : public Entity {
389 SINK_REFERENCE_PROPERTY(Addressbook, Addressbook, addressbook); 389 SINK_REFERENCE_PROPERTY(Addressbook, Addressbook, addressbook);
390}; 390};
391 391
392struct SINK_EXPORT Calendar : public Entity {
393 SINK_ENTITY(Calendar, calendar);
394 SINK_PROPERTY(QString, Name, name);
395};
396
392struct SINK_EXPORT Event : public Entity { 397struct SINK_EXPORT Event : public Entity {
393 SINK_ENTITY(Event, event); 398 SINK_ENTITY(Event, event);
394 SINK_PROPERTY(QString, Uid, uid); 399 SINK_PROPERTY(QString, Uid, uid);
395 SINK_PROPERTY(QString, Summary, summary); 400 SINK_PROPERTY(QString, Summary, summary);
396 SINK_PROPERTY(QString, Description, description); 401 SINK_PROPERTY(QString, Description, description);
397 SINK_PROPERTY(QByteArray, Attachment, attachment); 402 SINK_PROPERTY(QDateTime, StartTime, startTime);
403 SINK_REFERENCE_PROPERTY(Calendar, Calendar, calendar);
398}; 404};
399 405
400struct SINK_EXPORT Todo : public Entity { 406struct SINK_EXPORT Todo : public Entity {
401 SINK_ENTITY(Todo, todo); 407 SINK_ENTITY(Todo, todo);
402}; 408};
403 409
404struct SINK_EXPORT Calendar : public Entity {
405 SINK_ENTITY(Calendar, calendar);
406};
407
408struct SINK_EXPORT Folder : public Entity { 410struct SINK_EXPORT Folder : public Entity {
409 SINK_ENTITY(Folder, folder); 411 SINK_ENTITY(Folder, folder);
410 SINK_REFERENCE_PROPERTY(Folder, Parent, parent); 412 SINK_REFERENCE_PROPERTY(Folder, Parent, parent);
@@ -477,6 +479,10 @@ struct SINK_EXPORT CardDavResource {
477 static SinkResource create(const QByteArray &account); 479 static SinkResource create(const QByteArray &account);
478}; 480};
479 481
482struct SINK_EXPORT CalDavResource {
483 static SinkResource create(const QByteArray &account);
484};
485
480namespace ResourceCapabilities { 486namespace ResourceCapabilities {
481namespace Mail { 487namespace Mail {
482 static constexpr const char *mail = "mail"; 488 static constexpr const char *mail = "mail";
@@ -493,6 +499,11 @@ namespace Contact {
493 static constexpr const char *addressbook = "addressbook"; 499 static constexpr const char *addressbook = "addressbook";
494 static constexpr const char *storage = "contact.storage"; 500 static constexpr const char *storage = "contact.storage";
495}; 501};
502namespace Event {
503 static constexpr const char *event = "event";
504 static constexpr const char *calendar = "calendar";
505 static constexpr const char *storage = "event.storage";
506};
496}; 507};
497 508
498namespace SpecialPurpose { 509namespace SpecialPurpose {
@@ -522,7 +533,7 @@ bool SINK_EXPORT isGlobalType(const QByteArray &type);
522 533
523/** 534/**
524 * Type implementation. 535 * Type implementation.
525 * 536 *
526 * Needs to be implemented for every application domain type. 537 * Needs to be implemented for every application domain type.
527 * Contains all non-resource specific, but type-specific code. 538 * Contains all non-resource specific, but type-specific code.
528 */ 539 */
@@ -545,6 +556,7 @@ class SINK_EXPORT TypeImplementation;
545 REGISTER_TYPE(Sink::ApplicationDomain::Contact) \ 556 REGISTER_TYPE(Sink::ApplicationDomain::Contact) \
546 REGISTER_TYPE(Sink::ApplicationDomain::Addressbook) \ 557 REGISTER_TYPE(Sink::ApplicationDomain::Addressbook) \
547 REGISTER_TYPE(Sink::ApplicationDomain::Event) \ 558 REGISTER_TYPE(Sink::ApplicationDomain::Event) \
559 REGISTER_TYPE(Sink::ApplicationDomain::Calendar) \
548 REGISTER_TYPE(Sink::ApplicationDomain::Mail) \ 560 REGISTER_TYPE(Sink::ApplicationDomain::Mail) \
549 REGISTER_TYPE(Sink::ApplicationDomain::Folder) \ 561 REGISTER_TYPE(Sink::ApplicationDomain::Folder) \
550 REGISTER_TYPE(Sink::ApplicationDomain::SinkResource) \ 562 REGISTER_TYPE(Sink::ApplicationDomain::SinkResource) \
diff --git a/common/domain/applicationdomaintype_p.h b/common/domain/applicationdomaintype_p.h
index a60df38..734ac3e 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::Calendar>()) {
42 return Func<Sink::ApplicationDomain::Calendar>{}(std::forward<Args...>(args...));
41 } else if (type == Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Contact>()) { 43 } else if (type == Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Contact>()) {
42 return Func<Sink::ApplicationDomain::Contact>{}(std::forward<Args...>(args...)); 44 return Func<Sink::ApplicationDomain::Contact>{}(std::forward<Args...>(args...));
43 } else if (type == Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Addressbook>()) { 45 } else if (type == Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Addressbook>()) {
diff --git a/common/domain/calendar.fbs b/common/domain/calendar.fbs
new file mode 100644
index 0000000..9788539
--- /dev/null
+++ b/common/domain/calendar.fbs
@@ -0,0 +1,8 @@
1namespace Sink.ApplicationDomain.Buffer;
2
3table Calendar {
4 name:string;
5}
6
7root_type Calendar;
8file_identifier "AKFB";
diff --git a/common/domain/event.fbs b/common/domain/event.fbs
index 69148ef..68c8608 100644
--- a/common/domain/event.fbs
+++ b/common/domain/event.fbs
@@ -4,7 +4,8 @@ table Event {
4 uid:string; 4 uid:string;
5 summary:string; 5 summary:string;
6 description:string; 6 description:string;
7 attachment:[ubyte]; 7 startTime:string;
8 calendar:string;
8} 9}
9 10
10root_type Event; 11root_type Event;
diff --git a/common/domain/typeimplementations.cpp b/common/domain/typeimplementations.cpp
index 29da7ea..fe70d74 100644
--- a/common/domain/typeimplementations.cpp
+++ b/common/domain/typeimplementations.cpp
@@ -67,6 +67,11 @@ typedef IndexConfig<Event,
67 ValueIndex<Event::Uid> 67 ValueIndex<Event::Uid>
68 > EventIndexConfig; 68 > EventIndexConfig;
69 69
70typedef IndexConfig<Calendar,
71 ValueIndex<Calendar::Name>
72 > CalendarIndexConfig;
73
74
70 75
71void TypeImplementation<Mail>::configure(TypeIndex &index) 76void TypeImplementation<Mail>::configure(TypeIndex &index)
72{ 77{
@@ -201,7 +206,8 @@ void TypeImplementation<Event>::configure(PropertyMapper &propertyMapper)
201 SINK_REGISTER_SERIALIZER(propertyMapper, Event, Summary, summary); 206 SINK_REGISTER_SERIALIZER(propertyMapper, Event, Summary, summary);
202 SINK_REGISTER_SERIALIZER(propertyMapper, Event, Description, description); 207 SINK_REGISTER_SERIALIZER(propertyMapper, Event, Description, description);
203 SINK_REGISTER_SERIALIZER(propertyMapper, Event, Uid, uid); 208 SINK_REGISTER_SERIALIZER(propertyMapper, Event, Uid, uid);
204 SINK_REGISTER_SERIALIZER(propertyMapper, Event, Attachment, attachment); 209 SINK_REGISTER_SERIALIZER(propertyMapper, Event, StartTime, startTime);
210 SINK_REGISTER_SERIALIZER(propertyMapper, Event, Calendar, calendar);
205} 211}
206 212
207void TypeImplementation<Event>::configure(IndexPropertyMapper &) 213void TypeImplementation<Event>::configure(IndexPropertyMapper &)
@@ -209,3 +215,20 @@ void TypeImplementation<Event>::configure(IndexPropertyMapper &)
209 215
210} 216}
211 217
218
219void TypeImplementation<Calendar>::configure(TypeIndex &index)
220{
221 CalendarIndexConfig::configure(index);
222}
223
224QMap<QByteArray, int> TypeImplementation<Calendar>::typeDatabases()
225{
226 return merge(QMap<QByteArray, int>{{QByteArray{Calendar::name} + ".main", 0}}, CalendarIndexConfig::databases());
227}
228
229void TypeImplementation<Calendar>::configure(PropertyMapper &propertyMapper)
230{
231 SINK_REGISTER_SERIALIZER(propertyMapper, Calendar, Name, name);
232}
233
234void TypeImplementation<Calendar>::configure(IndexPropertyMapper &) {}
diff --git a/common/domain/typeimplementations.h b/common/domain/typeimplementations.h
index d36dfc1..7a8a602 100644
--- a/common/domain/typeimplementations.h
+++ b/common/domain/typeimplementations.h
@@ -23,6 +23,7 @@
23#include "mail_generated.h" 23#include "mail_generated.h"
24#include "folder_generated.h" 24#include "folder_generated.h"
25#include "event_generated.h" 25#include "event_generated.h"
26#include "calendar_generated.h"
26#include "contact_generated.h" 27#include "contact_generated.h"
27#include "addressbook_generated.h" 28#include "addressbook_generated.h"
28 29
@@ -94,5 +95,16 @@ public:
94 static QMap<QByteArray, int> typeDatabases(); 95 static QMap<QByteArray, int> typeDatabases();
95}; 96};
96 97
98template<>
99class TypeImplementation<Sink::ApplicationDomain::Calendar> {
100public:
101 typedef Sink::ApplicationDomain::Buffer::Calendar Buffer;
102 typedef Sink::ApplicationDomain::Buffer::CalendarBuilder BufferBuilder;
103 static void configure(TypeIndex &);
104 static void configure(PropertyMapper &);
105 static void configure(IndexPropertyMapper &indexPropertyMapper);
106 static QMap<QByteArray, int> typeDatabases();
107};
108
97} 109}
98} 110}