summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-07-09 23:58:28 (UTC)
committer zautrix <zautrix>2005-07-09 23:58:28 (UTC)
commit2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b (patch) (side-by-side diff)
treee57782981707d6932940d0489fc942bfeab40dd6 /libkcal
parent47370b5d0dea0f29bb929ba13cf45186095c762d (diff)
downloadkdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.zip
kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.tar.gz
kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.tar.bz2
fixxx
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp28
-rw-r--r--libkcal/incidence.h3
-rw-r--r--libkcal/incidencebase.cpp4
-rw-r--r--libkcal/incidencebase.h1
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
@@ -278,13 +278,33 @@ void Incidence::cloneRelations( Incidence * newInc )
}
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;
mCreated = getEvenTime(created);
}
@@ -465,23 +485,23 @@ void Incidence::addRelationsToList(QPtrList<Incidence> *rel)
if ( rel->findRef( this ) == -1 )
rel->append( this );
}
void Incidence::addRelation(Incidence *event)
{
+ setLastModifiedSubInvalid();
if( mRelations.findRef( event ) == -1 ) {
mRelations.append(event);
//updated();
}
}
void Incidence::removeRelation(Incidence *event)
{
-
- mRelations.removeRef(event);
-
+ setLastModifiedSubInvalid();
+ mRelations.removeRef(event);
// if (event->getRelatedTo() == this) event->setRelatedTo(0);
}
bool Incidence::recursOn(const QDate &qd) const
{
if (recurrence()->recursOnPure(qd) && !isException(qd)) return true;
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index c88ba2f..d4af9f0 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -274,12 +274,14 @@ class Incidence : public IncidenceBase
void setRecurrenceID(QDateTime);
QDateTime recurrenceID () const;
QDateTime dtStart() const;
bool isHoliday() const;
bool isBirthday() const;
bool isAnniversary() const;
+ QDateTime lastModifiedSub();
+ void setLastModifiedSubInvalid();
protected:
QPtrList<Alarm> mAlarms;
QPtrList<Incidence> mRelations;
QDateTime mRecurrenceID;
@@ -289,12 +291,13 @@ protected:
bool mHoliday, mBirthday, mAnniversary;
int mRevision;
bool mCancelled;
// base components of jounal, event and todo
QDateTime mCreated;
+ QDateTime mLastModifiedSub;
QString mDescription;
QString mSummary;
QStringList mCategories;
Incidence *mRelatedTo;
QString mRelatedToUid;
DateList mExDates;
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 1a19f3e..022dead 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -188,19 +188,23 @@ void IncidenceBase::setUid(const QString &uid)
}
QString IncidenceBase::uid() const
{
return mUid;
}
+void IncidenceBase::setLastModifiedSubInvalid()
+{
+}
void IncidenceBase::setLastModified(const QDateTime &lm)
{
if ( blockLastModified ) return;
// DON'T! updated() because we call this from
// Calendar::updateEvent().
mLastModified = getEvenTime(lm);
+ setLastModifiedSubInvalid();
//qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1());
}
QDateTime IncidenceBase::lastModified() const
{
return mLastModified;
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index bed73db..665c1f6 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -146,12 +146,13 @@ class IncidenceBase : public CustomProperties
void setCalEnabled( bool );
bool calEnabled() const;
void setAlarmEnabled( bool );
bool alarmEnabled() const;
bool isTagged() const;
void setTagged( bool );
+ virtual void setLastModifiedSubInvalid();
protected:
bool blockLastModified;
bool mIsTagged;
QDateTime mDtStart;
bool mReadOnly;
QDateTime getEvenTime( QDateTime );