summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoviewitem.cpp21
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
@@ -32,28 +32,39 @@ KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotod
32{ 32{
33 construct(); 33 construct();
34} 34}
35 35
36KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) 36KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo )
37 : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) 37 : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
38{ 38{
39 construct(); 39 construct();
40} 40}
41 41
42QString KOTodoViewItem::key(int column,bool) const 42QString KOTodoViewItem::key(int column,bool) const
43{ 43{
44 if ( column == 0 )
45 return text(0).lower();
46 if ( column == 1 ) {
47 if ( mTodo->isCompleted() ) {
48 return "6"+QString::number(mTodo->priority())+text(0).lower();
49 }
50 return QString::number(mTodo->priority())+text(0).lower();
51 }
44 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 52 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
45 if (it == mKeyMap.end()) { 53 if (it == mKeyMap.end()) {
46 return text(column).lower(); 54 return text(column).lower();
47 } else { 55 } else {
56 if ( column == 2 ) {
57 return *it+text(0).lower();
58 }
48 return *it; 59 return *it;
49 } 60 }
50} 61}
51 62
52void KOTodoViewItem:: setup() 63void KOTodoViewItem:: setup()
53{ 64{
54 65
55 int h = 20; 66 int h = 20;
56 if ( listView () ) { 67 if ( listView () ) {
57 QFontMetrics fm ( listView ()->font () ); 68 QFontMetrics fm ( listView ()->font () );
58 h = fm.height(); 69 h = fm.height();
59 } 70 }
@@ -79,55 +90,53 @@ void KOTodoViewItem::construct()
79 // qDebug("KOTodoViewItem::construct() "); 90 // qDebug("KOTodoViewItem::construct() ");
80 m_init = true; 91 m_init = true;
81 QString keyd = "=="; 92 QString keyd = "==";
82 QString keyt = "=="; 93 QString keyt = "==";
83 QString skeyd = "=="; 94 QString skeyd = "==";
84 QString skeyt = "=="; 95 QString skeyt = "==";
85 96
86 setOn(mTodo->isCompleted()); 97 setOn(mTodo->isCompleted());
87 setText(0,mTodo->summary()); 98 setText(0,mTodo->summary());
88 setText(1,QString::number(mTodo->priority())); 99 setText(1,QString::number(mTodo->priority()));
89 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 100 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
90 if (mTodo->percentComplete()<100) { 101 if (mTodo->percentComplete()<100) {
91 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 102 setSortKey(2,QString::number(mTodo->percentComplete()));
92 else setSortKey(2,QString::number(mTodo->percentComplete()));
93 } 103 }
94 else { 104 else {
95 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 105 setSortKey(2,"999");
96 else setSortKey(2,QString::number(99));
97 } 106 }
98 if (mTodo->hasDueDate()) { 107 if (mTodo->hasDueDate()) {
99 setText(3, mTodo->dtDueDateStr()); 108 setText(3, mTodo->dtDueDateStr());
100 QDate d = mTodo->dtDue().date(); 109 QDate d = mTodo->dtDue().date();
101 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 110 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
102 // setSortKey(3,keyd); 111 // setSortKey(3,keyd);
103 if (mTodo->doesFloat()) { 112 if (mTodo->doesFloat()) {
104 setText(4,""); 113 setText(4,"");
105 } 114 }
106 else { 115 else {
107 setText(4,mTodo->dtDueTimeStr()); 116 setText(4,mTodo->dtDueTimeStr());
108 QTime t = mTodo->dtDue().time(); 117 QTime t = mTodo->dtDue().time();
109 keyt.sprintf("%02d%02d",t.hour(),t.minute()); 118 keyt.sprintf("%02d%02d",t.hour(),t.minute());
110 //setSortKey(4,keyt); 119 //setSortKey(4,keyt);
111 } 120 }
112 } else { 121 } else {
113 setText(3,""); 122 setText(3,"");
114 setText(4,""); 123 setText(4,"");
115 } 124 }
116 setSortKey(3,keyd); 125 setSortKey(3,keyd);
117 setSortKey(4,keyt); 126 setSortKey(4,keyt);
118 127#if 0
119 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); 128 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt);
120 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 129 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
121 130#endif
122 keyd = ""; 131 keyd = "";
123 keyt = ""; 132 keyt = "";
124 133
125 if (mTodo->isRunning() ) { 134 if (mTodo->isRunning() ) {
126 QDate d = mTodo->runStart().date(); 135 QDate d = mTodo->runStart().date();
127 QTime t = mTodo->runStart().time(); 136 QTime t = mTodo->runStart().time();
128 skeyt.sprintf("%02d%02d",t.hour(),t.minute()); 137 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
129 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 138 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
130 keyd = KGlobal::locale()->formatDate( d , true); 139 keyd = KGlobal::locale()->formatDate( d , true);
131 keyt = KGlobal::locale()->formatTime( t ); 140 keyt = KGlobal::locale()->formatTime( t );
132 141
133 } else { 142 } else {