summaryrefslogtreecommitdiffstats
path: root/common/domain
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-23 14:02:15 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-23 14:02:15 +0100
commite1430017eb60976610f4963cd770116a4a486c2e (patch)
tree56d7551e39c6d83ac25aa6ea49f9e11ffcdcc07f /common/domain
parent86045e308c10c60cd7c4339d305cee1acb084760 (diff)
downloadsink-e1430017eb60976610f4963cd770116a4a486c2e.tar.gz
sink-e1430017eb60976610f4963cd770116a4a486c2e.zip
New properties
Diffstat (limited to 'common/domain')
-rw-r--r--common/domain/applicationdomaintype.cpp5
-rw-r--r--common/domain/applicationdomaintype.h18
-rw-r--r--common/domain/contact.fbs9
-rw-r--r--common/domain/propertyregistry.cpp18
-rw-r--r--common/domain/propertyregistry.h3
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);
95SINK_REGISTER_PROPERTY(Folder, SpecialPurpose); 95SINK_REGISTER_PROPERTY(Folder, SpecialPurpose);
96SINK_REGISTER_PROPERTY(Folder, Enabled); 96SINK_REGISTER_PROPERTY(Folder, Enabled);
97SINK_REGISTER_PROPERTY(Folder, Parent); 97SINK_REGISTER_PROPERTY(Folder, Parent);
98SINK_REGISTER_PROPERTY(Folder, Count);
99SINK_REGISTER_PROPERTY(Folder, FullContentAvailable);
98 100
99SINK_REGISTER_PROPERTY(Contact, Uid); 101SINK_REGISTER_PROPERTY(Contact, Uid);
100SINK_REGISTER_PROPERTY(Contact, Fn); 102SINK_REGISTER_PROPERTY(Contact, Fn);
103SINK_REGISTER_PROPERTY(Contact, Firstname);
104SINK_REGISTER_PROPERTY(Contact, Lastname);
101SINK_REGISTER_PROPERTY(Contact, Emails); 105SINK_REGISTER_PROPERTY(Contact, Emails);
102SINK_REGISTER_PROPERTY(Contact, Vcard); 106SINK_REGISTER_PROPERTY(Contact, Vcard);
103SINK_REGISTER_PROPERTY(Contact, Addressbook); 107SINK_REGISTER_PROPERTY(Contact, Addressbook);
104 108
105SINK_REGISTER_PROPERTY(Addressbook, Name); 109SINK_REGISTER_PROPERTY(Addressbook, Name);
106SINK_REGISTER_PROPERTY(Addressbook, Parent); 110SINK_REGISTER_PROPERTY(Addressbook, Parent);
111SINK_REGISTER_PROPERTY(Addressbook, LastUpdated);
107 112
108static const int foo = [] { 113static 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
333struct SINK_EXPORT Contact : public Entity { 334struct 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
367struct SINK_EXPORT Mail : public Entity { 382struct SINK_EXPORT Mail : public Entity {
@@ -552,6 +567,7 @@ Q_DECLARE_METATYPE(Sink::ApplicationDomain::ApplicationDomainType::Ptr)
552Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity) 567Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity)
553Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity::Ptr) 568Q_DECLARE_METATYPE(Sink::ApplicationDomain::Entity::Ptr)
554Q_DECLARE_METATYPE(Sink::ApplicationDomain::Mail::Contact) 569Q_DECLARE_METATYPE(Sink::ApplicationDomain::Mail::Contact)
570Q_DECLARE_METATYPE(Sink::ApplicationDomain::Contact::Email)
555Q_DECLARE_METATYPE(Sink::ApplicationDomain::Error) 571Q_DECLARE_METATYPE(Sink::ApplicationDomain::Error)
556Q_DECLARE_METATYPE(Sink::ApplicationDomain::Progress) 572Q_DECLARE_METATYPE(Sink::ApplicationDomain::Progress)
557Q_DECLARE_METATYPE(Sink::ApplicationDomain::BLOB) 573Q_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 @@
1namespace Sink.ApplicationDomain.Buffer; 1namespace Sink.ApplicationDomain.Buffer;
2 2
3table ContactEmail {
4 type: int;
5 email: string;
6}
7
3table Contact { 8table 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
66template <> 66template <>
67QVariant 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
77template <>
67QVariant parseString<QList<QByteArray>>(const QString &s) 78QVariant 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
106template <>
107QVariant parseString<QList<Sink::ApplicationDomain::Contact::Email>>(const QString &s)
108{
109 Q_ASSERT(false);
110 return QVariant{};
111}
112
95PropertyRegistry &PropertyRegistry::instance() 113PropertyRegistry &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 <>
49QVariant parseString<bool>(const QString &s); 49QVariant parseString<bool>(const QString &s);
50 50
51template <> 51template <>
52QVariant parseString<int>(const QString &s);
53
54template <>
52QVariant parseString<QList<QByteArray>>(const QString &s); 55QVariant parseString<QList<QByteArray>>(const QString &s);
53 56
54template <> 57template <>