summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/incidence.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/incidence.cpp26
1 files changed, 23 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
@@ -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)
{
-
+ setLastModifiedSubInvalid();
mRelations.removeRef(event);
-
// if (event->getRelatedTo() == this) event->setRelatedTo(0);