author | zautrix <zautrix> | 2005-08-19 12:08:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-19 12:08:05 (UTC) |
commit | 9014049779be6cfec02d73e19596439f0f4f9bed (patch) (unidiff) | |
tree | 3983282e83183cc15dd615ba4ac5a800da21efe0 /libkcal | |
parent | 81891a49afc2f7cd89db4e2770c3b7831644428d (diff) | |
download | kdepimpi-9014049779be6cfec02d73e19596439f0f4f9bed.zip kdepimpi-9014049779be6cfec02d73e19596439f0f4f9bed.tar.gz kdepimpi-9014049779be6cfec02d73e19596439f0f4f9bed.tar.bz2 |
list sort fix
-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 | |||
@@ -339,12 +339,18 @@ void Incidence::setReadOnly( bool readOnly ) | |||
339 | void Incidence::setLastModifiedSubInvalid() | 339 | void Incidence::setLastModifiedSubInvalid() |
340 | { | 340 | { |
341 | mLastModifiedSub = QDateTime(); | 341 | mLastModifiedSub = QDateTime(); |
342 | if ( mRelatedTo ) | 342 | if ( mRelatedTo ) |
343 | mRelatedTo->setLastModifiedSubInvalid(); | 343 | mRelatedTo->setLastModifiedSubInvalid(); |
344 | } | 344 | } |
345 | QString Incidence::lastModifiedSubSortKey() const | ||
346 | { | ||
347 | if ( mLastModifiedSubSortKey.isEmpty() ) | ||
348 | return lastModifiedSortKey(); | ||
349 | return mLastModifiedSubSortKey; | ||
350 | } | ||
345 | QDateTime Incidence::lastModifiedSub() | 351 | QDateTime Incidence::lastModifiedSub() |
346 | { | 352 | { |
347 | if ( !mRelations.count() ) | 353 | if ( !mRelations.count() ) |
348 | return lastModified(); | 354 | return lastModified(); |
349 | if ( mLastModifiedSub.isValid() ) | 355 | if ( mLastModifiedSub.isValid() ) |
350 | return mLastModifiedSub; | 356 | return mLastModifiedSub; |
@@ -352,12 +358,19 @@ QDateTime Incidence::lastModifiedSub() | |||
352 | Incidence * inc; | 358 | Incidence * inc; |
353 | QPtrList<Incidence> Relations = relations(); | 359 | QPtrList<Incidence> Relations = relations(); |
354 | for (inc=Relations.first();inc;inc=Relations.next()) { | 360 | for (inc=Relations.first();inc;inc=Relations.next()) { |
355 | if ( inc->lastModifiedSub() > mLastModifiedSub ) | 361 | if ( inc->lastModifiedSub() > mLastModifiedSub ) |
356 | mLastModifiedSub = inc->lastModifiedSub(); | 362 | mLastModifiedSub = inc->lastModifiedSub(); |
357 | } | 363 | } |
364 | mLastModifiedSubSortKey.sprintf("%04d%02d%02d%02d%02d%02d", | ||
365 | mLastModifiedSub.date().year(), | ||
366 | mLastModifiedSub.date().month(), | ||
367 | mLastModifiedSub.date().day(), | ||
368 | mLastModifiedSub.time().hour(), | ||
369 | mLastModifiedSub.time().minute(), | ||
370 | mLastModifiedSub.time().second() ); | ||
358 | return mLastModifiedSub; | 371 | return mLastModifiedSub; |
359 | } | 372 | } |
360 | void Incidence::setCreated(QDateTime created) | 373 | void Incidence::setCreated(QDateTime created) |
361 | { | 374 | { |
362 | if (mReadOnly) return; | 375 | if (mReadOnly) return; |
363 | mCreated = getEvenTime(created); | 376 | mCreated = getEvenTime(created); |
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index eef9e64..dc49640 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -276,12 +276,13 @@ class Incidence : public IncidenceBase | |||
276 | QDateTime recurrenceID () const; | 276 | QDateTime recurrenceID () const; |
277 | QDateTime dtStart() const; | 277 | QDateTime dtStart() const; |
278 | bool isHoliday() const; | 278 | bool isHoliday() const; |
279 | bool isBirthday() const; | 279 | bool isBirthday() const; |
280 | bool isAnniversary() const; | 280 | bool isAnniversary() const; |
281 | QDateTime lastModifiedSub(); | 281 | QDateTime lastModifiedSub(); |
282 | QString lastModifiedSubSortKey() const; | ||
282 | QString recurrenceText() const; | 283 | QString recurrenceText() const; |
283 | void setLastModifiedSubInvalid(); | 284 | void setLastModifiedSubInvalid(); |
284 | 285 | ||
285 | virtual QString durationText(); | 286 | virtual QString durationText(); |
286 | QString durationText4Time( int secs ); | 287 | QString durationText4Time( int secs ); |
287 | Recurrence *mRecurrence; | 288 | Recurrence *mRecurrence; |
@@ -289,12 +290,13 @@ protected: | |||
289 | QPtrList<Alarm> mAlarms; | 290 | QPtrList<Alarm> mAlarms; |
290 | QPtrList<Incidence> mRelations; | 291 | QPtrList<Incidence> mRelations; |
291 | QDateTime mRecurrenceID; | 292 | QDateTime mRecurrenceID; |
292 | bool mHasRecurrenceID; | 293 | bool mHasRecurrenceID; |
293 | private: | 294 | private: |
294 | void checkCategories(); | 295 | void checkCategories(); |
296 | QString mLastModifiedSubSortKey; | ||
295 | bool mHoliday, mBirthday, mAnniversary; | 297 | bool mHoliday, mBirthday, mAnniversary; |
296 | int mRevision; | 298 | int mRevision; |
297 | bool mCancelled; | 299 | bool mCancelled; |
298 | 300 | ||
299 | // base components of jounal, event and todo | 301 | // base components of jounal, event and todo |
300 | QDateTime mCreated; | 302 | QDateTime mCreated; |
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 022dead..cfef973 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -190,23 +190,34 @@ void IncidenceBase::setUid(const QString &uid) | |||
190 | QString IncidenceBase::uid() const | 190 | QString IncidenceBase::uid() const |
191 | { | 191 | { |
192 | return mUid; | 192 | return mUid; |
193 | } | 193 | } |
194 | void IncidenceBase::setLastModifiedSubInvalid() | 194 | void IncidenceBase::setLastModifiedSubInvalid() |
195 | { | 195 | { |
196 | 196 | // virtual method | |
197 | } | 197 | } |
198 | void IncidenceBase::setLastModified(const QDateTime &lm) | 198 | void IncidenceBase::setLastModified(const QDateTime &lm) |
199 | { | 199 | { |
200 | if ( blockLastModified ) return; | 200 | if ( blockLastModified ) return; |
201 | // DON'T! updated() because we call this from | 201 | // DON'T! updated() because we call this from |
202 | // Calendar::updateEvent(). | 202 | // Calendar::updateEvent(). |
203 | mLastModified = getEvenTime(lm); | 203 | mLastModified = getEvenTime(lm); |
204 | mLastModifiedKey.sprintf("%04d%02d%02d%02d%02d%02d", | ||
205 | mLastModified.date().year(), | ||
206 | mLastModified.date().month(), | ||
207 | mLastModified.date().day(), | ||
208 | mLastModified.time().hour(), | ||
209 | mLastModified.time().minute(), | ||
210 | mLastModified.time().second() ); | ||
204 | setLastModifiedSubInvalid(); | 211 | setLastModifiedSubInvalid(); |
205 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); | 212 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); |
206 | } | 213 | } |
214 | QString IncidenceBase::lastModifiedSortKey() const | ||
215 | { | ||
216 | return mLastModifiedKey; | ||
217 | } | ||
207 | 218 | ||
208 | QDateTime IncidenceBase::lastModified() const | 219 | QDateTime IncidenceBase::lastModified() const |
209 | { | 220 | { |
210 | return mLastModified; | 221 | return mLastModified; |
211 | } | 222 | } |
212 | 223 | ||
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 665c1f6..444d4c4 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h | |||
@@ -60,12 +60,13 @@ class IncidenceBase : public CustomProperties | |||
60 | QString uid() const; | 60 | QString uid() const; |
61 | 61 | ||
62 | /** Sets the time the incidence was last modified. */ | 62 | /** Sets the time the incidence was last modified. */ |
63 | void setLastModified(const QDateTime &lm); | 63 | void setLastModified(const QDateTime &lm); |
64 | /** Return the time the incidence was last modified. */ | 64 | /** Return the time the incidence was last modified. */ |
65 | QDateTime lastModified() const; | 65 | QDateTime lastModified() const; |
66 | QString lastModifiedSortKey() const; | ||
66 | 67 | ||
67 | /** sets the organizer for the event */ | 68 | /** sets the organizer for the event */ |
68 | void setOrganizer(const QString &o); | 69 | void setOrganizer(const QString &o); |
69 | QString organizer() const; | 70 | QString organizer() const; |
70 | 71 | ||
71 | /** Set readonly status. */ | 72 | /** Set readonly status. */ |
@@ -157,12 +158,13 @@ class IncidenceBase : public CustomProperties | |||
157 | bool mReadOnly; | 158 | bool mReadOnly; |
158 | QDateTime getEvenTime( QDateTime ); | 159 | QDateTime getEvenTime( QDateTime ); |
159 | 160 | ||
160 | private: | 161 | private: |
161 | // base components | 162 | // base components |
162 | QString mOrganizer; | 163 | QString mOrganizer; |
164 | QString mLastModifiedKey; | ||
163 | QString mUid; | 165 | QString mUid; |
164 | int mCalID; | 166 | int mCalID; |
165 | bool mCalEnabled; | 167 | bool mCalEnabled; |
166 | bool mAlarmEnabled; | 168 | bool mAlarmEnabled; |
167 | QDateTime mLastModified; | 169 | QDateTime mLastModified; |
168 | QPtrList<Attendee> mAttendees; | 170 | QPtrList<Attendee> mAttendees; |