https://bugs.kde.org/show_bug.cgi?id=528231

            Bug ID: 528231
           Summary: Agenda view draws a moved occurrence of a series in
                    the first visible day of the week
    Classification: Applications
           Product: korganizer
      Version First unspecified
       Reported In:
          Platform: NixOS
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: agendaview (weekview)
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Version: GIT (master); also reproducible with KDE PIM 26.08.2
Platform: Linux, KF6/Qt6

STEPS TO REPRODUCE
1. Have a calendar with a recurring series and one occurrence of it moved to an
   earlier date. A CalDAV, EWS or Google account does this by itself when you
   move a single occurrence in another client, or import the two attached
   items into a local calendar: the master with RRULE:FREQ=WEEKLY;INTERVAL=2
   starting 2026-08-10 11:30 (Europe/Moscow), and a second item with
   RECURRENCE-ID 2026-11-02 11:30 whose DTSTART is 2026-10-26 11:30.
2. Open the week of 2026-11-02 in the week (agenda) view.

ACTUAL BEHAVIOUR
The series is drawn twice: at 2026-10-26 11:30, which is correct, and
additionally in the first visible day of the shown week, 2026-11-02 11:30,
where nothing should be drawn.

EXPECTED BEHAVIOUR
Only the occurrence at the date it was moved to. The month view already shows
exactly that, and so does merkuro, whose IncidenceOccurrenceModel positions by
occurrenceStartDate().

CAUSE
src/agenda/agendaview.cpp at master (16fd79a1), all line numbers from there:
- :2219 the occurrence is taken from OccurrenceIterator with
  nextOccurrenceDate = rIt.occurrenceStartDate(), which for a moved occurrence
  is the new date (2026-10-26), although the slot that put the occurrence into
  the requested range is the original one (2026-11-02);
- :987 insertIncidence() computes the column as
  qMax(mSelectedDates.constFirst().daysTo(insertAtDate), qint64(0)), so a date
  before the first visible day is clamped to column 0, the first visible day;
- :1082 and :1133 then take the time from that same date and draw the
  rectangle in the wrong column.
Only occurrences moved to an earlier date than the visible range are hit:
with a move into a later week the clamped column lands past the last visible
day and is dropped by the curCol >= count check at :989.

The deeper cause is in KCalendarCore and is marked there as a TODO in
OccurrenceIterator::setupIterator: "exclude exceptions where the start/end is
not within (so the occurrence of the recurrence is omitted, but no exception
is added)". OccurrenceIterator reports an exception even when the moved
occurrence no longer intersects the requested range, and EventViews then has
to cope with a date it cannot place.

FIX
A merge request is proposed in pim/eventviews: skip an occurrence whose
occurrenceEndDate() is before firstVisibleDateTime (checked on the end, so a
multi-day occurrence that starts before the visible range and ends inside it
is kept).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to