-rw-r--r-- | libkcal/incidence.cpp | 28 | ||||
-rw-r--r-- | libkcal/incidence.h | 3 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 4 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 1 |
4 files changed, 32 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 @@ -283,3 +283,23 @@ void Incidence::setReadOnly( bool 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<Incidence> Relations = relations(); + for (inc=Relations.first();inc;inc=Relations.next()) { + if ( inc->lastModifiedSub() > mLastModifiedSub ) + mLastModifiedSub = inc->lastModifiedSub(); + } + return mLastModifiedSub; +} void Incidence::setCreated(QDateTime created) @@ -470,2 +490,3 @@ void Incidence::addRelation(Incidence *event) { + setLastModifiedSubInvalid(); if( mRelations.findRef( event ) == -1 ) { @@ -478,5 +499,4 @@ void Incidence::removeRelation(Incidence *event) { - - mRelations.removeRef(event); - + setLastModifiedSubInvalid(); + mRelations.removeRef(event); // if (event->getRelatedTo() == this) event->setRelatedTo(0); diff --git a/libkcal/incidence.h b/libkcal/incidence.h index c88ba2f..d4af9f0 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -279,2 +279,4 @@ class Incidence : public IncidenceBase bool isAnniversary() const; + QDateTime lastModifiedSub(); + void setLastModifiedSubInvalid(); @@ -294,2 +296,3 @@ protected: QDateTime mCreated; + QDateTime mLastModifiedSub; QString mDescription; diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 1a19f3e..022dead 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -193,3 +193,6 @@ QString IncidenceBase::uid() const } +void IncidenceBase::setLastModifiedSubInvalid() +{ +} void IncidenceBase::setLastModified(const QDateTime &lm) @@ -200,2 +203,3 @@ void IncidenceBase::setLastModified(const QDateTime &lm) mLastModified = getEvenTime(lm); + setLastModifiedSubInvalid(); //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index bed73db..665c1f6 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h @@ -151,2 +151,3 @@ class IncidenceBase : public CustomProperties void setTagged( bool ); + virtual void setLastModifiedSubInvalid(); protected: |