Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'jb52656' into 'master'
[nemo-qml-plugin-calendar] Purge deleted local events. Contributes to JB#52656

See merge request mer-core/nemo-qml-plugin-calendar!73
  • Loading branch information
chriadam committed Jan 12, 2021
2 parents 174558d + c1870c3 commit dc9e996
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/calendarworker.cpp
Expand Up @@ -193,12 +193,18 @@ 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;
}
}
mDeletedEvents.clear();
}
}
Expand Down

0 comments on commit dc9e996

Please sign in to comment.