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 @@ -143,8 +143,6 @@ bool ListItemVisitor::visit(Event *e) 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(); @@ -202,7 +200,6 @@ bool ListItemVisitor::visit(Todo *t) 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()) { @@ -248,8 +245,6 @@ bool ListItemVisitor::visit(Journal * j) 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(); @@ -257,4 +252,2 @@ bool ListItemVisitor::visit(Journal * j) 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 @@ -121,4 +121,2 @@ void KOTodoViewItem::construct() - - keyd = ""; @@ -162,6 +160,5 @@ void KOTodoViewItem::construct() 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(); @@ -170,6 +167,3 @@ void KOTodoViewItem::construct() 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()); diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 39c14f5..fe9f854 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -344,2 +344,8 @@ void Incidence::setLastModifiedSubInvalid() } +QString Incidence::lastModifiedSubSortKey() const +{ + if ( mLastModifiedSubSortKey.isEmpty() ) + return lastModifiedSortKey(); + return mLastModifiedSubSortKey; +} QDateTime Incidence::lastModifiedSub() @@ -357,2 +363,9 @@ QDateTime Incidence::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 @@ -281,2 +281,3 @@ class Incidence : public IncidenceBase QDateTime lastModifiedSub(); + QString lastModifiedSubSortKey() const; QString recurrenceText() const; @@ -294,2 +295,3 @@ protected: void checkCategories(); + QString mLastModifiedSubSortKey; bool mHoliday, mBirthday, mAnniversary; diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 022dead..cfef973 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -195,3 +195,3 @@ void IncidenceBase::setLastModifiedSubInvalid() { - + // virtual method } @@ -203,2 +203,9 @@ void IncidenceBase::setLastModified(const QDateTime &lm) 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(); @@ -206,2 +213,6 @@ void IncidenceBase::setLastModified(const QDateTime &lm) } +QString IncidenceBase::lastModifiedSortKey() const +{ + return mLastModifiedKey; +} diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 665c1f6..444d4c4 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h @@ -65,2 +65,3 @@ class IncidenceBase : public CustomProperties QDateTime lastModified() const; + QString lastModifiedSortKey() const; @@ -162,2 +163,3 @@ class IncidenceBase : public CustomProperties QString mOrganizer; + QString mLastModifiedKey; QString mUid; |