diff options
Diffstat (limited to 'common/domain')
-rw-r--r-- | common/domain/applicationdomaintype.cpp | 13 | ||||
-rw-r--r-- | common/domain/applicationdomaintype.h | 17 | ||||
-rw-r--r-- | common/domain/applicationdomaintype_p.h | 2 | ||||
-rw-r--r-- | common/domain/propertyregistry.cpp | 6 | ||||
-rw-r--r-- | common/domain/todo.fbs | 18 | ||||
-rw-r--r-- | common/domain/typeimplementations.cpp | 35 | ||||
-rw-r--r-- | common/domain/typeimplementations.h | 12 |
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); | |||
132 | SINK_REGISTER_PROPERTY(Event, Ical); | 132 | SINK_REGISTER_PROPERTY(Event, Ical); |
133 | SINK_REGISTER_PROPERTY(Event, Calendar); | 133 | SINK_REGISTER_PROPERTY(Event, Calendar); |
134 | 134 | ||
135 | SINK_REGISTER_ENTITY(Todo); | ||
136 | SINK_REGISTER_PROPERTY(Todo, Uid); | ||
137 | SINK_REGISTER_PROPERTY(Todo, Summary); | ||
138 | SINK_REGISTER_PROPERTY(Todo, Description); | ||
139 | SINK_REGISTER_PROPERTY(Todo, CompletedDate); | ||
140 | SINK_REGISTER_PROPERTY(Todo, DueDate); | ||
141 | SINK_REGISTER_PROPERTY(Todo, StartDate); | ||
142 | SINK_REGISTER_PROPERTY(Todo, Status); | ||
143 | SINK_REGISTER_PROPERTY(Todo, Priority); | ||
144 | SINK_REGISTER_PROPERTY(Todo, Categories); | ||
145 | SINK_REGISTER_PROPERTY(Todo, Ical); | ||
146 | SINK_REGISTER_PROPERTY(Todo, Calendar); | ||
147 | |||
135 | SINK_REGISTER_ENTITY(Calendar); | 148 | SINK_REGISTER_ENTITY(Calendar); |
136 | SINK_REGISTER_PROPERTY(Calendar, Name); | 149 | SINK_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 | ||
408 | struct SINK_EXPORT Todo : public Entity { | 408 | struct 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 | ||
412 | struct SINK_EXPORT Folder : public Entity { | 423 | struct 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 | }; |
520 | namespace 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 | ||
511 | namespace SpecialPurpose { | 527 | namespace 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 | ||
77 | template <> | 77 | template <> |
78 | QVariant parseString<QStringList>(const QString &s) | ||
79 | { | ||
80 | return s.split(','); | ||
81 | } | ||
82 | |||
83 | template <> | ||
78 | QVariant parseString<QDateTime>(const QString &s) | 84 | QVariant 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 @@ | |||
1 | namespace Sink.ApplicationDomain.Buffer; | ||
2 | |||
3 | table 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 | |||
17 | root_type Todo; | ||
18 | file_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 | ||
70 | typedef IndexConfig<Todo, | ||
71 | ValueIndex<Todo::Uid> | ||
72 | > TodoIndexConfig; | ||
73 | |||
70 | typedef IndexConfig<Calendar, | 74 | typedef 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 | ||
225 | void TypeImplementation<Todo>::configure(TypeIndex &index) | ||
226 | { | ||
227 | TodoIndexConfig::configure(index); | ||
228 | } | ||
229 | |||
230 | QMap<QByteArray, int> TypeImplementation<Todo>::typeDatabases() | ||
231 | { | ||
232 | return merge(QMap<QByteArray, int>{{QByteArray{Todo::name} + ".main", 0}}, TodoIndexConfig::databases()); | ||
233 | } | ||
234 | |||
235 | void 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 | |||
250 | void TypeImplementation<Todo>::configure(IndexPropertyMapper &) | ||
251 | { | ||
252 | |||
253 | } | ||
254 | |||
255 | |||
221 | void TypeImplementation<Calendar>::configure(TypeIndex &index) | 256 | void 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 | ||
99 | template<> | 100 | template<> |
101 | class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Todo> { | ||
102 | public: | ||
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 | |||
111 | template<> | ||
100 | class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Calendar> { | 112 | class SINK_EXPORT TypeImplementation<Sink::ApplicationDomain::Calendar> { |
101 | public: | 113 | public: |
102 | typedef Sink::ApplicationDomain::Buffer::Calendar Buffer; | 114 | typedef Sink::ApplicationDomain::Buffer::Calendar Buffer; |