Commit 5df3981a authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Adapt to KCalCore recurrence API changes

parent d3237e1e
......@@ -137,17 +137,17 @@ static bool hasMyWritableEventsFolders(const QString &family)
static bool occurredAlready(const Incidence::Ptr &incidence)
{
Q_ASSERT(incidence);
const KDateTime now = KDateTime::currentLocalDateTime();
const QDateTime now = QDateTime::currentDateTime();
const QDate today = now.date();
if (incidence->recurs()) {
const KDateTime nextDate = incidence->recurrence()->getNextDateTime(now);
const QDateTime nextDate = incidence->recurrence()->getNextDateTime(now);
return !nextDate.isValid();
} else {
const KDateTime incidenceDate = incidence->dateTime(Incidence::RoleDisplayEnd);
if (incidenceDate.isValid()) {
return incidence->allDay() ? (incidenceDate.date() < today) : (incidenceDate < now);
return incidence->allDay() ? (incidenceDate.date() < today) : (incidenceDate < KDateTime::currentLocalDateTime());
}
}
......
......@@ -99,7 +99,7 @@ QVector<CalendarEvents::EventData> BaseEventDataVisitor::explodeIncidenceOccuren
const qint64 duration = ed.startDateTime().secsTo(ed.endDateTime());
KDateTime rec(mStart.addDays(-1), QTime(0, 0, 0));
QDateTime rec(mStart.addDays(-1), QTime(0, 0, 0));
rec = incidence->recurrence()->getNextDateTime(rec);
QVector<CalendarEvents::EventData> results;
while (rec.isValid() && rec.date() <= mEnd) {
......@@ -108,11 +108,11 @@ QVector<CalendarEvents::EventData> BaseEventDataVisitor::explodeIncidenceOccuren
if (incidence->allDay()) {
dt = QDateTime(rec.date(), QTime(0, 0, 0), Qt::LocalTime);
} else {
dt = rec.toLocalZone().dateTime();
dt = rec.toLocalTime();
}
copy.setStartDateTime(dt);
copy.setEndDateTime(dt.addSecs(duration));
copy.setUid(generateUid(incidence, KCalCore::k2q(rec)));
copy.setUid(generateUid(incidence, rec));
results.push_back(copy);
......
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