-rw-r--r-- | libkcal/incidence.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 11f7ecc..e4bcc5e 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -272,25 +272,45 @@ void Incidence::cloneRelations( Incidence * newInc ) | |||
272 | for (inc=Relations.first();inc;inc=Relations.next()) { | 272 | for (inc=Relations.first();inc;inc=Relations.next()) { |
273 | cloneInc = inc->clone(); | 273 | cloneInc = inc->clone(); |
274 | cloneInc->recreate(); | 274 | cloneInc->recreate(); |
275 | cloneInc->setRelatedTo( newInc ); | 275 | cloneInc->setRelatedTo( newInc ); |
276 | inc->cloneRelations( cloneInc ); | 276 | inc->cloneRelations( cloneInc ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | void Incidence::setReadOnly( bool readOnly ) | 279 | void Incidence::setReadOnly( bool readOnly ) |
280 | { | 280 | { |
281 | IncidenceBase::setReadOnly( readOnly ); | 281 | IncidenceBase::setReadOnly( readOnly ); |
282 | recurrence()->setRecurReadOnly( readOnly); | 282 | recurrence()->setRecurReadOnly( readOnly); |
283 | } | 283 | } |
284 | 284 | void Incidence::setLastModifiedSubInvalid() | |
285 | { | ||
286 | mLastModifiedSub = QDateTime(); | ||
287 | if ( mRelatedTo ) | ||
288 | mRelatedTo->setLastModifiedSubInvalid(); | ||
289 | } | ||
290 | QDateTime Incidence::lastModifiedSub() | ||
291 | { | ||
292 | if ( !mRelations.count() ) | ||
293 | return lastModified(); | ||
294 | if ( mLastModifiedSub.isValid() ) | ||
295 | return mLastModifiedSub; | ||
296 | mLastModifiedSub = lastModified(); | ||
297 | Incidence * inc; | ||
298 | QPtrList<Incidence> Relations = relations(); | ||
299 | for (inc=Relations.first();inc;inc=Relations.next()) { | ||
300 | if ( inc->lastModifiedSub() > mLastModifiedSub ) | ||
301 | mLastModifiedSub = inc->lastModifiedSub(); | ||
302 | } | ||
303 | return mLastModifiedSub; | ||
304 | } | ||
285 | void Incidence::setCreated(QDateTime created) | 305 | void Incidence::setCreated(QDateTime created) |
286 | { | 306 | { |
287 | if (mReadOnly) return; | 307 | if (mReadOnly) return; |
288 | mCreated = getEvenTime(created); | 308 | mCreated = getEvenTime(created); |
289 | } | 309 | } |
290 | 310 | ||
291 | QDateTime Incidence::created() const | 311 | QDateTime Incidence::created() const |
292 | { | 312 | { |
293 | return mCreated; | 313 | return mCreated; |
294 | } | 314 | } |
295 | 315 | ||
296 | void Incidence::setRevision(int rev) | 316 | void Incidence::setRevision(int rev) |
@@ -459,35 +479,35 @@ void Incidence::addRelationsToList(QPtrList<Incidence> *rel) | |||
459 | { | 479 | { |
460 | Incidence* inc; | 480 | Incidence* inc; |
461 | QPtrList<Incidence> Relations = relations(); | 481 | QPtrList<Incidence> Relations = relations(); |
462 | for (inc=Relations.first();inc;inc=Relations.next()) { | 482 | for (inc=Relations.first();inc;inc=Relations.next()) { |
463 | inc->addRelationsToList( rel ); | 483 | inc->addRelationsToList( rel ); |
464 | } | 484 | } |
465 | if ( rel->findRef( this ) == -1 ) | 485 | if ( rel->findRef( this ) == -1 ) |
466 | rel->append( this ); | 486 | rel->append( this ); |
467 | } | 487 | } |
468 | 488 | ||
469 | void Incidence::addRelation(Incidence *event) | 489 | void Incidence::addRelation(Incidence *event) |
470 | { | 490 | { |
491 | setLastModifiedSubInvalid(); | ||
471 | if( mRelations.findRef( event ) == -1 ) { | 492 | if( mRelations.findRef( event ) == -1 ) { |
472 | mRelations.append(event); | 493 | mRelations.append(event); |
473 | //updated(); | 494 | //updated(); |
474 | } | 495 | } |
475 | } | 496 | } |
476 | 497 | ||
477 | void Incidence::removeRelation(Incidence *event) | 498 | void Incidence::removeRelation(Incidence *event) |
478 | { | 499 | { |
479 | 500 | setLastModifiedSubInvalid(); | |
480 | mRelations.removeRef(event); | 501 | mRelations.removeRef(event); |
481 | |||
482 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); | 502 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); |
483 | } | 503 | } |
484 | 504 | ||
485 | bool Incidence::recursOn(const QDate &qd) const | 505 | bool Incidence::recursOn(const QDate &qd) const |
486 | { | 506 | { |
487 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; | 507 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; |
488 | else return false; | 508 | else return false; |
489 | } | 509 | } |
490 | 510 | ||
491 | void Incidence::setExDates(const DateList &exDates) | 511 | void Incidence::setExDates(const DateList &exDates) |
492 | { | 512 | { |
493 | if (mReadOnly) return; | 513 | if (mReadOnly) return; |