-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 | |||
@@ -281,7 +281,27 @@ void Incidence::setReadOnly( bool readOnly ) | |||
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; |
@@ -468,6 +488,7 @@ void Incidence::addRelationsToList(QPtrList<Incidence> *rel) | |||
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(); |
@@ -476,9 +497,8 @@ void Incidence::addRelation(Incidence *event) | |||
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 | ||
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index c88ba2f..d4af9f0 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -277,6 +277,8 @@ class Incidence : public IncidenceBase | |||
277 | bool isHoliday() const; | 277 | bool isHoliday() const; |
278 | bool isBirthday() const; | 278 | bool isBirthday() const; |
279 | bool isAnniversary() const; | 279 | bool isAnniversary() const; |
280 | QDateTime lastModifiedSub(); | ||
281 | void setLastModifiedSubInvalid(); | ||
280 | 282 | ||
281 | 283 | ||
282 | protected: | 284 | protected: |
@@ -292,6 +294,7 @@ protected: | |||
292 | 294 | ||
293 | // base components of jounal, event and todo | 295 | // base components of jounal, event and todo |
294 | QDateTime mCreated; | 296 | QDateTime mCreated; |
297 | QDateTime mLastModifiedSub; | ||
295 | QString mDescription; | 298 | QString mDescription; |
296 | QString mSummary; | 299 | QString mSummary; |
297 | QStringList mCategories; | 300 | QStringList mCategories; |
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 1a19f3e..022dead 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -191,13 +191,17 @@ QString IncidenceBase::uid() const | |||
191 | { | 191 | { |
192 | return mUid; | 192 | return mUid; |
193 | } | 193 | } |
194 | void IncidenceBase::setLastModifiedSubInvalid() | ||
195 | { | ||
194 | 196 | ||
197 | } | ||
195 | void IncidenceBase::setLastModified(const QDateTime &lm) | 198 | void IncidenceBase::setLastModified(const QDateTime &lm) |
196 | { | 199 | { |
197 | if ( blockLastModified ) return; | 200 | if ( blockLastModified ) return; |
198 | // DON'T! updated() because we call this from | 201 | // DON'T! updated() because we call this from |
199 | // Calendar::updateEvent(). | 202 | // Calendar::updateEvent(). |
200 | mLastModified = getEvenTime(lm); | 203 | mLastModified = getEvenTime(lm); |
204 | setLastModifiedSubInvalid(); | ||
201 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); | 205 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); |
202 | } | 206 | } |
203 | 207 | ||
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index bed73db..665c1f6 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h | |||
@@ -149,6 +149,7 @@ class IncidenceBase : public CustomProperties | |||
149 | bool alarmEnabled() const; | 149 | bool alarmEnabled() const; |
150 | bool isTagged() const; | 150 | bool isTagged() const; |
151 | void setTagged( bool ); | 151 | void setTagged( bool ); |
152 | virtual void setLastModifiedSubInvalid(); | ||
152 | protected: | 153 | protected: |
153 | bool blockLastModified; | 154 | bool blockLastModified; |
154 | bool mIsTagged; | 155 | bool mIsTagged; |