Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[mkcal] Don't change event end date in storage for all day events.
  • Loading branch information
dcaliste committed Apr 1, 2020
1 parent 8418e13 commit acf7c0e
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/sqliteformat.cpp
Expand Up @@ -332,16 +332,8 @@ bool SqliteFormat::modifyComponents(const Incidence::Ptr &incidence, const QStri
KDateTime effectiveDtEnd;
if (incidence->type() == Incidence::TypeEvent) {
Event::Ptr event = incidence.staticCast<Event>();

if (event->hasEndDate()) {
effectiveDtEnd = event->dtEnd();
} else if (incidence->dtStart().isValid()) {
// No end date, use start date if possible
effectiveDtEnd = incidence->dtStart();
}
// all day inclusive of end time, add one day here and remove one day when reading
if (effectiveDtEnd.isValid() && incidence->allDay()) {
effectiveDtEnd = event->dtEnd().addDays(1);
}
}
sqlite3_bind_date_time(d->mStorage, stmt1, index, effectiveDtEnd, incidence->allDay());
Expand Down Expand Up @@ -1208,15 +1200,9 @@ Incidence::Ptr SqliteFormat::selectComponents(sqlite3_stmt *stmt1, sqlite3_stmt
bool endIsDate;
KDateTime end = getDateTime(d->mStorage, stmt1, 9, &endIsDate);
if (startIsDate && (!end.isValid() || endIsDate)) {
// all day events saved with one extra day due to KCalCore::Event::dtEnd() being inclusive of end time
if (end.isValid()) {
KDateTime dtEnd = end.addDays(-1);
if (dtEnd > start) {
event->setDtEnd(dtEnd);
}
}
event->setAllDay(true);
} else {
}
if (end.isValid()) {
event->setDtEnd(end);
}
incidence = event;
Expand Down

0 comments on commit acf7c0e

Please sign in to comment.