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
@@ -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<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)
{
if (mReadOnly) return;
@@ -468,6 +488,7 @@ void Incidence::addRelationsToList(QPtrList<Incidence> *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)
{
-
+ setLastModifiedSubInvalid();
mRelations.removeRef(event);
-
// if (event->getRelatedTo() == this) event->setRelatedTo(0);
}