Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 651dfb5c authored by Dimitris Kardarakos's avatar Dimitris Kardarakos

Handle multi day events with the same logic as single day events

Multi day events are handled with the same -simplified- logic that the
single day events are handled.
parent 0b1f3386
Pipeline #22226 passed with stage
in 17 minutes and 19 seconds
......@@ -277,24 +277,15 @@ Incidence::List IncidenceModel::hourEvents() const
{
auto e = d.dynamicCast<Event>();
auto sameDayEvent = (e->dtStart().date() == e->dtEnd().date());
auto startWithinFilter = e->dtStart() >= filterStartDtTime && e->dtStart() <= filterEndtDtTime;
auto endWithinFilter = e->dtEnd() > filterStartDtTime && e->dtEnd() <= filterEndtDtTime;
auto eventStartWithinFilter = e->dtStart() >= filterStartDtTime && e->dtStart() <= filterEndtDtTime;
auto eventEndWithinFilter = e->dtEnd() > filterStartDtTime && e->dtEnd() <= filterEndtDtTime;
auto filterWithinEvent = e->dtStart() < filterStartDtTime && filterEndtDtTime < e->dtEnd();
//If the event starts and ends in the same day, we just check the hours; that way recurring events are fetched as well
if(sameDayEvent && (startWithinFilter || endWithinFilter))
if((eventStartWithinFilter || eventEndWithinFilter || filterWithinEvent))
{
incidences.append(e);
}
//For multi-day events we check that filter datetime is between start and end date
auto startDtStripTime = QDateTime(e->dtStart().date());
auto startDtTime = e->allDay() ? startDtStripTime : startDtStripTime.addSecs(3600 * e->dtStart().time().hour());
if(!sameDayEvent && (startDtTime <= filterStartDtTime) && (e->dtEnd() >= filterStartDtTime))
{
incidences.append(e);
}
}
return incidences;
......
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