Commit 8e354e85 authored by Kevin Funk's avatar Kevin Funk

agendaviews: Display recurrence w/o main incidence

Problem: Currently the agenda view hides recurrences which no longer
have a main incidence attached to it. Roundcube just displays these
recurrences, which seems to preferable compared to simply hiding an
event.

This patch forces the agenda view to still display a "lost" recurrence.

Note about the patch: Removed the `mViewCalendar->isValid(incidence)`
check in the if-condition since this is already checked in the first
line of the function and simplifies code.
parent 74bff6a9
Pipeline #45119 passed with stage
in 7 minutes and 28 seconds
......@@ -409,14 +409,18 @@ void AgendaView::Private::calendarIncidenceAdded(const KCalendarCore::Incidence:
return;
}
if (incidence->hasRecurrenceId() && mViewCalendar->isValid(incidence)) {
if (incidence->hasRecurrenceId()) {
// Reevaluate the main event instead, if it was inserted before this one
KCalendarCore::Incidence::Ptr mainIncidence
= q->calendar2(incidence)->incidence(incidence->uid());
auto mainIncidence = q->calendar2(incidence)->incidence(incidence->uid());
if (mainIncidence) {
reevaluateIncidence(mainIncidence);
return;
}
} else if (q->displayIncidence(incidence, false)) {
qCCritical(CALENDARVIEW_LOG) << "Failed to find main incidence of recurring incidence with uid=" << incidence->uid() << "trying to display this recurrence instead";
}
if (q->displayIncidence(incidence, false)) {
mAgenda->checkScrollBoundaries();
q->scheduleUpdateEventIndicators();
}
......@@ -1758,6 +1762,9 @@ void AgendaView::fillAgenda()
for (const KCalendarCore::Incidence::Ptr &incidence : incidences) {
Q_ASSERT(incidence);
if (incidence->hasRecurrenceId())
continue;
const bool wasSelected = (incidence->uid() == selectedAgendaId)
|| (incidence->uid() == selectedAllDayAgendaId);
......@@ -1790,7 +1797,7 @@ void AgendaView::fillAgenda()
bool AgendaView::displayIncidence(const KCalendarCore::Incidence::Ptr &incidence, bool createSelected)
{
if (!incidence || incidence->hasRecurrenceId()) {
if (!incidence) {
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