-rw-r--r-- | libkcal/incidence.cpp | 26 | ||||
-rw-r--r-- | libkcal/incidence.h | 3 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 4 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 1 |
4 files changed, 31 insertions, 3 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 11f7ecc..e4bcc5e 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -282,5 +282,25 @@ void Incidence::setReadOnly( bool 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<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) { @@ -469,4 +489,5 @@ void Incidence::addRelationsToList(QPtrList<Incidence> *rel) void Incidence::addRelation(Incidence *event) { + setLastModifiedSubInvalid(); if( mRelations.findRef( event ) == -1 ) { mRelations.append(event); @@ -477,7 +498,6 @@ void Incidence::addRelation(Incidence *event) void Incidence::removeRelation(Incidence *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 @@ -278,4 +278,6 @@ class Incidence : public IncidenceBase bool isBirthday() const; bool isAnniversary() const; + QDateTime lastModifiedSub(); + void setLastModifiedSubInvalid(); @@ -293,4 +295,5 @@ protected: // base components of jounal, event and todo QDateTime mCreated; + QDateTime mLastModifiedSub; QString mDescription; QString mSummary; diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 1a19f3e..022dead 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -192,5 +192,8 @@ QString IncidenceBase::uid() const return mUid; } +void IncidenceBase::setLastModifiedSubInvalid() +{ +} void IncidenceBase::setLastModified(const QDateTime &lm) { @@ -199,4 +202,5 @@ void IncidenceBase::setLastModified(const QDateTime &lm) // Calendar::updateEvent(). 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 @@ -150,4 +150,5 @@ class IncidenceBase : public CustomProperties bool isTagged() const; void setTagged( bool ); + virtual void setLastModifiedSubInvalid(); protected: bool blockLastModified; |