summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoviewitem.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoviewitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoviewitem.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index ae0b334..347d982 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -70,63 +70,88 @@ void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w,
70{ 70{
71 QListViewItem::paintBranches(p,cg,w,y,h); 71 QListViewItem::paintBranches(p,cg,w,y,h);
72} 72}
73#else 73#else
74#endif 74#endif
75 75
76void KOTodoViewItem::construct() 76void KOTodoViewItem::construct()
77{ 77{
78 // qDebug("KOTodoViewItem::construct() "); 78 // qDebug("KOTodoViewItem::construct() ");
79 m_init = true; 79 m_init = true;
80 QString keyd = "=="; 80 QString keyd = "==";
81 QString keyt = "=="; 81 QString keyt = "==";
82 QString skeyd = "==";
83 QString skeyt = "==";
82 84
83 setOn(mTodo->isCompleted()); 85 setOn(mTodo->isCompleted());
84 setText(0,mTodo->summary()); 86 setText(0,mTodo->summary());
85 setText(1,QString::number(mTodo->priority())); 87 setText(1,QString::number(mTodo->priority()));
86 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 88 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
87 if (mTodo->percentComplete()<100) { 89 if (mTodo->percentComplete()<100) {
88 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 90 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
89 else setSortKey(2,QString::number(mTodo->percentComplete())); 91 else setSortKey(2,QString::number(mTodo->percentComplete()));
90 } 92 }
91 else { 93 else {
92 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 94 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
93 else setSortKey(2,QString::number(99)); 95 else setSortKey(2,QString::number(99));
94 } 96 }
95 if (mTodo->hasDueDate()) { 97 if (mTodo->hasDueDate()) {
96 setText(3, mTodo->dtDueDateStr()); 98 setText(3, mTodo->dtDueDateStr());
97 QDate d = mTodo->dtDue().date(); 99 QDate d = mTodo->dtDue().date();
98 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 100 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
99 setSortKey(3,keyd); 101 // setSortKey(3,keyd);
100 if (mTodo->doesFloat()) { 102 if (mTodo->doesFloat()) {
101 setText(4,""); 103 setText(4,"");
102 } 104 }
103 else { 105 else {
104 setText(4,mTodo->dtDueTimeStr()); 106 setText(4,mTodo->dtDueTimeStr());
105 QTime t = mTodo->dtDue().time(); 107 QTime t = mTodo->dtDue().time();
106 keyt.sprintf("%02d%02d",t.hour(),t.minute()); 108 keyt.sprintf("%02d%02d",t.hour(),t.minute());
107 setSortKey(4,keyt); 109 //setSortKey(4,keyt);
108 } 110 }
109 } else { 111 } else {
110 setText(3,""); 112 setText(3,"");
111 setText(4,""); 113 setText(4,"");
112 } 114 }
113 setSortKey(3,keyd); 115 setSortKey(3,keyd);
114 setSortKey(4,keyt); 116 setSortKey(4,keyt);
115 117
116 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); 118 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt);
117 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 119 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
118 120
119 setText(5,mTodo->cancelled() ? i18n("Yes") : i18n("No")); 121
120 setText(6,mTodo->categoriesStr()); 122
123 if (mTodo->hasStartDate()) {
124 setText(5, mTodo->dtStartDateStr());
125 QDate d = mTodo->dtStart().date();
126 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
127
128 if (mTodo->doesFloat()) {
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());
135
136 }
137 } else {
138 setText(5,"");
139 setText(6,"");
140 }
141 setSortKey(5,skeyd);
142 setSortKey(6,skeyt);
143
144 setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No"));
145 setText(8,mTodo->categoriesStr());
121 146
122#if 0 147#if 0
123 // Find sort id in description. It's the text behind the last '#' character 148 // Find sort id in description. It's the text behind the last '#' character
124 // found in the description. White spaces are removed from beginning and end 149 // found in the description. White spaces are removed from beginning and end
125 // of sort id. 150 // of sort id.
126 int pos = mTodo->description().findRev('#'); 151 int pos = mTodo->description().findRev('#');
127 if (pos < 0) { 152 if (pos < 0) {
128 setText(6,""); 153 setText(6,"");
129 } else { 154 } else {
130 QString str = mTodo->description().mid(pos+1); 155 QString str = mTodo->description().mid(pos+1);
131 str.stripWhiteSpace(); 156 str.stripWhiteSpace();
132 setText(6,str); 157 setText(6,str);