-rw-r--r-- | libkcal/incidence.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 5a9ef0e..28402ae 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -164,24 +164,38 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) i1.categories() == i2.categories() && // no need to compare mRelatedTo stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && // i1.relations() == i2.relations() && i1.exDates() == i2.exDates() && i1.attachments() == i2.attachments() && i1.resources() == i2.resources() && i1.secrecy() == i2.secrecy() && i1.priority() == i2.priority() && stringCompare( i1.location(), i2.location() ); } +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 ) ); + } + return newInc; +} void Incidence::recreate() { setCreated(QDateTime::currentDateTime()); setUid(CalFormat::createUniqueId()); setRevision(0); setIDStr( ":" ); setLastModified(QDateTime::currentDateTime()); } |