Commit dc9e9962 authored by chriadam's avatar chriadam

Merge branch 'jb52656' into 'master'

[nemo-qml-plugin-calendar] Purge deleted local events. Contributes to JB#52656

See merge request !73
parents 174558df c1870c36
......@@ -193,11 +193,17 @@ void CalendarWorker::save()
if (!mDeletedEvents.isEmpty()) {
for (const QPair<QString, QDateTime> &pair: mDeletedEvents) {
KCalendarCore::Event::Ptr event = mCalendar->deletedEvent(pair.first, pair.second);
if (!needSendCancellation(event)) {
continue;
if (needSendCancellation(event)) {
event->setStatus(KCalendarCore::Incidence::StatusCanceled);
mKCal::ServiceHandler::instance().sendUpdate(event, QString(), mCalendar, mStorage);
}
// if the event was stored in a local (non-synced) notebook, purge it.
const QString notebookUid = mCalendar->notebook(event);
const mKCal::Notebook::Ptr notebook = mStorage->notebook(notebookUid);
if (!notebook.isNull() && notebook->pluginName().isEmpty() && notebook->account().isEmpty()
&& !mStorage->purgeDeletedIncidences(KCalendarCore::Incidence::List() << event)) {
qWarning() << "Failed to purge deleted event " << event->uid() << " from local calendar " << notebookUid;
}
event->setStatus(KCalendarCore::Incidence::StatusCanceled);
mKCal::ServiceHandler::instance().sendUpdate(event, QString(), mCalendar, mStorage);
}
mDeletedEvents.clear();
}
......
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