-rw-r--r-- | libkcal/incidence.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 0684af2..708ee6b 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -212,12 +212,20 @@ Incidence* Incidence::recreateCloneException( QDate d ) newInc->recreate(); if ( doesRecur() ) { addExDate( d ); newInc->recurrence()->unsetRecurs(); - int len = dtStart().secsTo( ((Event*)this)->dtEnd()); - QTime tim = dtStart().time(); - newInc->setDtStart( QDateTime(d, tim) ); - ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); + if ( type() == "Event") { + int len = dtStart().secsTo( ((Event*)this)->dtEnd()); + QTime tim = dtStart().time(); + newInc->setDtStart( QDateTime(d, tim) ); + ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); + } else { + int len = dtStart().secsTo( ((Todo*)this)->dtDue()); + QTime tim = ((Todo*)this)->dtDue().time(); + ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); + ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); + ((Todo*)this)->setRecurDates(); + } } return newInc; } |