summaryrefslogtreecommitdiffstats
path: root/common/domain
diff options
context:
space:
mode:
Diffstat (limited to 'common/domain')
-rw-r--r--common/domain/applicationdomaintype.cpp13
-rw-r--r--common/domain/applicationdomaintype.h17
-rw-r--r--common/domain/applicationdomaintype_p.h2
-rw-r--r--common/domain/propertyregistry.cpp6
-rw-r--r--common/domain/todo.fbs18
-rw-r--r--common/domain/typeimplementations.cpp35
-rw-r--r--common/domain/typeimplementations.h12
7 files changed, 103 insertions, 0 deletions
diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp
index 78d46ee..b1469e1 100644
--- a/common/domain/applicationdomaintype.cpp
+++ b/common/domain/applicationdomaintype.cpp
@@ -132,6 +132,19 @@ SINK_REGISTER_PROPERTY(Event, EndTime);
132SINK_REGISTER_PROPERTY(Event, Ical); 132SINK_REGISTER_PROPERTY(Event, Ical);
133SINK_REGISTER_PROPERTY(Event, Calendar); 133SINK_REGISTER_PROPERTY(Event, Calendar);
134 134
135SINK_REGISTER_ENTITY(Todo);
136SINK_REGISTER_PROPERTY(Todo, Uid);
137SINK_REGISTER_PROPERTY(Todo, Summary);
138SINK_REGISTER_PROPERTY(Todo, Description);
139SINK_REGISTER_PROPERTY(Todo, CompletedDate);
140SINK_REGISTER_PROPERTY(Todo, DueDate);
141SINK_REGISTER_PROPERTY(Todo, StartDate);
142SINK_REGISTER_PROPERTY(Todo, Status);
143SINK_REGISTER_PROPERTY(Todo, Priority);
144SINK_REGISTER_PROPERTY(Todo, Categories);
145SINK_REGISTER_PROPERTY(Todo, Ical);
146SINK_REGISTER_PROPERTY(Todo, Calendar);
147
135SINK_REGISTER_ENTITY(Calendar); 148SINK_REGISTER_ENTITY(Calendar);
136SINK_REGISTER_PROPERTY(Calendar, Name); 149SINK_REGISTER_PROPERTY(Calendar, Name);
137 150
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h
index 39e66ab..93de8f5 100644
--- a/common/domain/applicationdomaintype.h
+++ b/common/domain/applicationdomaintype.h
@@ -407,6 +407,17 @@ struct SINK_EXPORT Event : public Entity {
407 407
408struct SINK_EXPORT Todo : public Entity { 408struct SINK_EXPORT Todo : public Entity {
409 SINK_ENTITY(Todo, todo); 409 SINK_ENTITY(Todo, todo);
410 SINK_EXTRACTED_PROPERTY(QString, Uid, uid);
411 SINK_EXTRACTED_PROPERTY(QString, Summary, summary);
412 SINK_EXTRACTED_PROPERTY(QString, Description, description);
413 SINK_EXTRACTED_PROPERTY(QDateTime, CompletedDate, completedDate);
414 SINK_EXTRACTED_PROPERTY(QDateTime, DueDate, dueDate);
415 SINK_EXTRACTED_PROPERTY(QDateTime, StartDate, startDate);
416 SINK_EXTRACTED_PROPERTY(QString, Status, status);
417 SINK_EXTRACTED_PROPERTY(int, Priority, priority);
418 SINK_EXTRACTED_PROPERTY(QStringList, Categories, categories);
419 SINK_PROPERTY(QByteArray, Ical, ical);
420 SINK_REFERENCE_PROPERTY(Calendar, Calendar, calendar);
410}; 421};
411 422
412struct SINK_EXPORT Folder : public Entity { 423struct SINK_EXPORT Folder : public Entity {
@@ -506,6 +517,11 @@ namespace Event {
506 static constexpr const char *calendar = "calendar"; 517 static constexpr const char *calendar = "calendar";
507 static constexpr const char *storage = "event.storage"; 518 static constexpr const char *storage = "event.storage";
508}; 519};
520namespace Todo {
521 static constexpr const char *todo = "todo";
522 static constexpr const char *calendar = "calendar";
523 static constexpr const char *storage = "todo.storage";
524};
509}; 525};
510 526
511namespace SpecialPurpose { 527namespace SpecialPurpose {
@@ -558,6 +574,7 @@ class SINK_EXPORT TypeImplementation;
558 REGISTER_TYPE(Sink::ApplicationDomain::Contact) \ 574 REGISTER_TYPE(Sink::ApplicationDomain::Contact) \
559 REGISTER_TYPE(Sink::ApplicationDomain::Addressbook) \ 575 REGISTER_TYPE(Sink::ApplicationDomain::Addressbook) \
560 REGISTER_TYPE(Sink::ApplicationDomain::Event) \ 576 REGISTER_TYPE(Sink::ApplicationDomain::Event) \
577 REGISTER_TYPE(Sink::ApplicationDomain::Todo) \
561 REGISTER_TYPE(Sink::ApplicationDomain::Calendar) \ 578 REGISTER_TYPE(Sink::ApplicationDomain::Calendar) \
562 REGISTER_TYPE(Sink::ApplicationDomain::Mail) \ 579 REGISTER_TYPE(Sink::ApplicationDomain::Mail) \
563 REGISTER_TYPE(Sink::ApplicationDomain::Folder) \ 580 REGISTER_TYPE(Sink::ApplicationDomain::Folder) \
diff --git a/common/domain/applicationdomaintype_p.h b/common/domain/applicationdomaintype_p.h
index 734ac3e..248f6f0 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::Todo>()) {
42 return Func<Sink::ApplicationDomain::Todo>{}(std::forward<Args...>(args...));
41 } else if (type == Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Calendar>()) { 43 } else if (type == Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Calendar>()) {
42 return Func<Sink::ApplicationDomain::Calendar>{}(std::forward<Args...>(args...)); 44 return Func<Sink::ApplicationDomain::Calendar>{}(std::forward<Args...>(args...));
43 } else if (type == Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Contact>()) { 45 } else if (type == Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Contact>()) {
diff --git a/common/domain/propertyregistry.cpp b/common/domain/propertyregistry.cpp
index d929d68..00bbb1d 100644
--- a/common/domain/propertyregistry.cpp
+++ b/common/domain/propertyregistry.cpp
@@ -75,6 +75,12 @@ QVariant parseString<QList<QByteArray>>(const QString &s)
75} 75}
76 76
77template <> 77template <>
78QVariant parseString<QStringList>(const QString &s)
79{
80 return s.split(',');
81}
82
83template <>
78QVariant parseString<QDateTime>(const QString &s) 84QVariant parseString<QDateTime>(const QString &s)
79{ 85{
80 return QVariant::fromValue(QDateTime::fromString(s, Qt::ISODate)); 86 return QVariant::fromValue(QDateTime::fromString(s, Qt::ISODate));
diff --git a/common/domain/todo.fbs b/common/domain/todo.fbs
new file mode 100644
index 0000000..b448cae
--- /dev/null
+++ b/common/domain/todo.fbs
@@ -0,0 +1,18 @@
1namespace Sink.ApplicationDomain.Buffer;
2
3table Todo {
4 uid:string;
5 summary:string;
6 description:string;
7 completedDate:string;
8 dueDate:string;
9 startDate:string;
10 status:string;
11 priority:int;
12 categories:[string];
13 ical:string;
14 calendar:string;
15}
16
17root_type Todo;
18file_identifier "AKFB";
diff --git a/common/domain/typeimplementations.cpp b/common/domain/typeimplementations.cpp
index 615c8e8..b584138 100644
--- a/common/domain/typeimplementations.cpp
+++ b/common/domain/typeimplementations.cpp
@@ -67,6 +67,10 @@ typedef IndexConfig<Event,
67 ValueIndex<Event::Uid> 67 ValueIndex<Event::Uid>
68 > EventIndexConfig; 68 > EventIndexConfig;
69 69
70typedef IndexConfig<Todo,
71 ValueIndex<Todo::Uid>
72 > TodoIndexConfig;
73
70typedef IndexConfig<Calendar, 74typedef IndexConfig<Calendar,
71 ValueIndex<Calendar::Name> 75 ValueIndex<Calendar::Name>
72 > CalendarIndexConfig; 76 > CalendarIndexConfig;
@@ -218,6 +222,37 @@ void TypeImplementation<Event>::configure(IndexPropertyMapper &)
218} 222}
219 223
220 224
225void TypeImplementation<Todo>::configure(TypeIndex &index)
226{
227 TodoIndexConfig::configure(index);
228}
229
230QMap<QByteArray, int> TypeImplementation<Todo>::typeDatabases()
231{
232 return merge(QMap<QByteArray, int>{{QByteArray{Todo::name} + ".main", 0}}, TodoIndexConfig::databases());
233}
234
235void TypeImplementation<Todo>::configure(PropertyMapper &propertyMapper)
236{
237 SINK_REGISTER_SERIALIZER(propertyMapper, Todo, Uid, uid);
238 SINK_REGISTER_SERIALIZER(propertyMapper, Todo, Summary, summary);
239 SINK_REGISTER_SERIALIZER(propertyMapper, Todo, Description, description);
240 SINK_REGISTER_SERIALIZER(propertyMapper, Todo, CompletedDate, completedDate);
241 SINK_REGISTER_SERIALIZER(propertyMapper, Todo, DueDate, dueDate);
242 SINK_REGISTER_SERIALIZER(propertyMapper, Todo, StartDate, startDate);
243 SINK_REGISTER_SERIALIZER(propertyMapper, Todo, Status, status);
244 SINK_REGISTER_SERIALIZER(propertyMapper, Todo, Priority, priority);
245 SINK_REGISTER_SERIALIZER(propertyMapper, Todo, Categories, categories);
246 SINK_REGISTER_SERIALIZER(propertyMapper, Todo, Ical, ical);
247 SINK_REGISTER_SERIALIZER(propertyMapper, Todo, Calendar, calendar);
248}
249
250void TypeImplementation<Todo>::configure(IndexPropertyMapper &)
251{
252
253}
254
255
221void TypeImplementation<Calendar>::configure(TypeIndex &index) 256void TypeImplementation<Calendar>::configure(TypeIndex &index)
222{ 257{
223 CalendarIndexConfig::configure(index); 258 CalendarIndexConfig::configure(index);
diff --git a/common/domain/typeimplementations.h b/common/domain/typeimplementations.h
index 672e83a..5c6ba14 100644
--- a/common/domain/typeimplementations.h
+++ b/common/domain/typeimplementations.h
@@ -24,6 +24,7 @@
24#include "mail_generated.h" 24#include "mail_generated.h"
25#include "folder_generated.h" 25#include "folder_generated.h"
26#include "event_generated.h" 26#include "event_generated.h"
27#include "todo_generated.h"
27#include "calendar_generated.h" 28#include "calendar_generated.h"
28#include "contact_generated.h" 29#include "contact_generated.h"
29#include "addressbook_generated.h" 30#include "addressbook_generated.h"
@@ -97,6 +98,17 @@ public:
97}; 98};
98 99
99template<> 100template<>
101class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Todo> {
102public:
103 typedef Sink::ApplicationDomain::Buffer::Todo Buffer;
104 typedef Sink::ApplicationDomain::Buffer::TodoBuilder BufferBuilder;
105 static void configure(TypeIndex &);
106 static void configure(PropertyMapper &);
107 static void configure(IndexPropertyMapper &indexPropertyMapper);
108 static QMap<QByteArray, int> typeDatabases();
109};
110
111template<>
100class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Calendar> { 112class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Calendar> {
101public: 113public:
102 typedef Sink::ApplicationDomain::Buffer::Calendar Buffer; 114 typedef Sink::ApplicationDomain::Buffer::Calendar Buffer;