From 471ba4cfbb161bbae0641fe26360c8218fa31ef1 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 2 Aug 2018 20:18:24 +0200 Subject: Calendar color --- common/domain/applicationdomaintype.cpp | 1 + common/domain/applicationdomaintype.h | 1 + common/domain/calendar.fbs | 1 + common/domain/typeimplementations.cpp | 1 + examples/caldavresource/CMakeLists.txt | 2 +- examples/caldavresource/caldavresource.cpp | 2 ++ 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index 9bc3d08..97bf9f2 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp @@ -163,6 +163,7 @@ SINK_REGISTER_PROPERTY(Todo, Calendar); SINK_REGISTER_ENTITY(Calendar); SINK_REGISTER_PROPERTY(Calendar, Name); +SINK_REGISTER_PROPERTY(Calendar, Color); static const int foo = [] { QMetaType::registerEqualsComparator(); diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index 802efd8..7f214ba 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h @@ -394,6 +394,7 @@ SINK_EXPORT QDebug operator<< (QDebug d, const Contact::Email &); struct SINK_EXPORT Calendar : public Entity { SINK_ENTITY(Calendar, calendar); SINK_PROPERTY(QString, Name, name); + SINK_PROPERTY(QByteArray, Color, color); }; struct SINK_EXPORT Event : public Entity { diff --git a/common/domain/calendar.fbs b/common/domain/calendar.fbs index 9788539..375b9fb 100644 --- a/common/domain/calendar.fbs +++ b/common/domain/calendar.fbs @@ -2,6 +2,7 @@ namespace Sink.ApplicationDomain.Buffer; table Calendar { name:string; + color:string; } root_type Calendar; diff --git a/common/domain/typeimplementations.cpp b/common/domain/typeimplementations.cpp index 2b2d2ac..bb3f455 100644 --- a/common/domain/typeimplementations.cpp +++ b/common/domain/typeimplementations.cpp @@ -269,6 +269,7 @@ QMap TypeImplementation::typeDatabases() void TypeImplementation::configure(PropertyMapper &propertyMapper) { SINK_REGISTER_SERIALIZER(propertyMapper, Calendar, Name, name); + SINK_REGISTER_SERIALIZER(propertyMapper, Calendar, Color, color); } void TypeImplementation::configure(IndexPropertyMapper &) {} diff --git a/examples/caldavresource/CMakeLists.txt b/examples/caldavresource/CMakeLists.txt index d2859aa..d6e8408 100644 --- a/examples/caldavresource/CMakeLists.txt +++ b/examples/caldavresource/CMakeLists.txt @@ -6,7 +6,7 @@ find_package(KPimKDAV2 REQUIRED) find_package(KF5CalendarCore REQUIRED) add_library(${PROJECT_NAME} SHARED caldavresource.cpp) -target_link_libraries(${PROJECT_NAME} sink_webdav_common sink Qt5::Core Qt5::Network KPim::KDAV2 +target_link_libraries(${PROJECT_NAME} sink_webdav_common sink Qt5::Core Qt5::Gui Qt5::Network KPim::KDAV2 KF5::CalendarCore) install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${SINK_RESOURCE_PLUGINS_PATH} RUNTIME DESTINATION ${SINK_RESOURCE_PLUGINS_PATH}) diff --git a/examples/caldavresource/caldavresource.cpp b/examples/caldavresource/caldavresource.cpp index 8574575..df9ab52 100644 --- a/examples/caldavresource/caldavresource.cpp +++ b/examples/caldavresource/caldavresource.cpp @@ -30,6 +30,7 @@ #include "facadefactory.h" #include +#include #define ENTITY_TYPE_EVENT "event" #define ENTITY_TYPE_TODO "todo" @@ -61,6 +62,7 @@ protected: Calendar localCalendar; localCalendar.setName(remoteCalendar.displayName()); + localCalendar.setColor(remoteCalendar.color().name().toLatin1()); createOrModify(ENTITY_TYPE_CALENDAR, rid, localCalendar, /* mergeCriteria = */ QHash{}); -- cgit v1.2.3