author | zautrix <zautrix> | 2005-02-07 21:06:04 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-07 21:06:04 (UTC) |
commit | edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e (patch) (unidiff) | |
tree | 7653e521f003a0c4e316530d38c09f3190c4edaf /korganizer | |
parent | da5e47069d88fa9aa656423ce4c60bf505728e1c (diff) | |
download | kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.zip kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.gz kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.bz2 |
recurrence fixes
-rw-r--r-- | korganizer/koeventviewer.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index de11c13..39921a0 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -242,142 +242,145 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
242 | mMailSubject = ""; | 242 | mMailSubject = ""; |
243 | mCurrentIncidence = event; | 243 | mCurrentIncidence = event; |
244 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 244 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
245 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 245 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
246 | if ( mode == 0 ) { | 246 | if ( mode == 0 ) { |
247 | addTag("h2",event->summary()); | 247 | addTag("h2",event->summary()); |
248 | } | 248 | } |
249 | else { | 249 | else { |
250 | if ( mColorMode == 1 ) { | 250 | if ( mColorMode == 1 ) { |
251 | mText +="<font color=\"#00A000\">"; | 251 | mText +="<font color=\"#00A000\">"; |
252 | } | 252 | } |
253 | if ( mColorMode == 2 ) { | 253 | if ( mColorMode == 2 ) { |
254 | mText +="<font color=\"#C00000\">"; | 254 | mText +="<font color=\"#C00000\">"; |
255 | } | 255 | } |
256 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 256 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
257 | if ( mode == 1 ) { | 257 | if ( mode == 1 ) { |
258 | addTag("h2",i18n( "Local: " ) +event->summary()); | 258 | addTag("h2",i18n( "Local: " ) +event->summary()); |
259 | } else { | 259 | } else { |
260 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 260 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
261 | } | 261 | } |
262 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 262 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
263 | if ( mColorMode ) | 263 | if ( mColorMode ) |
264 | mText += "</font>"; | 264 | mText += "</font>"; |
265 | } | 265 | } |
266 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 266 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
267 | if (event->cancelled ()) { | 267 | if (event->cancelled ()) { |
268 | mText +="<font color=\"#B00000\">"; | 268 | mText +="<font color=\"#B00000\">"; |
269 | addTag("i",i18n("This event has been cancelled!")); | 269 | addTag("i",i18n("This event has been cancelled!")); |
270 | mText.append("<br>"); | 270 | mText.append("<br>"); |
271 | mText += "</font>"; | 271 | mText += "</font>"; |
272 | mMailSubject += i18n("(cancelled)"); | 272 | mMailSubject += i18n("(cancelled)"); |
273 | } | 273 | } |
274 | if (!event->location().isEmpty()) { | 274 | if (!event->location().isEmpty()) { |
275 | addTag("b",i18n("Location: ")); | 275 | addTag("b",i18n("Location: ")); |
276 | mText.append(event->location()+"<br>"); | 276 | mText.append(event->location()+"<br>"); |
277 | mMailSubject += i18n(" at ") + event->location(); | 277 | mMailSubject += i18n(" at ") + event->location(); |
278 | } | 278 | } |
279 | if (event->doesFloat()) { | 279 | if (event->doesFloat()) { |
280 | if (event->isMultiDay()) { | 280 | if (event->isMultiDay()) { |
281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
282 | .arg(event->dtStartDateStr(shortDate)) | 282 | .arg(event->dtStartDateStr(shortDate)) |
283 | .arg(event->dtEndDateStr(shortDate))); | 283 | .arg(event->dtEndDateStr(shortDate))); |
284 | } else { | 284 | } else { |
285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
286 | } | 286 | } |
287 | } else { | 287 | } else { |
288 | if (event->isMultiDay()) { | 288 | if (event->isMultiDay()) { |
289 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 289 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
290 | .arg(event->dtStartStr( shortDate))); | 290 | .arg(event->dtStartStr( shortDate))); |
291 | mText.append(i18n("<p><b>To:</b> %1</p>") | 291 | mText.append(i18n("<p><b>To:</b> %1</p>") |
292 | .arg(event->dtEndStr(shortDate))); | 292 | .arg(event->dtEndStr(shortDate))); |
293 | } else { | 293 | } else { |
294 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 294 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
295 | .arg(event->dtStartDateStr( shortDate ))); | 295 | .arg(event->dtStartDateStr( shortDate ))); |
296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
297 | .arg(event->dtStartTimeStr()) | 297 | .arg(event->dtStartTimeStr()) |
298 | .arg(event->dtEndTimeStr())); | 298 | .arg(event->dtEndTimeStr())); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | 301 | ||
302 | if (event->recurrence()->doesRecur()) { | 302 | if (event->recurrence()->doesRecur()) { |
303 | 303 | ||
304 | QString recurText = event->recurrence()->recurrenceText(); | 304 | QString recurText = event->recurrence()->recurrenceText(); |
305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
306 | bool last; | 306 | bool ok; |
307 | QDate start = QDate::currentDate(); | 307 | QDate start = QDate::currentDate(); |
308 | QDate next; | 308 | QDateTime next; |
309 | next = event->recurrence()->getPreviousDate( start , &last ); | 309 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
310 | if ( !last ) { | 310 | if ( ok ) { |
311 | next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); | ||
312 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 311 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
313 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 312 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
314 | QDateTime nextdt = QDateTime( next, event->dtStart().time()); | 313 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); |
315 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); | ||
316 | 314 | ||
317 | } else { | 315 | } else { |
318 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 316 | bool last; |
319 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 317 | QDate nextd; |
318 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | ||
319 | if ( last ) { | ||
320 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | ||
321 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | ||
322 | } | ||
320 | } | 323 | } |
321 | } else { | 324 | } else { |
322 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 325 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
323 | 326 | ||
324 | } | 327 | } |
325 | 328 | ||
326 | 329 | ||
327 | if (event->isAlarmEnabled()) { | 330 | if (event->isAlarmEnabled()) { |
328 | Alarm *alarm =event->alarms().first() ; | 331 | Alarm *alarm =event->alarms().first() ; |
329 | QDateTime t = alarm->time(); | 332 | QDateTime t = alarm->time(); |
330 | int min = t.secsTo( event->dtStart() )/60; | 333 | int min = t.secsTo( event->dtStart() )/60; |
331 | QString s =i18n("( %1 min before )").arg( min ); | 334 | QString s =i18n("( %1 min before )").arg( min ); |
332 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 335 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
333 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 336 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
334 | //addTag("p",s); | 337 | //addTag("p",s); |
335 | } | 338 | } |
336 | 339 | ||
337 | addTag("b",i18n("Access: ")); | 340 | addTag("b",i18n("Access: ")); |
338 | mText.append(event->secrecyStr()+"<br>"); | 341 | mText.append(event->secrecyStr()+"<br>"); |
339 | if (!event->description().isEmpty()) { | 342 | if (!event->description().isEmpty()) { |
340 | addTag("p",i18n("<b>Details: </b>")); | 343 | addTag("p",i18n("<b>Details: </b>")); |
341 | addTag("p",event->description()); | 344 | addTag("p",event->description()); |
342 | } | 345 | } |
343 | 346 | ||
344 | formatCategories(event); | 347 | formatCategories(event); |
345 | 348 | ||
346 | formatReadOnly(event); | 349 | formatReadOnly(event); |
347 | formatAttendees(event); | 350 | formatAttendees(event); |
348 | 351 | ||
349 | setText(mText); | 352 | setText(mText); |
350 | //QWhatsThis::add(this,mText); | 353 | //QWhatsThis::add(this,mText); |
351 | 354 | ||
352 | } | 355 | } |
353 | 356 | ||
354 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 357 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
355 | { | 358 | { |
356 | mMailSubject = ""; | 359 | mMailSubject = ""; |
357 | mCurrentIncidence = event; | 360 | mCurrentIncidence = event; |
358 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 361 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
359 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 362 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
360 | if (mode == 0 ) | 363 | if (mode == 0 ) |
361 | addTag("h2",event->summary()); | 364 | addTag("h2",event->summary()); |
362 | else { | 365 | else { |
363 | if ( mColorMode == 1 ) { | 366 | if ( mColorMode == 1 ) { |
364 | mText +="<font color=\"#00A000\">"; | 367 | mText +="<font color=\"#00A000\">"; |
365 | } | 368 | } |
366 | if ( mColorMode == 2 ) { | 369 | if ( mColorMode == 2 ) { |
367 | mText +="<font color=\"#B00000\">"; | 370 | mText +="<font color=\"#B00000\">"; |
368 | } | 371 | } |
369 | if ( mode == 1 ) { | 372 | if ( mode == 1 ) { |
370 | addTag("h2",i18n( "Local: " ) +event->summary()); | 373 | addTag("h2",i18n( "Local: " ) +event->summary()); |
371 | } else { | 374 | } else { |
372 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 375 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
373 | } | 376 | } |
374 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 377 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
375 | if ( mColorMode ) | 378 | if ( mColorMode ) |
376 | mText += "</font>"; | 379 | mText += "</font>"; |
377 | } | 380 | } |
378 | mMailSubject += i18n( "Todo " )+ event->summary(); | 381 | mMailSubject += i18n( "Todo " )+ event->summary(); |
379 | 382 | ||
380 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 383 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
381 | mText +="<font color=\"#B00000\">"; | 384 | mText +="<font color=\"#B00000\">"; |
382 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 385 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
383 | mText += "</font>"; | 386 | mText += "</font>"; |