Commit a3d72d60 authored by Damien Caliste's avatar Damien Caliste

[nemo-qml-plugin-calendar] Use proper recurrenceId to send cancellation of exception occurrences.

parent ff3a84e1
......@@ -119,7 +119,7 @@ void CalendarWorker::deleteEvent(const QString &uid, const KDateTime &recurrence
event->setRevision(event->revision() + 1);
} else {
mCalendar->deleteEvent(event);
mExceptionEvents.append(QPair<QString, QDateTime>(uid, dateTime));
mDeletedEvents.append(QPair<QString, KDateTime>(uid, recurrenceId));
}
}
......@@ -133,7 +133,7 @@ void CalendarWorker::deleteAll(const QString &uid)
mCalendar->deleteEventInstances(event);
mCalendar->deleteEvent(event);
mDeletedEvents.append(uid);
mDeletedEvents.append(QPair<QString, KDateTime>(uid, KDateTime()));
}
bool CalendarWorker::sendResponse(const CalendarData::Event &eventData, const CalendarEvent::Response response)
......@@ -174,8 +174,8 @@ void CalendarWorker::save()
// FIXME: should send response update if deleting an even we have responded to.
// FIXME: should send cancel only if we own the event
if (!mDeletedEvents.isEmpty()) {
for (const QString &uid: mDeletedEvents) {
KCalCore::Event::Ptr event = mCalendar->deletedEvent(uid);
for (const QPair<QString, KDateTime> &pair: mDeletedEvents) {
KCalCore::Event::Ptr event = mCalendar->deletedEvent(pair.first, pair.second);
if (!needSendCancellation(event)) {
continue;
}
......@@ -184,18 +184,6 @@ void CalendarWorker::save()
}
mDeletedEvents.clear();
}
if (!mExceptionEvents.isEmpty()) {
for (const QPair<QString, QDateTime> &exceptionEvent: mExceptionEvents) {
KCalCore::Event::Ptr event = mCalendar->deletedEvent(exceptionEvent.first,
KDateTime(exceptionEvent.second, KDateTime::Spec(KDateTime::LocalZone)));
if (!needSendCancellation(event)) {
continue;
}
event->setStatus(KCalCore::Incidence::StatusCanceled);
mKCal::ServiceHandler::instance().sendUpdate(event, QString(), mCalendar, mStorage);
}
mExceptionEvents.clear();
}
}
void CalendarWorker::saveEvent(const CalendarData::Event &eventData, bool updateAttendees,
......
......@@ -140,11 +140,10 @@ private:
mKCal::ExtendedCalendar::Ptr mCalendar;
mKCal::ExtendedStorage::Ptr mStorage;
// mDeletedEvents and mExceptionEvents are used to make sure
// mDeletedEvents is used to make sure
// that we are sending a cancellation email for events only
// when user actually saved (so truly deleted) changes by calling of save()
QStringList mDeletedEvents;
QList<QPair<QString, QDateTime>> mExceptionEvents;
QList<QPair<QString, KDateTime>> mDeletedEvents;
QHash<QString, CalendarData::Notebook> mNotebooks;
......
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