Commit a0e514f3 authored by skashin's avatar skashin

[sociald] Upsync event attendees from local storage to Google calendar. Contibutes to JB#1106

This patch implements a proper event creation on the Google server side.
Rest will be done by a default invitation plugin (can be integrated completely separate from this change).
parent b886d1b9
Name: sociald
Summary: Syncs device data from social services
Version: 0.1.65
Version: 0.1.67
Release: 1
Group: System/Libraries
License: LGPLv2.1
......
......@@ -402,6 +402,25 @@ QJsonObject kCalToJson(KCalCore::Event::Ptr event, KCalCore::ICalFormat &icalFor
QString eventId = gCalEventId(event);
QJsonObject start, end, reminders;
QJsonArray attendees;
const KCalCore::Attendee::List attendeesList = event->attendees();
if (!attendeesList.isEmpty()) {
Q_FOREACH (auto att, attendeesList) {
if (att->email().isEmpty()) {
continue;
}
QJsonObject attendee;
attendee.insert("email", att->email());
if (att->role() == KCalCore::Attendee::OptParticipant) {
attendee.insert("optional", true);
}
const QString &name = att->name();
if (!name.isEmpty()) {
attendee.insert("displayName", name);
}
attendees.append(attendee);
}
}
// insert the date/time and timeZone information into the Json object.
// note that timeZone is required for recurring events, for some reason.
if (event->dtStart().isDateOnly() || (event->allDay() && event->dtStart().time() == QTime(0,0,0))) {
......@@ -432,6 +451,9 @@ QJsonObject kCalToJson(KCalCore::Event::Ptr event, KCalCore::ICalFormat &icalFor
retn.insert(QLatin1String("start"), start);
retn.insert(QLatin1String("end"), end);
retn.insert(QLatin1String("sequence"), QString::number(event->revision()+1));
if (!attendees.isEmpty()) {
retn.insert(QLatin1String("attendees"), attendees);
}
//retn.insert(QLatin1String("locked"), event->readOnly()); // only allow locking server-side.
// we may wish to support locking/readonly from local side also, in the future.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment