author | zautrix <zautrix> | 2005-08-19 12:08:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-19 12:08:05 (UTC) |
commit | 9014049779be6cfec02d73e19596439f0f4f9bed (patch) (side-by-side diff) | |
tree | 3983282e83183cc15dd615ba4ac5a800da21efe0 | |
parent | 81891a49afc2f7cd89db4e2770c3b7831644428d (diff) | |
download | kdepimpi-9014049779be6cfec02d73e19596439f0f4f9bed.zip kdepimpi-9014049779be6cfec02d73e19596439f0f4f9bed.tar.gz kdepimpi-9014049779be6cfec02d73e19596439f0f4f9bed.tar.bz2 |
list sort fix
-rw-r--r-- | korganizer/kolistview.cpp | 21 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 14 | ||||
-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 |
6 files changed, 40 insertions, 25 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index b236c2d..4fc1194 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -142,10 +142,8 @@ bool ListItemVisitor::visit(Event *e) mItem->setText(10, KOPrefs::instance()->calName( e->calID() )); mItem->setText(11, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); + mItem->setSortKey(11,e->lastModifiedSortKey()); QString key; - QDate d = e->lastModified().date(); - QTime t = e->lastModified().time(); - key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); - mItem->setSortKey(12,key); + QTime t; t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); @@ -201,9 +199,8 @@ bool ListItemVisitor::visit(Todo *t) mItem->setText(10, KOPrefs::instance()->calName( t->calID() )); mItem->setText(11, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); + mItem->setSortKey(11,t->lastModifiedSortKey()); QString key; - QDate d = t->lastModified().date(); - QTime tm = t->lastModified().time(); - key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); - mItem->setSortKey(11,key); + QDate d; + QTime tm; if (t->hasDueDate()) { d = t->dtDue().date(); @@ -247,15 +244,11 @@ bool ListItemVisitor::visit(Journal * j) mItem->setText(10, KOPrefs::instance()->calName( j->calID() )); mItem->setText(11, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); + mItem->setSortKey(11,j->lastModifiedSortKey()); QString key; - QDate d = j->lastModified().date(); - QTime tm = j->lastModified().time(); - key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); - mItem->setSortKey(12,key); + QDate d; d = j->dtStart().date(); key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); mItem->setSortKey(1,key); - mItem->setSortKey(7,key); - return true; } diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index bdef94c..848e9e7 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp @@ -120,6 +120,4 @@ void KOTodoViewItem::construct() else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); - - keyd = ""; keyt = ""; @@ -161,16 +159,12 @@ void KOTodoViewItem::construct() setText(11, KGlobal::locale()->formatDateTime( mTodo->lastModifiedSub(), true, true )); QString key; - QDate d = mTodo->lastModified().date(); - QTime t = mTodo->lastModified().time(); - key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); - setSortKey(9,key); + QDate d; + QTime t; + setSortKey(9,mTodo->lastModifiedSortKey()); d = mTodo->created().date(); t = mTodo->created().time(); key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); setSortKey(10,key); - d = mTodo->lastModifiedSub().date(); - t = mTodo->lastModifiedSub().time(); - key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); - setSortKey(11,key); + setSortKey(11,mTodo->lastModifiedSubSortKey()); #if 0 diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 39c14f5..fe9f854 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -343,4 +343,10 @@ void Incidence::setLastModifiedSubInvalid() mRelatedTo->setLastModifiedSubInvalid(); } +QString Incidence::lastModifiedSubSortKey() const +{ + if ( mLastModifiedSubSortKey.isEmpty() ) + return lastModifiedSortKey(); + return mLastModifiedSubSortKey; +} QDateTime Incidence::lastModifiedSub() { @@ -356,4 +362,11 @@ QDateTime Incidence::lastModifiedSub() 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; } diff --git a/libkcal/incidence.h b/libkcal/incidence.h index eef9e64..dc49640 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -280,4 +280,5 @@ class Incidence : public IncidenceBase bool isAnniversary() const; QDateTime lastModifiedSub(); + QString lastModifiedSubSortKey() const; QString recurrenceText() const; void setLastModifiedSubInvalid(); @@ -293,4 +294,5 @@ protected: private: void checkCategories(); + QString mLastModifiedSubSortKey; bool mHoliday, mBirthday, mAnniversary; int mRevision; diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 022dead..cfef973 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -194,5 +194,5 @@ QString IncidenceBase::uid() const void IncidenceBase::setLastModifiedSubInvalid() { - + // virtual method } void IncidenceBase::setLastModified(const QDateTime &lm) @@ -202,7 +202,18 @@ void IncidenceBase::setLastModified(const QDateTime &lm) // 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 diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 665c1f6..444d4c4 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h @@ -64,4 +64,5 @@ class IncidenceBase : public CustomProperties /** Return the time the incidence was last modified. */ QDateTime lastModified() const; + QString lastModifiedSortKey() const; /** sets the organizer for the event */ @@ -161,4 +162,5 @@ class IncidenceBase : public CustomProperties // base components QString mOrganizer; + QString mLastModifiedKey; QString mUid; int mCalID; |