summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoviewitem.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoviewitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoviewitem.cpp62
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
@@ -20,6 +20,7 @@
20#include <klocale.h> 20#include <klocale.h>
21#include <kdebug.h> 21#include <kdebug.h>
22#include <qapp.h> 22#include <qapp.h>
23#include <kglobal.h>
23 24
24#include <kiconloader.h> 25#include <kiconloader.h>
25#include "kotodoviewitem.h" 26#include "kotodoviewitem.h"
@@ -120,24 +121,35 @@ void KOTodoViewItem::construct()
120 121
121 122
122 123
123 if (mTodo->hasStartDate()) { 124 keyd = "";
124 setText(5, mTodo->dtStartDateStr()); 125 keyt = "";
125 QDate d = mTodo->dtStart().date(); 126
126 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 127 if (mTodo->isRunning() ) {
127 128 QDate d = mTodo->runStart().date();
128 if (mTodo->doesFloat()) { 129 QTime t = mTodo->runStart().time();
129 setText(6,"");
130 }
131 else {
132 setText(6,mTodo->dtStartTimeStr());
133 QTime t = mTodo->dtStart().time();
134 skeyt.sprintf("%02d%02d",t.hour(),t.minute()); 130 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
135 131 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
136 } 132 keyd = KGlobal::locale()->formatDate( d );
133 keyt = KGlobal::locale()->formatTime( t );
134
137 } else { 135 } else {
138 setText(5,""); 136
139 setText(6,""); 137 if (mTodo->hasStartDate()) {
138 keyd = mTodo->dtStartDateStr();
139 QDate d = mTodo->dtStart().date();
140 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
141
142 if ( !mTodo->doesFloat()) {
143 keyt = mTodo->dtStartTimeStr();
144 QTime t = mTodo->dtStart().time();
145 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
146
147 }
148
149 }
140 } 150 }
151 setText(5,keyd);
152 setText(6,keyt);
141 setSortKey(5,skeyd); 153 setSortKey(5,skeyd);
142 setSortKey(6,skeyt); 154 setSortKey(6,skeyt);
143 155
@@ -368,13 +380,21 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i
368 // maybe we are in flat-display-mode 380 // maybe we are in flat-display-mode
369 if ( !firstChild() ) 381 if ( !firstChild() )
370 openMode = false; 382 openMode = false;
371 int odue = mTodo->hasDueSubTodo( openMode ); 383 bool colorRunning = mTodo->isRunning();
372 if (odue == 2) { 384 if ( ! colorRunning && openMode )
373 colorToSet = KOPrefs::instance()->mTodoOverdueColor; 385 colorRunning = mTodo->hasRunningSub();
374 setColor = true; 386 if ( colorRunning ) {
375 } else if ( odue == 1 ) {
376 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
377 setColor = true; 387 setColor = true;
388 colorToSet = KOPrefs::instance()->mTodoRunColor;
389 } else {
390 int odue = mTodo->hasDueSubTodo( openMode );
391 if (odue == 2) {
392 colorToSet = KOPrefs::instance()->mTodoOverdueColor;
393 setColor = true;
394 } else if ( odue == 1 ) {
395 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
396 setColor = true;
397 }
378 } 398 }
379 399
380 400