diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp --- a/korganizer/koeventpopupmenu.cpp +++ b/korganizer/koeventpopupmenu.cpp @@ -145,7 +145,8 @@ KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( mCurrentIncidence ); Q_ASSERT( incidence ); if ( incidence->recurs() ) { - const KDateTime thisDateTime( qd, CalendarSupport::KCalPrefs::instance()->timeSpec() ); + // getNextDateTime returns strictly later than the given datetime, so if an event starts a 0:00 we need to set one second before, that. + const KDateTime thisDateTime( qd.addDays(-1), QTime(23,59,59), CalendarSupport::KCalPrefs::instance()->timeSpec() ); const bool isLastOccurrence = !incidence->recurrence()->getNextDateTime( thisDateTime ).isValid(); const bool isFirstOccurrence = @@ -184,7 +185,15 @@ void KOEventPopupMenu::popupEdit() { if ( CalendarSupport::hasIncidence( mCurrentIncidence ) ) { - emit editIncidenceSignal( mCurrentIncidence, KDateTime() ); + const KCalCore::Incidence::Ptr inc = CalendarSupport::incidence(mCurrentIncidence); + KDateTime occurenceDate; + if ( inc->recurs() ) { + // We only have the currentDate and need to look for the occurence at this day + // getNextDateTime returns strictly later than the given datetime, so if an event starts a 0:00 we need to set one second before, that. + const KDateTime thisDateTime( mCurrentDate.addDays(-1), QTime(23,59,59), CalendarSupport::KCalPrefs::instance()->timeSpec() ); + occurenceDate = inc->recurrence()->getNextDateTime(thisDateTime); + } + emit editIncidenceSignal( mCurrentIncidence, occurenceDate ); } }