From 2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 09 Jul 2005 23:58:28 +0000 Subject: fixxx --- (limited to 'libkcal/incidence.cpp') diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 11f7ecc..e4bcc5e 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -281,7 +281,27 @@ void Incidence::setReadOnly( bool readOnly ) IncidenceBase::setReadOnly( readOnly ); recurrence()->setRecurReadOnly( readOnly); } - +void Incidence::setLastModifiedSubInvalid() +{ + mLastModifiedSub = QDateTime(); + if ( mRelatedTo ) + mRelatedTo->setLastModifiedSubInvalid(); +} +QDateTime Incidence::lastModifiedSub() +{ + if ( !mRelations.count() ) + return lastModified(); + if ( mLastModifiedSub.isValid() ) + return mLastModifiedSub; + mLastModifiedSub = lastModified(); + Incidence * inc; + QPtrList Relations = relations(); + for (inc=Relations.first();inc;inc=Relations.next()) { + if ( inc->lastModifiedSub() > mLastModifiedSub ) + mLastModifiedSub = inc->lastModifiedSub(); + } + return mLastModifiedSub; +} void Incidence::setCreated(QDateTime created) { if (mReadOnly) return; @@ -468,6 +488,7 @@ void Incidence::addRelationsToList(QPtrList *rel) void Incidence::addRelation(Incidence *event) { + setLastModifiedSubInvalid(); if( mRelations.findRef( event ) == -1 ) { mRelations.append(event); //updated(); @@ -476,9 +497,8 @@ void Incidence::addRelation(Incidence *event) void Incidence::removeRelation(Incidence *event) { - - mRelations.removeRef(event); - + setLastModifiedSubInvalid(); + mRelations.removeRef(event); // if (event->getRelatedTo() == this) event->setRelatedTo(0); } -- cgit v0.9.0.2