author | zautrix <zautrix> | 2005-10-24 18:01:08 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-24 18:01:08 (UTC) |
commit | 9b626f37040b4da2a23cdce2d9241218b84d3d88 (patch) (side-by-side diff) | |
tree | bab5b6f2978610c4be1c105a7c3388337621d7c3 /korganizer | |
parent | ae59704dc0643963d0ed648baf7186b741c3ecb2 (diff) | |
download | kdepimpi-9b626f37040b4da2a23cdce2d9241218b84d3d88.zip kdepimpi-9b626f37040b4da2a23cdce2d9241218b84d3d88.tar.gz kdepimpi-9b626f37040b4da2a23cdce2d9241218b84d3d88.tar.bz2 |
fixx
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 848e9e7..519bb16 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp @@ -20,126 +20,135 @@ #include <klocale.h> #include <kdebug.h> #include <qapp.h> #include <kglobal.h> #include <kiconloader.h> #include "kotodoviewitem.h" #include "kotodoview.h" #include "koprefs.h" KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) { construct(); } KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) { construct(); } QString KOTodoViewItem::key(int column,bool) const { + if ( column == 0 ) + return text(0).lower(); + if ( column == 1 ) { + if ( mTodo->isCompleted() ) { + return "6"+QString::number(mTodo->priority())+text(0).lower(); + } + return QString::number(mTodo->priority())+text(0).lower(); + } QMap<int,QString>::ConstIterator it = mKeyMap.find(column); if (it == mKeyMap.end()) { return text(column).lower(); } else { + if ( column == 2 ) { + return *it+text(0).lower(); + } return *it; } } void KOTodoViewItem:: setup() { int h = 20; if ( listView () ) { QFontMetrics fm ( listView ()->font () ); h = fm.height(); } setHeight( h ); } void KOTodoViewItem::setSortKey(int column,const QString &key) { mKeyMap.insert(column,key); } #if QT_VERSION >= 0x030000 void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, int y,int h) { QListViewItem::paintBranches(p,cg,w,y,h); } #else #endif void KOTodoViewItem::construct() { // qDebug("KOTodoViewItem::construct() "); m_init = true; QString keyd = "=="; QString keyt = "=="; QString skeyd = "=="; QString skeyt = "=="; setOn(mTodo->isCompleted()); setText(0,mTodo->summary()); setText(1,QString::number(mTodo->priority())); setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); if (mTodo->percentComplete()<100) { - if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); - else setSortKey(2,QString::number(mTodo->percentComplete())); + setSortKey(2,QString::number(mTodo->percentComplete())); } else { - if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); - else setSortKey(2,QString::number(99)); + setSortKey(2,"999"); } if (mTodo->hasDueDate()) { setText(3, mTodo->dtDueDateStr()); QDate d = mTodo->dtDue().date(); keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); // setSortKey(3,keyd); if (mTodo->doesFloat()) { setText(4,""); } else { setText(4,mTodo->dtDueTimeStr()); QTime t = mTodo->dtDue().time(); keyt.sprintf("%02d%02d",t.hour(),t.minute()); //setSortKey(4,keyt); } } else { setText(3,""); setText(4,""); } setSortKey(3,keyd); setSortKey(4,keyt); - +#if 0 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); - +#endif keyd = ""; keyt = ""; if (mTodo->isRunning() ) { QDate d = mTodo->runStart().date(); QTime t = mTodo->runStart().time(); skeyt.sprintf("%02d%02d",t.hour(),t.minute()); skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); keyd = KGlobal::locale()->formatDate( d , true); keyt = KGlobal::locale()->formatTime( t ); } else { if (mTodo->hasStartDate()) { keyd = mTodo->dtStartDateStr(); QDate d = mTodo->dtStart().date(); skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); if ( !mTodo->doesFloat()) { keyt = mTodo->dtStartTimeStr(); QTime t = mTodo->dtStart().time(); skeyt.sprintf("%02d%02d",t.hour(),t.minute()); } |