author | zautrix <zautrix> | 2005-07-09 23:58:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-09 23:58:28 (UTC) |
commit | 2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b (patch) (side-by-side diff) | |
tree | e57782981707d6932940d0489fc942bfeab40dd6 /libkcal | |
parent | 47370b5d0dea0f29bb929ba13cf45186095c762d (diff) | |
download | kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.zip kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.tar.gz kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.tar.bz2 |
fixxx
-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 @@ -276,17 +276,37 @@ void Incidence::cloneRelations( Incidence * newInc ) inc->cloneRelations( cloneInc ); } } 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); } QDateTime Incidence::created() const { @@ -463,27 +483,27 @@ void Incidence::addRelationsToList(QPtrList<Incidence> *rel) inc->addRelationsToList( 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) { - + 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; else return false; } diff --git a/libkcal/incidence.h b/libkcal/incidence.h index c88ba2f..d4af9f0 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -272,31 +272,34 @@ class Incidence : public IncidenceBase void setHasRecurrenceID( bool b ); 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; bool mHasRecurrenceID; private: void checkCategories(); 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; QPtrList<Attachment> mAttachments; QStringList mResources; diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 1a19f3e..022dead 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -186,23 +186,27 @@ void IncidenceBase::setUid(const QString &uid) mUid = uid; updated(); } 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 @@ -144,16 +144,17 @@ class IncidenceBase : public CustomProperties void setCalID( int id ); int calID() const; 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 ); private: |