Changeset View
Changeset View
Standalone View
Standalone View
examples/caldavresource/caldavresource.cpp
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 60 | createOrModify(ENTITY_TYPE_CALENDAR, rid, localCalendar, | |||
---|---|---|---|---|---|
61 | /* mergeCriteria = */ QHash<QByteArray, Sink::Query::Comparator>{}); | 61 | /* mergeCriteria = */ QHash<QByteArray, Sink::Query::Comparator>{}); | ||
62 | } | 62 | } | ||
63 | } | 63 | } | ||
64 | 64 | | |||
65 | void updateLocalItem(KDAV2::DavItem remoteItem, const QByteArray &calendarLocalId) Q_DECL_OVERRIDE | 65 | void updateLocalItem(KDAV2::DavItem remoteItem, const QByteArray &calendarLocalId) Q_DECL_OVERRIDE | ||
66 | { | 66 | { | ||
67 | const auto &rid = resourceID(remoteItem); | 67 | const auto &rid = resourceID(remoteItem); | ||
68 | 68 | | |||
69 | auto incidence = KCalCore::ICalFormat().fromString(remoteItem.data()); | 69 | auto ical = remoteItem.data(); | ||
70 | auto incidence = KCalCore::ICalFormat().fromString(ical); | ||||
70 | 71 | | |||
71 | using Type = KCalCore::IncidenceBase::IncidenceType; | 72 | using Type = KCalCore::IncidenceBase::IncidenceType; | ||
72 | 73 | | |||
73 | switch (incidence->type()) { | 74 | switch (incidence->type()) { | ||
74 | case Type::TypeEvent: { | 75 | case Type::TypeEvent: { | ||
75 | auto remoteEvent = dynamic_cast<const KCalCore::Event &>(*incidence); | 76 | auto remoteEvent = dynamic_cast<const KCalCore::Event &>(*incidence); | ||
76 | 77 | | |||
77 | Event localEvent; | 78 | Event localEvent; | ||
78 | localEvent.setUid(remoteEvent.uid()); | 79 | localEvent.setUid(remoteEvent.uid()); | ||
79 | localEvent.setSummary(remoteEvent.summary()); | 80 | localEvent.setSummary(remoteEvent.summary()); | ||
80 | localEvent.setDescription(remoteEvent.description()); | 81 | localEvent.setDescription(remoteEvent.description()); | ||
81 | localEvent.setStartTime(remoteEvent.dtStart()); | 82 | localEvent.setStartTime(remoteEvent.dtStart()); | ||
83 | localEvent.setEndTime(remoteEvent.dtEnd()); | ||||
84 | localEvent.setIcal(ical); | ||||
82 | localEvent.setCalendar(calendarLocalId); | 85 | localEvent.setCalendar(calendarLocalId); | ||
83 | 86 | | |||
84 | SinkTrace() << "Found an event:" << localEvent.getSummary() << "with id:" << rid; | 87 | SinkTrace() << "Found an event:" << localEvent.getSummary() << "with id:" << rid; | ||
85 | 88 | | |||
86 | createOrModify(ENTITY_TYPE_EVENT, rid, localEvent, | 89 | createOrModify(ENTITY_TYPE_EVENT, rid, localEvent, | ||
87 | /* mergeCriteria = */ QHash<QByteArray, Sink::Query::Comparator>{}); | 90 | /* mergeCriteria = */ QHash<QByteArray, Sink::Query::Comparator>{}); | ||
88 | break; | 91 | break; | ||
89 | } | 92 | } | ||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |