-rw-r--r-- | korganizer/kolistview.cpp | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index ea037a9..cec0476 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -131,27 +131,32 @@ bool ListItemVisitor::visit(Event *e) | |||
131 | mItem->setText(5,e->alarms().first()->offsetText() ); | 131 | mItem->setText(5,e->alarms().first()->offsetText() ); |
132 | } else { | 132 | } else { |
133 | mItem->setText(5, i18n("No")); | 133 | mItem->setText(5, i18n("No")); |
134 | } | 134 | } |
135 | mItem->setText(6, e->recurrence()->recurrenceText()); | 135 | mItem->setText(6, e->recurrence()->recurrenceText()); |
136 | if( ! e->doesRecur() ) | 136 | if( ! e->doesRecur() ) |
137 | mItem->setSortKey( 6, "-" ); | 137 | mItem->setSortKey( 6, "-" ); |
138 | mItem->setText(7,"---"); | 138 | mItem->setText(7,"---"); |
139 | mItem->setText(8,"---"); | 139 | mItem->setText(8,"---"); |
140 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 140 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
141 | mItem->setText(10,e->categoriesStr()); | 141 | mItem->setText(10,e->categoriesStr()); |
142 | mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); | 142 | mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); |
143 | 143 | mItem->setText(12, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); | |
144 | QString key; | 144 | |
145 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 145 | QString key; |
146 | QDate d = e->lastModified().date(); | ||
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(); | ||
146 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 151 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
147 | mItem->setSortKey(1,key); | 152 | mItem->setSortKey(1,key); |
148 | 153 | ||
149 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 154 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
150 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 155 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
151 | mItem->setSortKey(3,key); | 156 | mItem->setSortKey(3,key); |
152 | return true; | 157 | return true; |
153 | } | 158 | } |
154 | 159 | ||
155 | bool ListItemVisitor::visit(Todo *t) | 160 | bool ListItemVisitor::visit(Todo *t) |
156 | { | 161 | { |
157 | mItem->setText(0,t->summary()); | 162 | mItem->setText(0,t->summary()); |
@@ -186,36 +191,39 @@ bool ListItemVisitor::visit(Todo *t) | |||
186 | if (t->doesFloat()) { | 191 | if (t->doesFloat()) { |
187 | mItem->setText(8,"---"); | 192 | mItem->setText(8,"---"); |
188 | } else { | 193 | } else { |
189 | mItem->setText(8,t->dtDueTimeStr()); | 194 | mItem->setText(8,t->dtDueTimeStr()); |
190 | } | 195 | } |
191 | } else { | 196 | } else { |
192 | mItem->setText(7,"---"); | 197 | mItem->setText(7,"---"); |
193 | mItem->setText(8,"---"); | 198 | mItem->setText(8,"---"); |
194 | } | 199 | } |
195 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 200 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
196 | mItem->setText(10,t->categoriesStr()); | 201 | mItem->setText(10,t->categoriesStr()); |
197 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); | 202 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); |
198 | 203 | mItem->setText(12, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); | |
199 | QString key; | 204 | QString key; |
200 | QDate d; | 205 | QDate d = t->lastModified().date(); |
206 | QTime tm = t->lastModified().time(); | ||
207 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); | ||
208 | mItem->setSortKey(12,key); | ||
201 | if (t->hasDueDate()) { | 209 | if (t->hasDueDate()) { |
202 | d = t->dtDue().date(); | 210 | d = t->dtDue().date(); |
203 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 211 | tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
204 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 212 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
205 | mItem->setSortKey(7,key); | 213 | mItem->setSortKey(7,key); |
206 | } | 214 | } |
207 | if ( t->hasStartDate() ) { | 215 | if ( t->hasStartDate() ) { |
208 | d = t->dtStart().date(); | 216 | d = t->dtStart().date(); |
209 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 217 | tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
210 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 218 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
211 | mItem->setSortKey(1,key); | 219 | mItem->setSortKey(1,key); |
212 | } | 220 | } |
213 | return true; | 221 | return true; |
214 | } | 222 | } |
215 | 223 | ||
216 | bool ListItemVisitor::visit(Journal * j) | 224 | bool ListItemVisitor::visit(Journal * j) |
217 | { | 225 | { |
218 | 226 | ||
219 | QString des; | 227 | QString des; |
220 | if ( !j->summary().isEmpty() ) { | 228 | if ( !j->summary().isEmpty() ) { |
221 | des = j->summary(); | 229 | des = j->summary(); |
@@ -228,27 +236,32 @@ bool ListItemVisitor::visit(Journal * j) | |||
228 | mItem->setText(0,i18n("Journal: ")+des.left(25)); | 236 | mItem->setText(0,i18n("Journal: ")+des.left(25)); |
229 | mItem->setText(1,j->dtStartDateStr()); | 237 | mItem->setText(1,j->dtStartDateStr()); |
230 | mItem->setText(2,"---"); | 238 | mItem->setText(2,"---"); |
231 | mItem->setText(3,"---"); | 239 | mItem->setText(3,"---"); |
232 | mItem->setText(4,"---"); | 240 | mItem->setText(4,"---"); |
233 | mItem->setText(5,"---"); | 241 | mItem->setText(5,"---"); |
234 | mItem->setText(6,"---"); | 242 | mItem->setText(6,"---"); |
235 | mItem->setText(7,j->dtStartDateStr()); | 243 | mItem->setText(7,j->dtStartDateStr()); |
236 | mItem->setText(8,"---"); | 244 | mItem->setText(8,"---"); |
237 | mItem->setText(9,"---"); | 245 | mItem->setText(9,"---"); |
238 | mItem->setText(10,j->categoriesStr()); | 246 | mItem->setText(10,j->categoriesStr()); |
239 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); | 247 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); |
240 | 248 | mItem->setText(12, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); | |
241 | QString key; | 249 | |
242 | QDate d = j->dtStart().date(); | 250 | QString key; |
251 | QDate d = j->lastModified().date(); | ||
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(); | ||
243 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 256 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
244 | mItem->setSortKey(1,key); | 257 | mItem->setSortKey(1,key); |
245 | mItem->setSortKey(7,key); | 258 | mItem->setSortKey(7,key); |
246 | 259 | ||
247 | return true; | 260 | return true; |
248 | } | 261 | } |
249 | 262 | ||
250 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 263 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
251 | const char *name) | 264 | const char *name) |
252 | : KOEventView(calendar, parent, name) | 265 | : KOEventView(calendar, parent, name) |
253 | { | 266 | { |
254 | 267 | ||
@@ -258,41 +271,43 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, | |||
258 | mListView->addColumn(i18n("Summary")); | 271 | mListView->addColumn(i18n("Summary")); |
259 | mListView->addColumn(i18n("Start Date")); | 272 | mListView->addColumn(i18n("Start Date")); |
260 | mListView->addColumn(i18n("Start Time")); | 273 | mListView->addColumn(i18n("Start Time")); |
261 | mListView->addColumn(i18n("End Date")); | 274 | mListView->addColumn(i18n("End Date")); |
262 | mListView->addColumn(i18n("End Time")); | 275 | mListView->addColumn(i18n("End Time")); |
263 | mListView->addColumn(i18n("Alarm")); // alarm set? | 276 | mListView->addColumn(i18n("Alarm")); // alarm set? |
264 | mListView->addColumn(i18n("Recurs")); // recurs? | 277 | mListView->addColumn(i18n("Recurs")); // recurs? |
265 | mListView->addColumn(i18n("Due Date")); | 278 | mListView->addColumn(i18n("Due Date")); |
266 | mListView->addColumn(i18n("Due Time")); | 279 | mListView->addColumn(i18n("Due Time")); |
267 | mListView->addColumn(i18n("Cancelled")); | 280 | mListView->addColumn(i18n("Cancelled")); |
268 | mListView->addColumn(i18n("Categories")); | 281 | mListView->addColumn(i18n("Categories")); |
269 | mListView->addColumn(i18n("Calendar")); | 282 | mListView->addColumn(i18n("Calendar")); |
283 | mListView->addColumn(i18n("Last Modified")); | ||
270 | 284 | ||
271 | mListView->setColumnAlignment(0,AlignLeft); | 285 | mListView->setColumnAlignment(0,AlignLeft); |
272 | mListView->setColumnAlignment(1,AlignLeft); | 286 | mListView->setColumnAlignment(1,AlignLeft); |
273 | mListView->setColumnAlignment(2,AlignHCenter); | 287 | mListView->setColumnAlignment(2,AlignHCenter); |
274 | mListView->setColumnAlignment(3,AlignLeft); | 288 | mListView->setColumnAlignment(3,AlignLeft); |
275 | mListView->setColumnAlignment(4,AlignHCenter); | 289 | mListView->setColumnAlignment(4,AlignHCenter); |
276 | mListView->setColumnAlignment(5,AlignLeft); | 290 | mListView->setColumnAlignment(5,AlignLeft); |
277 | mListView->setColumnAlignment(6,AlignLeft); | 291 | mListView->setColumnAlignment(6,AlignLeft); |
278 | mListView->setColumnAlignment(7,AlignLeft); | 292 | mListView->setColumnAlignment(7,AlignLeft); |
279 | mListView->setColumnAlignment(8,AlignLeft); | 293 | mListView->setColumnAlignment(8,AlignLeft); |
280 | mListView->setColumnAlignment(9,AlignLeft); | 294 | mListView->setColumnAlignment(9,AlignLeft); |
281 | mListView->setColumnAlignment(10,AlignLeft); | 295 | mListView->setColumnAlignment(10,AlignLeft); |
282 | mListView->setColumnAlignment(11,AlignLeft); | 296 | mListView->setColumnAlignment(11,AlignLeft); |
297 | mListView->setColumnAlignment(12,AlignLeft); | ||
283 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); | 298 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); |
284 | 299 | ||
285 | int iii = 0; | 300 | int iii = 0; |
286 | for ( iii = 0; iii< 12 ; ++iii ) | 301 | for ( iii = 0; iii< 13 ; ++iii ) |
287 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 302 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
288 | 303 | ||
289 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 304 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
290 | layoutTop->addWidget(mListView); | 305 | layoutTop->addWidget(mListView); |
291 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 306 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
292 | mPopupMenu = eventPopup(); | 307 | mPopupMenu = eventPopup(); |
293 | QPopupMenu* selPopup = new QPopupMenu ( this ); | 308 | QPopupMenu* selPopup = new QPopupMenu ( this ); |
294 | mPopupMenu->insertSeparator(); | 309 | mPopupMenu->insertSeparator(); |
295 | 310 | ||
296 | selPopup->insertItem(i18n("All"),this, | 311 | selPopup->insertItem(i18n("All"),this, |
297 | SLOT(allSelection())); | 312 | SLOT(allSelection())); |
298 | selPopup->insertItem(i18n("None"),this, | 313 | selPopup->insertItem(i18n("None"),this, |