summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/incidence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp16
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
@@ -208,20 +208,28 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
Incidence* Incidence::recreateCloneException( QDate d )
{
Incidence* newInc = clone();
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;
}
void Incidence::recreate()
{
setCreated(QDateTime::currentDateTime());