-rw-r--r-- | korganizer/kolistview.cpp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index b236c2d..4fc1194 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -128,38 +128,36 @@ bool ListItemVisitor::visit(Event *e) | |||
128 | mItem->setText(4,"---"); | 128 | mItem->setText(4,"---"); |
129 | else | 129 | else |
130 | mItem->setText(4,e->dtEndTimeStr()); | 130 | mItem->setText(4,e->dtEndTimeStr()); |
131 | mItem->setText(5, e->durationText()); | 131 | mItem->setText(5, e->durationText()); |
132 | if ( e->isAlarmEnabled() ) { | 132 | if ( e->isAlarmEnabled() ) { |
133 | mItem->setText(6,e->alarms().first()->offsetText() ); | 133 | mItem->setText(6,e->alarms().first()->offsetText() ); |
134 | } else { | 134 | } else { |
135 | mItem->setText(6, i18n("No")); | 135 | mItem->setText(6, i18n("No")); |
136 | } | 136 | } |
137 | mItem->setText(7, e->recurrenceText()); | 137 | mItem->setText(7, e->recurrenceText()); |
138 | if( ! e->doesRecur() ) | 138 | if( ! e->doesRecur() ) |
139 | mItem->setSortKey( 7, "-" ); | 139 | mItem->setSortKey( 7, "-" ); |
140 | mItem->setText(8, e->cancelled() ? i18n("Yes") : i18n("No")); | 140 | mItem->setText(8, e->cancelled() ? i18n("Yes") : i18n("No")); |
141 | mItem->setText(9,e->categoriesStr()); | 141 | mItem->setText(9,e->categoriesStr()); |
142 | mItem->setText(10, KOPrefs::instance()->calName( e->calID() )); | 142 | mItem->setText(10, KOPrefs::instance()->calName( e->calID() )); |
143 | mItem->setText(11, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); | 143 | mItem->setText(11, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); |
144 | mItem->setSortKey(11,e->lastModifiedSortKey()); | ||
144 | 145 | ||
145 | QString key; | 146 | QString key; |
146 | QDate d = e->lastModified().date(); | 147 | QTime t; |
147 | QTime t = e->lastModified().time(); | ||
148 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); | ||
149 | mItem->setSortKey(12,key); | ||
150 | t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 148 | t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
151 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 149 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
152 | mItem->setSortKey(1,key); | 150 | mItem->setSortKey(1,key); |
153 | 151 | ||
154 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 152 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
155 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 153 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
156 | mItem->setSortKey(3,key); | 154 | mItem->setSortKey(3,key); |
157 | return true; | 155 | return true; |
158 | } | 156 | } |
159 | 157 | ||
160 | bool ListItemVisitor::visit(Todo *t) | 158 | bool ListItemVisitor::visit(Todo *t) |
161 | { | 159 | { |
162 | mItem->setText(0,t->summary()); | 160 | mItem->setText(0,t->summary()); |
163 | if ( t->isCompleted() ) { | 161 | if ( t->isCompleted() ) { |
164 | mItem->setSortKey(0,"99"+ t->summary().left(10)); | 162 | mItem->setSortKey(0,"99"+ t->summary().left(10)); |
165 | } else | 163 | } else |
@@ -187,37 +185,36 @@ bool ListItemVisitor::visit(Todo *t) | |||
187 | if (t->hasDueDate()) { | 185 | if (t->hasDueDate()) { |
188 | mItem->setText(3,t->dtDueDateStr()); | 186 | mItem->setText(3,t->dtDueDateStr()); |
189 | if (t->doesFloat()) { | 187 | if (t->doesFloat()) { |
190 | mItem->setText(4,"---"); | 188 | mItem->setText(4,"---"); |
191 | } else { | 189 | } else { |
192 | mItem->setText(4,t->dtDueTimeStr()); | 190 | mItem->setText(4,t->dtDueTimeStr()); |
193 | } | 191 | } |
194 | } else { | 192 | } else { |
195 | mItem->setText(3,"---"); | 193 | mItem->setText(3,"---"); |
196 | mItem->setText(4,"---"); | 194 | mItem->setText(4,"---"); |
197 | } | 195 | } |
198 | mItem->setText(5, t->durationText()); | 196 | mItem->setText(5, t->durationText()); |
199 | mItem->setText(8, t->cancelled() ? i18n("Yes") : i18n("No")); | 197 | mItem->setText(8, t->cancelled() ? i18n("Yes") : i18n("No")); |
200 | mItem->setText(9,t->categoriesStr()); | 198 | mItem->setText(9,t->categoriesStr()); |
201 | mItem->setText(10, KOPrefs::instance()->calName( t->calID() )); | 199 | mItem->setText(10, KOPrefs::instance()->calName( t->calID() )); |
202 | mItem->setText(11, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); | 200 | mItem->setText(11, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); |
201 | mItem->setSortKey(11,t->lastModifiedSortKey()); | ||
203 | QString key; | 202 | QString key; |
204 | QDate d = t->lastModified().date(); | 203 | QDate d; |
205 | QTime tm = t->lastModified().time(); | 204 | QTime tm; |
206 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); | ||
207 | mItem->setSortKey(11,key); | ||
208 | if (t->hasDueDate()) { | 205 | if (t->hasDueDate()) { |
209 | d = t->dtDue().date(); | 206 | d = t->dtDue().date(); |
210 | tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 207 | tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
211 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 208 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
212 | mItem->setSortKey(3,key); | 209 | mItem->setSortKey(3,key); |
213 | } | 210 | } |
214 | if ( t->hasStartDate() ) { | 211 | if ( t->hasStartDate() ) { |
215 | d = t->dtStart().date(); | 212 | d = t->dtStart().date(); |
216 | tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 213 | tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
217 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 214 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
218 | mItem->setSortKey(1,key); | 215 | mItem->setSortKey(1,key); |
219 | } | 216 | } |
220 | return true; | 217 | return true; |
221 | } | 218 | } |
222 | 219 | ||
223 | bool ListItemVisitor::visit(Journal * j) | 220 | bool ListItemVisitor::visit(Journal * j) |
@@ -233,43 +230,39 @@ bool ListItemVisitor::visit(Journal * j) | |||
233 | des.replace (QRegExp ("\\n"),"" ); | 230 | des.replace (QRegExp ("\\n"),"" ); |
234 | des.replace (QRegExp ("\\r"),"" ); | 231 | des.replace (QRegExp ("\\r"),"" ); |
235 | } | 232 | } |
236 | mItem->setText(0,des.left(25)); | 233 | mItem->setText(0,des.left(25)); |
237 | mItem->setSortKey(0,"0"+ des.left(25)); | 234 | mItem->setSortKey(0,"0"+ des.left(25)); |
238 | mItem->setText(1,j->dtStartDateStr()); | 235 | mItem->setText(1,j->dtStartDateStr()); |
239 | mItem->setText(2,"---"); | 236 | mItem->setText(2,"---"); |
240 | mItem->setText(3,"---"); | 237 | mItem->setText(3,"---"); |
241 | mItem->setText(4,"---"); | 238 | mItem->setText(4,"---"); |
242 | mItem->setText(5,"---"); | 239 | mItem->setText(5,"---"); |
243 | mItem->setText(6,"---"); | 240 | mItem->setText(6,"---"); |
244 | mItem->setText(7,"---"); | 241 | mItem->setText(7,"---"); |
245 | mItem->setText(8,"---"); | 242 | mItem->setText(8,"---"); |
246 | mItem->setText(9,j->categoriesStr()); | 243 | mItem->setText(9,j->categoriesStr()); |
247 | mItem->setText(10, KOPrefs::instance()->calName( j->calID() )); | 244 | mItem->setText(10, KOPrefs::instance()->calName( j->calID() )); |
248 | mItem->setText(11, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); | 245 | mItem->setText(11, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); |
246 | mItem->setSortKey(11,j->lastModifiedSortKey()); | ||
249 | 247 | ||
250 | QString key; | 248 | QString key; |
251 | QDate d = j->lastModified().date(); | 249 | QDate d; |
252 | QTime tm = j->lastModified().time(); | ||
253 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); | ||
254 | mItem->setSortKey(12,key); | ||
255 | d = j->dtStart().date(); | 250 | d = j->dtStart().date(); |
256 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 251 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
257 | mItem->setSortKey(1,key); | 252 | mItem->setSortKey(1,key); |
258 | mItem->setSortKey(7,key); | ||
259 | |||
260 | return true; | 253 | return true; |
261 | } | 254 | } |
262 | 255 | ||
263 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 256 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
264 | const char *name) | 257 | const char *name) |
265 | : KOEventView(calendar, parent, name) | 258 | : KOEventView(calendar, parent, name) |
266 | { | 259 | { |
267 | 260 | ||
268 | mActiveItem = 0; | 261 | mActiveItem = 0; |
269 | mForceShowCompletedTodos = false; | 262 | mForceShowCompletedTodos = false; |
270 | mListView = new KOListViewListView(this); | 263 | mListView = new KOListViewListView(this); |
271 | mListView->addColumn(i18n("Summary")); | 264 | mListView->addColumn(i18n("Summary")); |
272 | mListView->addColumn(i18n("Start Date")); | 265 | mListView->addColumn(i18n("Start Date")); |
273 | mListView->addColumn(i18n("Start Time")); | 266 | mListView->addColumn(i18n("Start Time")); |
274 | mListView->addColumn(i18n("End/Due Date")); | 267 | mListView->addColumn(i18n("End/Due Date")); |
275 | mListView->addColumn(i18n("End/Due Time")); | 268 | mListView->addColumn(i18n("End/Due Time")); |