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

Fix agenda view's display of end-of-day events

If a non-all-day multi-day event extends to the end of a day, its dtEnd will
be 00:00 of the next day.  The agenda view incorrectly shows the instance
occurring on that day.  (Single-day events are handled correctly.)
parent 2324098a
Pipeline #49873 passed with stage
in 7 minutes and 26 seconds
......@@ -571,8 +571,12 @@ void AgendaView::Private::insertIncidence(const KCalendarCore::Incidence::Ptr &i
int endX;
if (event) {
const QDate firstVisibleDate = mSelectedDates.first();
// its crossing bounderies, lets calculate beginX and endX
const int duration = event->dtStart().toLocalTime().daysTo(event->dtEnd().toLocalTime());
QDateTime dtEnd = event->dtEnd().toLocalTime();
if (!event->allDay()) {
// If dtEnd's time portion is 00:00, the event ends on the previous day.
dtEnd = dtEnd.addSecs(-1);
}
const int duration = event->dtStart().toLocalTime().daysTo(dtEnd);
if (insertAtDate < firstVisibleDate) {
beginX = curCol + firstVisibleDate.daysTo(insertAtDate);
endX = beginX + duration;
......
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