diff options
Diffstat (limited to 'common/domain')
-rw-r--r-- | common/domain/applicationdomaintype.cpp | 5 | ||||
-rw-r--r-- | common/domain/applicationdomaintype.h | 18 | ||||
-rw-r--r-- | common/domain/contact.fbs | 9 | ||||
-rw-r--r-- | common/domain/propertyregistry.cpp | 18 | ||||
-rw-r--r-- | common/domain/propertyregistry.h | 3 |
5 files changed, 51 insertions, 2 deletions
diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index 413fb7c..c9cef3f 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp | |||
@@ -95,15 +95,20 @@ SINK_REGISTER_PROPERTY(Folder, Icon); | |||
95 | SINK_REGISTER_PROPERTY(Folder, SpecialPurpose); | 95 | SINK_REGISTER_PROPERTY(Folder, SpecialPurpose); |
96 | SINK_REGISTER_PROPERTY(Folder, Enabled); | 96 | SINK_REGISTER_PROPERTY(Folder, Enabled); |
97 | SINK_REGISTER_PROPERTY(Folder, Parent); | 97 | SINK_REGISTER_PROPERTY(Folder, Parent); |
98 | SINK_REGISTER_PROPERTY(Folder, Count); | ||
99 | SINK_REGISTER_PROPERTY(Folder, FullContentAvailable); | ||
98 | 100 | ||
99 | SINK_REGISTER_PROPERTY(Contact, Uid); | 101 | SINK_REGISTER_PROPERTY(Contact, Uid); |
100 | SINK_REGISTER_PROPERTY(Contact, Fn); | 102 | SINK_REGISTER_PROPERTY(Contact, Fn); |
103 | SINK_REGISTER_PROPERTY(Contact, Firstname); | ||
104 | SINK_REGISTER_PROPERTY(Contact, Lastname); | ||
101 | SINK_REGISTER_PROPERTY(Contact, Emails); | 105 | SINK_REGISTER_PROPERTY(Contact, Emails); |
102 | SINK_REGISTER_PROPERTY(Contact, Vcard); | 106 | SINK_REGISTER_PROPERTY(Contact, Vcard); |
103 | SINK_REGISTER_PROPERTY(Contact, Addressbook); | 107 | SINK_REGISTER_PROPERTY(Contact, Addressbook); |
104 | 108 | ||
105 | SINK_REGISTER_PROPERTY(Addressbook, Name); | 109 | SINK_REGISTER_PROPERTY(Addressbook, Name); |
106 | SINK_REGISTER_PROPERTY(Addressbook, Parent); | 110 | SINK_REGISTER_PROPERTY(Addressbook, Parent); |
111 | SINK_REGISTER_PROPERTY(Addressbook, LastUpdated); | ||
107 | 112 | ||
108 | static const int foo = [] { | 113 | static const int foo = [] { |
109 | QMetaType::registerEqualsComparator<Reference>(); | 114 | QMetaType::registerEqualsComparator<Reference>(); |
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index ae8e6bc..74b747d 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h | |||
@@ -328,13 +328,25 @@ struct SINK_EXPORT Addressbook : public Entity { | |||
328 | SINK_ENTITY(Addressbook); | 328 | SINK_ENTITY(Addressbook); |
329 | SINK_REFERENCE_PROPERTY(Addressbook, Parent, parent); | 329 | SINK_REFERENCE_PROPERTY(Addressbook, Parent, parent); |
330 | SINK_PROPERTY(QString, Name, name); | 330 | SINK_PROPERTY(QString, Name, name); |
331 | SINK_EXTRACTED_PROPERTY(QDateTime, LastUpdated, lastUpdated); | ||
331 | }; | 332 | }; |
332 | 333 | ||
333 | struct SINK_EXPORT Contact : public Entity { | 334 | struct SINK_EXPORT Contact : public Entity { |
335 | struct SINK_EXPORT Email { | ||
336 | enum Type { | ||
337 | Undefined, | ||
338 | Work, | ||
339 | Home | ||
340 | }; | ||
341 | Type type; | ||
342 | QString email; | ||
343 | }; | ||
334 | SINK_ENTITY(Contact); | 344 | SINK_ENTITY(Contact); |
335 | SINK_PROPERTY(QString, Uid, uid); | 345 | SINK_PROPERTY(QString, Uid, uid); |
336 | SINK_PROPERTY(QString, Fn, fn); | 346 | SINK_PROPERTY(QString, Fn, fn); |
337 | SINK_PROPERTY(QByteArrayList, Emails, emails); | 347 | SINK_PROPERTY(QString, Firstname, firstname); |
348 | SINK_PROPERTY(QString, Lastname, lastname); | ||
349 | SINK_PROPERTY(QList<Email>, Emails, emails); | ||
338 | SINK_PROPERTY(QByteArray, Vcard, vcard); | 350 | SINK_PROPERTY(QByteArray, Vcard, vcard); |
339 | SINK_REFERENCE_PROPERTY(Addressbook, Addressbook, addressbook); | 351 | SINK_REFERENCE_PROPERTY(Addressbook, Addressbook, addressbook); |
340 | }; | 352 | }; |
@@ -362,6 +374,9 @@ struct SINK_EXPORT Folder : public Entity { | |||
362 | SINK_PROPERTY(QByteArray, Icon, icon); | 374 | SINK_PROPERTY(QByteArray, Icon, icon); |
363 | SINK_PROPERTY(QByteArrayList, SpecialPurpose, specialpurpose); | 375 | SINK_PROPERTY(QByteArrayList, SpecialPurpose, specialpurpose); |
364 | SINK_PROPERTY(bool, Enabled, enabled); | 376 | SINK_PROPERTY(bool, Enabled, enabled); |
377 | SINK_EXTRACTED_PROPERTY(QDateTime, LastUpdated, lastUpdated); | ||
378 | SINK_EXTRACTED_PROPERTY(int, Count, count); | ||
379 | SINK_EXTRACTED_PROPERTY(bool, FullContentAvailable, fullContentAvailable); | ||
365 | }; | 380 | }; |
366 | 381 | ||
367 | struct SINK_EXPORT Mail : public Entity { | 382 | struct SINK_EXPORT Mail : public Entity { |
@@ -552,6 +567,7 @@ Q_DECLARE_METATYPE(Sink::ApplicationDomain::ApplicationDomainType::Ptr) | |||
552 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity) | 567 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity) |
553 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity::Ptr) | 568 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity::Ptr) |
554 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Mail::Contact) | 569 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Mail::Contact) |
570 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Contact::Email) | ||
555 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Error) | 571 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Error) |
556 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Progress) | 572 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::Progress) |
557 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::BLOB) | 573 | Q_DECLARE_METATYPE(Sink::ApplicationDomain::BLOB) |
diff --git a/common/domain/contact.fbs b/common/domain/contact.fbs index 7d7f797..d941d5a 100644 --- a/common/domain/contact.fbs +++ b/common/domain/contact.fbs | |||
@@ -1,10 +1,17 @@ | |||
1 | namespace Sink.ApplicationDomain.Buffer; | 1 | namespace Sink.ApplicationDomain.Buffer; |
2 | 2 | ||
3 | table ContactEmail { | ||
4 | type: int; | ||
5 | email: string; | ||
6 | } | ||
7 | |||
3 | table Contact { | 8 | table Contact { |
4 | uid:string; | 9 | uid:string; |
5 | fn:string; | 10 | fn:string; |
11 | firstname:string; | ||
12 | lastname:string; | ||
6 | addressbook:string; | 13 | addressbook:string; |
7 | emails: [string]; | 14 | emails: [ContactEmail]; |
8 | vcard: string; | 15 | vcard: string; |
9 | } | 16 | } |
10 | 17 | ||
diff --git a/common/domain/propertyregistry.cpp b/common/domain/propertyregistry.cpp index 2208193..7b9b61a 100644 --- a/common/domain/propertyregistry.cpp +++ b/common/domain/propertyregistry.cpp | |||
@@ -64,6 +64,17 @@ QVariant parseString<bool>(const QString &s) | |||
64 | } | 64 | } |
65 | 65 | ||
66 | template <> | 66 | template <> |
67 | QVariant parseString<int>(const QString &s) | ||
68 | { | ||
69 | bool ok = false; | ||
70 | auto n = s.toInt(&ok); | ||
71 | if (ok) { | ||
72 | return QVariant::fromValue(n); | ||
73 | } | ||
74 | return {}; | ||
75 | } | ||
76 | |||
77 | template <> | ||
67 | QVariant parseString<QList<QByteArray>>(const QString &s) | 78 | QVariant parseString<QList<QByteArray>>(const QString &s) |
68 | { | 79 | { |
69 | auto list = s.split(','); | 80 | auto list = s.split(','); |
@@ -92,6 +103,13 @@ QVariant parseString<QList<Sink::ApplicationDomain::Mail::Contact>>(const QStrin | |||
92 | return QVariant{}; | 103 | return QVariant{}; |
93 | } | 104 | } |
94 | 105 | ||
106 | template <> | ||
107 | QVariant parseString<QList<Sink::ApplicationDomain::Contact::Email>>(const QString &s) | ||
108 | { | ||
109 | Q_ASSERT(false); | ||
110 | return QVariant{}; | ||
111 | } | ||
112 | |||
95 | PropertyRegistry &PropertyRegistry::instance() | 113 | PropertyRegistry &PropertyRegistry::instance() |
96 | { | 114 | { |
97 | static PropertyRegistry instance; | 115 | static PropertyRegistry instance; |
diff --git a/common/domain/propertyregistry.h b/common/domain/propertyregistry.h index 16df23b..758c10d 100644 --- a/common/domain/propertyregistry.h +++ b/common/domain/propertyregistry.h | |||
@@ -49,6 +49,9 @@ template <> | |||
49 | QVariant parseString<bool>(const QString &s); | 49 | QVariant parseString<bool>(const QString &s); |
50 | 50 | ||
51 | template <> | 51 | template <> |
52 | QVariant parseString<int>(const QString &s); | ||
53 | |||
54 | template <> | ||
52 | QVariant parseString<QList<QByteArray>>(const QString &s); | 55 | QVariant parseString<QList<QByteArray>>(const QString &s); |
53 | 56 | ||
54 | template <> | 57 | template <> |