-rw-r--r-- | libkcal/incidence.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 6bca12c..78fa24f 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -234,65 +234,77 @@ Incidence* Incidence::recreateCloneException( QDate d ) | |||
234 | Incidence* newInc = clone(); | 234 | Incidence* newInc = clone(); |
235 | newInc->recreate(); | 235 | newInc->recreate(); |
236 | if ( doesRecur() ) { | 236 | if ( doesRecur() ) { |
237 | addExDate( d ); | 237 | addExDate( d ); |
238 | newInc->recurrence()->unsetRecurs(); | 238 | newInc->recurrence()->unsetRecurs(); |
239 | if ( type() == "Event") { | 239 | if ( type() == "Event") { |
240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
241 | QTime tim = dtStart().time(); | 241 | QTime tim = dtStart().time(); |
242 | newInc->setDtStart( QDateTime(d, tim) ); | 242 | newInc->setDtStart( QDateTime(d, tim) ); |
243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
244 | } else { | 244 | } else { |
245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); | 245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); |
246 | QTime tim = ((Todo*)this)->dtDue().time(); | 246 | QTime tim = ((Todo*)this)->dtDue().time(); |
247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); | 247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); |
248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); | 248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); |
249 | ((Todo*)this)->setRecurDates(); | 249 | ((Todo*)this)->setRecurDates(); |
250 | } | 250 | } |
251 | newInc->setExDates( DateList () ); | 251 | newInc->setExDates( DateList () ); |
252 | } | 252 | } |
253 | return newInc; | 253 | return newInc; |
254 | } | 254 | } |
255 | 255 | ||
256 | void Incidence::recreate() | 256 | void Incidence::recreate() |
257 | { | 257 | { |
258 | setCreated(QDateTime::currentDateTime()); | 258 | setCreated(QDateTime::currentDateTime()); |
259 | 259 | ||
260 | setUid(CalFormat::createUniqueId()); | 260 | setUid(CalFormat::createUniqueId()); |
261 | 261 | ||
262 | setRevision(0); | 262 | setRevision(0); |
263 | setIDStr( ":" ); | 263 | setIDStr( ":" ); |
264 | setLastModified(QDateTime::currentDateTime()); | 264 | setLastModified(QDateTime::currentDateTime()); |
265 | } | 265 | } |
266 | 266 | void Incidence::cloneRelations( Incidence * newInc ) | |
267 | { | ||
268 | // newInc is already a clone of this incidence | ||
269 | Incidence * inc; | ||
270 | Incidence * cloneInc; | ||
271 | QPtrList<Incidence> Relations = relations(); | ||
272 | for (inc=Relations.first();inc;inc=Relations.next()) { | ||
273 | cloneInc = inc->clone(); | ||
274 | cloneInc->recreate(); | ||
275 | cloneInc->setRelatedTo( newInc ); | ||
276 | inc->cloneRelations( cloneInc ); | ||
277 | } | ||
278 | } | ||
267 | void Incidence::setReadOnly( bool readOnly ) | 279 | void Incidence::setReadOnly( bool readOnly ) |
268 | { | 280 | { |
269 | IncidenceBase::setReadOnly( readOnly ); | 281 | IncidenceBase::setReadOnly( readOnly ); |
270 | recurrence()->setRecurReadOnly( readOnly); | 282 | recurrence()->setRecurReadOnly( readOnly); |
271 | } | 283 | } |
272 | 284 | ||
273 | void Incidence::setCreated(QDateTime created) | 285 | void Incidence::setCreated(QDateTime created) |
274 | { | 286 | { |
275 | if (mReadOnly) return; | 287 | if (mReadOnly) return; |
276 | mCreated = getEvenTime(created); | 288 | mCreated = getEvenTime(created); |
277 | } | 289 | } |
278 | 290 | ||
279 | QDateTime Incidence::created() const | 291 | QDateTime Incidence::created() const |
280 | { | 292 | { |
281 | return mCreated; | 293 | return mCreated; |
282 | } | 294 | } |
283 | 295 | ||
284 | void Incidence::setRevision(int rev) | 296 | void Incidence::setRevision(int rev) |
285 | { | 297 | { |
286 | if (mReadOnly) return; | 298 | if (mReadOnly) return; |
287 | mRevision = rev; | 299 | mRevision = rev; |
288 | 300 | ||
289 | updated(); | 301 | updated(); |
290 | } | 302 | } |
291 | 303 | ||
292 | int Incidence::revision() const | 304 | int Incidence::revision() const |
293 | { | 305 | { |
294 | return mRevision; | 306 | return mRevision; |
295 | } | 307 | } |
296 | 308 | ||
297 | void Incidence::setDtStart(const QDateTime &dtStart) | 309 | void Incidence::setDtStart(const QDateTime &dtStart) |
298 | { | 310 | { |