Diffstat (limited to 'korganizer/koeditorrecurrence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index 4209e10..bedc75a 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp @@ -41,8 +41,9 @@ #include <kdebug.h> #include <knumvalidator.h> #include <libkcal/event.h> +#include <libkcal/todo.h> #include <libkdepim/kdateedit.h> #include "koprefs.h" @@ -904,18 +905,25 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) mYearly->setByDay( from.date().dayOfYear() ); mYearly->setByMonth( from.date().month(), from.date().day() ); } -void KOEditorRecurrence::readEvent(Event *event) +void KOEditorRecurrence::readEvent(Incidence *event) { - setDefaults( event->dtStart(), event->dtEnd(), true ); + + QDateTime dtEnd; + if ( event->type() == "Event" ) + dtEnd = ((Event*)event)->dtEnd(); + else + dtEnd = ((Todo*)event)->dtDue(); + + setDefaults( event->dtStart(), dtEnd, true ); QBitArray rDays( 7 ); QPtrList<Recurrence::rMonthPos> rmp; QPtrList<int> rmd; int day = 0; int count = 0; int month = 0; - setDateTimes( event->dtStart(), event->dtEnd() ); + setDateTimes( event->dtStart(), dtEnd ); Recurrence *r = event->recurrence(); int f = r->frequency(); @@ -927,9 +935,9 @@ void KOEditorRecurrence::readEvent(Event *event) int recurrenceType = RecurrenceChooser::Weekly; switch ( recurs ) { case Recurrence::rNone: - setDefaults( event->dtStart(), event->dtEnd(), true ); + setDefaults( event->dtStart(), dtEnd, true ); break; case Recurrence::rDaily: recurrenceType = RecurrenceChooser::Daily; mDaily->setFrequency( f ); @@ -999,9 +1007,9 @@ void KOEditorRecurrence::readEvent(Event *event) mYearly->setByDay( event->dtStart().date().dayOfYear() ); mYearly->setFrequency( f ); break; default: - setDefaults( event->dtStart(), event->dtEnd(), true ); + setDefaults( event->dtStart(), dtEnd, true ); break; } mRecurrenceChooser->setType( recurrenceType ); @@ -1023,9 +1031,9 @@ void KOEditorRecurrence::readEvent(Event *event) mExceptions->setDates( event->exDates() ); } -void KOEditorRecurrence::writeEvent( Event *event ) +void KOEditorRecurrence::writeEvent( Incidence *event ) { Recurrence *r = event->recurrence(); // clear out any old settings; |