-rw-r--r-- | libkcal/incidence.cpp | 13 | ||||
-rw-r--r-- | libkcal/incidence.h | 2 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 13 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 2 |
4 files changed, 29 insertions, 1 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 39c14f5..fe9f854 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -341,8 +341,14 @@ void Incidence::setLastModifiedSubInvalid() mLastModifiedSub = QDateTime(); if ( mRelatedTo ) mRelatedTo->setLastModifiedSubInvalid(); } +QString Incidence::lastModifiedSubSortKey() const +{ + if ( mLastModifiedSubSortKey.isEmpty() ) + return lastModifiedSortKey(); + return mLastModifiedSubSortKey; +} QDateTime Incidence::lastModifiedSub() { if ( !mRelations.count() ) return lastModified(); @@ -354,8 +360,15 @@ QDateTime Incidence::lastModifiedSub() for (inc=Relations.first();inc;inc=Relations.next()) { if ( inc->lastModifiedSub() > mLastModifiedSub ) mLastModifiedSub = inc->lastModifiedSub(); } + mLastModifiedSubSortKey.sprintf("%04d%02d%02d%02d%02d%02d", + mLastModifiedSub.date().year(), + mLastModifiedSub.date().month(), + mLastModifiedSub.date().day(), + mLastModifiedSub.time().hour(), + mLastModifiedSub.time().minute(), + mLastModifiedSub.time().second() ); return mLastModifiedSub; } void Incidence::setCreated(QDateTime created) { diff --git a/libkcal/incidence.h b/libkcal/incidence.h index eef9e64..dc49640 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -278,8 +278,9 @@ class Incidence : public IncidenceBase bool isHoliday() const; bool isBirthday() const; bool isAnniversary() const; QDateTime lastModifiedSub(); + QString lastModifiedSubSortKey() const; QString recurrenceText() const; void setLastModifiedSubInvalid(); virtual QString durationText(); @@ -291,8 +292,9 @@ protected: QDateTime mRecurrenceID; bool mHasRecurrenceID; private: void checkCategories(); + QString mLastModifiedSubSortKey; bool mHoliday, mBirthday, mAnniversary; int mRevision; bool mCancelled; diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 022dead..cfef973 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -192,19 +192,30 @@ QString IncidenceBase::uid() const return mUid; } void IncidenceBase::setLastModifiedSubInvalid() { - + // virtual method } void IncidenceBase::setLastModified(const QDateTime &lm) { if ( blockLastModified ) return; // DON'T! updated() because we call this from // Calendar::updateEvent(). mLastModified = getEvenTime(lm); + mLastModifiedKey.sprintf("%04d%02d%02d%02d%02d%02d", + mLastModified.date().year(), + mLastModified.date().month(), + mLastModified.date().day(), + mLastModified.time().hour(), + mLastModified.time().minute(), + mLastModified.time().second() ); setLastModifiedSubInvalid(); //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); } +QString IncidenceBase::lastModifiedSortKey() const +{ + return mLastModifiedKey; +} QDateTime IncidenceBase::lastModified() const { return mLastModified; diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 665c1f6..444d4c4 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h @@ -62,8 +62,9 @@ class IncidenceBase : public CustomProperties /** Sets the time the incidence was last modified. */ void setLastModified(const QDateTime &lm); /** Return the time the incidence was last modified. */ QDateTime lastModified() const; + QString lastModifiedSortKey() const; /** sets the organizer for the event */ void setOrganizer(const QString &o); QString organizer() const; @@ -159,8 +160,9 @@ class IncidenceBase : public CustomProperties private: // base components QString mOrganizer; + QString mLastModifiedKey; QString mUid; int mCalID; bool mCalEnabled; bool mAlarmEnabled; |