Commit 04450a20 authored by Glen Ditchfield's avatar Glen Ditchfield 🐛 Committed by Glen Ditchfield
Browse files

Display recurrence without main incidence

A disassociated occurrence of a recurring incidence can be left behind
when the recurring incidence is deleted, due to bugs.  This patch makes
them visible, for robustness, so they can be cleaned up.
parent 2f6fb958
Pipeline #57363 skipped
......@@ -399,13 +399,22 @@ void AgendaView::Private::calendarIncidenceAdded(const KCalendarCore::Incidence:
return;
}
if (incidence->hasRecurrenceId() && mViewCalendar->isValid(incidence)) {
// Reevaluate the main event instead, if it was inserted before this one
KCalendarCore::Incidence::Ptr mainIncidence = q->calendar2(incidence)->incidence(incidence->uid());
if (mainIncidence) {
if (incidence->hasRecurrenceId()) {
if (auto mainIncidence = q->calendar2(incidence)->incidence(incidence->uid())) {
// Reevaluate the main event instead, if it was inserted before this one.
reevaluateIncidence(mainIncidence);
} else if (q->displayIncidence(incidence, false)) {
// Display disassociated occurrences because errors sometimes destroy
// the main recurring incidence.
mAgenda->checkScrollBoundaries();
q->scheduleUpdateEventIndicators();
}
} else if (incidence->recurs()) {
// Reevaluate recurring incidences to clean up any disassociated
// occurrences that were inserted before it.
reevaluateIncidence(incidence);
} else if (q->displayIncidence(incidence, false)) {
// Ordinary non-recurring non-disassociated instances.
mAgenda->checkScrollBoundaries();
q->scheduleUpdateEventIndicators();
}
......@@ -1735,10 +1744,18 @@ void AgendaView::fillAgenda()
bool AgendaView::displayIncidence(const KCalendarCore::Incidence::Ptr &incidence, bool createSelected)
{
if (!incidence || incidence->hasRecurrenceId()) {
if (!incidence) {
return false;
}
if (incidence->hasRecurrenceId()) {
// Normally a disassociated instance belongs to a recurring instance that
// displays it.
if (calendar2(incidence)->incidence(incidence->uid())) {
return false;
}
}
KCalendarCore::Todo::Ptr todo = CalendarSupport::todo(incidence);
if (todo && (!preferences()->showTodosAgendaView() || !todo->hasDueDate())) {
return false;
......
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