Skip to content

Commit

Permalink
[sociald] Upsync event attendees from local storage to Google calenda…
Browse files Browse the repository at this point in the history
…r. 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).
  • Loading branch information
sergkashin committed Jun 20, 2018
1 parent b886d1b commit a0e514f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rpm/sociald.spec
@@ -1,6 +1,6 @@
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
Expand Down
22 changes: 22 additions & 0 deletions src/google/google-calendars/googlecalendarsyncadaptor.cpp
Expand Up @@ -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))) {
Expand Down Expand Up @@ -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.

Expand Down

0 comments on commit a0e514f

Please sign in to comment.