Diffstat (limited to 'korganizer/kotodoviewitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 6559119..66f8d06 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp @@ -21,4 +21,5 @@ #include <kdebug.h> #include <qapp.h> +#include <kglobal.h> #include <kiconloader.h> @@ -121,22 +122,33 @@ void KOTodoViewItem::construct() - if (mTodo->hasStartDate()) { - setText(5, mTodo->dtStartDateStr()); - QDate d = mTodo->dtStart().date(); - skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); - - if (mTodo->doesFloat()) { - setText(6,""); - } - else { - setText(6,mTodo->dtStartTimeStr()); - QTime t = mTodo->dtStart().time(); + 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 ); + keyt = KGlobal::locale()->formatTime( t ); + } else { - setText(5,""); - setText(6,""); + + 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()); + + } + + } } + setText(5,keyd); + setText(6,keyt); setSortKey(5,skeyd); setSortKey(6,skeyt); @@ -369,11 +381,19 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i if ( !firstChild() ) openMode = false; - int odue = mTodo->hasDueSubTodo( openMode ); - if (odue == 2) { - colorToSet = KOPrefs::instance()->mTodoOverdueColor; - setColor = true; - } else if ( odue == 1 ) { - colorToSet = KOPrefs::instance()->mTodoDueTodayColor; + bool colorRunning = mTodo->isRunning(); + if ( ! colorRunning && openMode ) + colorRunning = mTodo->hasRunningSub(); + if ( colorRunning ) { setColor = true; + colorToSet = KOPrefs::instance()->mTodoRunColor; + } else { + int odue = mTodo->hasDueSubTodo( openMode ); + if (odue == 2) { + colorToSet = KOPrefs::instance()->mTodoOverdueColor; + setColor = true; + } else if ( odue == 1 ) { + colorToSet = KOPrefs::instance()->mTodoDueTodayColor; + setColor = true; + } } |