author | zautrix <zautrix> | 2005-01-27 12:25:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-27 12:25:55 (UTC) |
commit | 32ad6c6cc658d952c9dfa1fcf5857662bcf01c22 (patch) (unidiff) | |
tree | 6d25535ba67a579fd1560e6f87ceb4fef0ad8fc9 /korganizer | |
parent | c8b484570a9cf8aacc070f92141c8bcfebbf3a93 (diff) | |
download | kdepimpi-32ad6c6cc658d952c9dfa1fcf5857662bcf01c22.zip kdepimpi-32ad6c6cc658d952c9dfa1fcf5857662bcf01c22.tar.gz kdepimpi-32ad6c6cc658d952c9dfa1fcf5857662bcf01c22.tar.bz2 |
birthday fixes
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 4111c5d..57623e6 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -287,466 +287,477 @@ void KOWhatsNextView::updateView() | |||
287 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; | 287 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; |
288 | if (todos.count() > 0 && topmostPrios > 0 ) { | 288 | if (todos.count() > 0 && topmostPrios > 0 ) { |
289 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 289 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
290 | // mText += "<h2>"; | 290 | // mText += "<h2>"; |
291 | //<img src=\""; | 291 | //<img src=\""; |
292 | // mText += ipath; | 292 | // mText += ipath; |
293 | // mText += "\">"; | 293 | // mText += "\">"; |
294 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; | 294 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; |
295 | 295 | ||
296 | //mText += "<ul>\n"; | 296 | //mText += "<ul>\n"; |
297 | bool gotone = false; | 297 | bool gotone = false; |
298 | int priority = 1; | 298 | int priority = 1; |
299 | int priosFound = 0; | 299 | int priosFound = 0; |
300 | #ifdef DESKTOP_VERSION | 300 | #ifdef DESKTOP_VERSION |
301 | mText +="<p></p>"; | 301 | mText +="<p></p>"; |
302 | #endif | 302 | #endif |
303 | 303 | ||
304 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; | 304 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; |
305 | mText += "<ul>\n"; | 305 | mText += "<ul>\n"; |
306 | while (!gotone && priority<6) { | 306 | while (!gotone && priority<6) { |
307 | todo = todos.first(); | 307 | todo = todos.first(); |
308 | while(todo) { | 308 | while(todo) { |
309 | if (!todo->isCompleted() && (todo->priority() == priority) ) { | 309 | if (!todo->isCompleted() && (todo->priority() == priority) ) { |
310 | if ( appendTodo(todo) ) | 310 | if ( appendTodo(todo) ) |
311 | gotone = true; | 311 | gotone = true; |
312 | } | 312 | } |
313 | todo = todos.next(); | 313 | todo = todos.next(); |
314 | } | 314 | } |
315 | if ( gotone ) { | 315 | if ( gotone ) { |
316 | gotone = false; | 316 | gotone = false; |
317 | ++priosFound; | 317 | ++priosFound; |
318 | if ( priosFound == topmostPrios ) | 318 | if ( priosFound == topmostPrios ) |
319 | break; | 319 | break; |
320 | } | 320 | } |
321 | priority++; | 321 | priority++; |
322 | // kdDebug() << "adding the todos..." << endl; | 322 | // kdDebug() << "adding the todos..." << endl; |
323 | } | 323 | } |
324 | mText += "</ul>\n"; | 324 | mText += "</ul>\n"; |
325 | } | 325 | } |
326 | 326 | ||
327 | int replys = 0; | 327 | int replys = 0; |
328 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); | 328 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); |
329 | if (events.count() > 0) { | 329 | if (events.count() > 0) { |
330 | Event *ev = events.first(); | 330 | Event *ev = events.first(); |
331 | while(ev) { | 331 | while(ev) { |
332 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 332 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
333 | if (me!=0) { | 333 | if (me!=0) { |
334 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 334 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
335 | if (replys == 0) { | 335 | if (replys == 0) { |
336 | mText += "<p></p>"; | 336 | mText += "<p></p>"; |
337 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 337 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
338 | //mText += "<h2>"; | 338 | //mText += "<h2>"; |
339 | //<img src=\""; | 339 | //<img src=\""; |
340 | // mText += ipath; | 340 | // mText += ipath; |
341 | // mText += "\">"; | 341 | // mText += "\">"; |
342 | //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; | 342 | //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; |
343 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; | 343 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; |
344 | mText += "<table>\n"; | 344 | mText += "<table>\n"; |
345 | } | 345 | } |
346 | replys++; | 346 | replys++; |
347 | appendEvent(ev,true); | 347 | appendEvent(ev,true); |
348 | } | 348 | } |
349 | } | 349 | } |
350 | ev = events.next(); | 350 | ev = events.next(); |
351 | } | 351 | } |
352 | } | 352 | } |
353 | todos = calendar()->todos(); | 353 | todos = calendar()->todos(); |
354 | if (todos.count() > 0) { | 354 | if (todos.count() > 0) { |
355 | Todo *to = todos.first(); | 355 | Todo *to = todos.first(); |
356 | while(to) { | 356 | while(to) { |
357 | if ( !to->isCompleted() ){ | 357 | if ( !to->isCompleted() ){ |
358 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 358 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
359 | if (me!=0) { | 359 | if (me!=0) { |
360 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 360 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
361 | if (replys == 0) { | 361 | if (replys == 0) { |
362 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; | 362 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; |
363 | mText += "<table>\n"; | 363 | mText += "<table>\n"; |
364 | } | 364 | } |
365 | replys++; | 365 | replys++; |
366 | appendEvent(to, true); | 366 | appendEvent(to, true); |
367 | } | 367 | } |
368 | } | 368 | } |
369 | } | 369 | } |
370 | to = todos.next(); | 370 | to = todos.next(); |
371 | } | 371 | } |
372 | } | 372 | } |
373 | if (replys > 0 ) mText += "</table>\n"; | 373 | if (replys > 0 ) mText += "</table>\n"; |
374 | 374 | ||
375 | 375 | ||
376 | mText += "</td></tr>\n</table>\n"; | 376 | mText += "</td></tr>\n</table>\n"; |
377 | 377 | ||
378 | mView->setText(mText); | 378 | mView->setText(mText); |
379 | mView->setFocus(); | 379 | mView->setFocus(); |
380 | 380 | ||
381 | // QPixmap bPix = SmallIcon( "back" ); | 381 | // QPixmap bPix = SmallIcon( "back" ); |
382 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); | 382 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); |
383 | // QWidget* test = new QWidget(); | 383 | // QWidget* test = new QWidget(); |
384 | // test->setBackgroundMode(FixedPixmap ); | 384 | // test->setBackgroundMode(FixedPixmap ); |
385 | // test->setBackgroundPixmap ( bPix ); | 385 | // test->setBackgroundPixmap ( bPix ); |
386 | // test->resize( 300, 400 ); | 386 | // test->resize( 300, 400 ); |
387 | // test->show(); | 387 | // test->show(); |
388 | // mView->setBackgroundMode(FixedPixmap ); | 388 | // mView->setBackgroundMode(FixedPixmap ); |
389 | // mView->setBackgroundPixmap ( bPix ); | 389 | // mView->setBackgroundPixmap ( bPix ); |
390 | // qDebug("%s ",mText.latin1()); | 390 | // qDebug("%s ",mText.latin1()); |
391 | } | 391 | } |
392 | 392 | ||
393 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) | 393 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) |
394 | { | 394 | { |
395 | QString date; | 395 | QString date; |
396 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); | 396 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); |
397 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { | 397 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { |
398 | if ( i == 0 ) { | 398 | if ( i == 0 ) { |
399 | //mText += "<table>\n"; | 399 | //mText += "<table>\n"; |
400 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; | 400 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; |
401 | } | 401 | } |
402 | else if ( i == 1 ) | 402 | else if ( i == 1 ) |
403 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; | 403 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; |
404 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; | 404 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; |
405 | mText += "<h2>" + date + "</h2>\n"; | 405 | mText += "<h2>" + date + "</h2>\n"; |
406 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 406 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
407 | mText += "<table>\n"; | 407 | mText += "<table>\n"; |
408 | 408 | ||
409 | 409 | ||
410 | 410 | ||
411 | } else { | 411 | } else { |
412 | if ( i == 0 ) { | 412 | if ( i == 0 ) { |
413 | //mText += "<table>\n"; | 413 | //mText += "<table>\n"; |
414 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; | 414 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; |
415 | } | 415 | } |
416 | 416 | ||
417 | #ifdef DESKTOP_VERSION | 417 | #ifdef DESKTOP_VERSION |
418 | else if ( i == 1 ) { | 418 | else if ( i == 1 ) { |
419 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; | 419 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; |
420 | } | 420 | } |
421 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; | 421 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; |
422 | #else | 422 | #else |
423 | else if ( i == 1 ) { | 423 | else if ( i == 1 ) { |
424 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; | 424 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; |
425 | } | 425 | } |
426 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; | 426 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; |
427 | 427 | ||
428 | #endif | 428 | #endif |
429 | mText += "<h2>" + date + "</h2>\n"; | 429 | mText += "<h2>" + date + "</h2>\n"; |
430 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 430 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
431 | mText += "<table>\n"; | 431 | mText += "<table>\n"; |
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | 435 | ||
436 | void KOWhatsNextView::showDates(const QDate &, const QDate &) | 436 | void KOWhatsNextView::showDates(const QDate &, const QDate &) |
437 | { | 437 | { |
438 | updateView(); | 438 | updateView(); |
439 | } | 439 | } |
440 | 440 | ||
441 | void KOWhatsNextView::showEvents(QPtrList<Event>) | 441 | void KOWhatsNextView::showEvents(QPtrList<Event>) |
442 | { | 442 | { |
443 | } | 443 | } |
444 | 444 | ||
445 | void KOWhatsNextView::changeEventDisplay(Event *, int action) | 445 | void KOWhatsNextView::changeEventDisplay(Event *, int action) |
446 | { | 446 | { |
447 | switch(action) { | 447 | switch(action) { |
448 | case KOGlobals::EVENTADDED: | 448 | case KOGlobals::EVENTADDED: |
449 | updateView(); | 449 | updateView(); |
450 | break; | 450 | break; |
451 | case KOGlobals::EVENTEDITED: | 451 | case KOGlobals::EVENTEDITED: |
452 | updateView(); | 452 | updateView(); |
453 | break; | 453 | break; |
454 | case KOGlobals::EVENTDELETED: | 454 | case KOGlobals::EVENTDELETED: |
455 | updateView(); | 455 | updateView(); |
456 | break; | 456 | break; |
457 | default: | 457 | default: |
458 | updateView(); | 458 | updateView(); |
459 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; | 459 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; |
460 | } | 460 | } |
461 | } | 461 | } |
462 | 462 | ||
463 | bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) | 463 | bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) |
464 | { | 464 | { |
465 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) | 465 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) |
466 | return false; | 466 | return false; |
467 | QDateTime cdt = QDateTime::currentDateTime(); | 467 | QDateTime cdt = QDateTime::currentDateTime(); |
468 | QDateTime noc; | 468 | QDateTime noc; |
469 | QString tempText; | 469 | QString tempText; |
470 | if ( appendTable && !notRed ) { | 470 | if ( appendTable && !notRed ) { |
471 | tempText = "<table>"; | 471 | tempText = "<table>"; |
472 | } | 472 | } |
473 | bool ok = true; | 473 | bool ok = true; |
474 | if ( reply ) { | 474 | if ( reply ) { |
475 | noc = ev->getNextOccurence( cdt, &ok ); | 475 | noc = ev->getNextOccurence( cdt, &ok ); |
476 | if (! ok && ev->type() == "Event") | 476 | if (! ok && ev->type() == "Event") |
477 | return false; | 477 | return false; |
478 | } | 478 | } |
479 | bool bDay = false; | ||
480 | if ( ev->categories().contains( i18n("Birthday") ) || ev->categories().contains( i18n("Anniversary") ) ) | ||
481 | bDay = true; | ||
479 | tempText += "<tr><td><b>"; | 482 | tempText += "<tr><td><b>"; |
480 | if (ev->type()=="Event") { | 483 | if (ev->type()=="Event") { |
481 | if (reply) { | 484 | if (reply) { |
482 | if (!ev->doesFloat()) | 485 | if (!ev->doesFloat()) |
483 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; | 486 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; |
484 | else | 487 | else |
485 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 488 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
486 | 489 | ||
487 | } else { | 490 | } else { |
488 | if (!ev->doesFloat()) { | 491 | if (!ev->doesFloat()) { |
489 | Event *event = static_cast<Event *>(ev); | 492 | Event *event = static_cast<Event *>(ev); |
490 | QDateTime st,end; | 493 | QDateTime st,end; |
491 | if ( event->recurrence()->doesRecur() ) { | 494 | if ( event->recurrence()->doesRecur() ) { |
492 | QDate recDate= mEventDate; | 495 | QDate recDate= mEventDate; |
493 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | 496 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); |
494 | while ( ! event->recursOn( recDate ) ) { | 497 | while ( ! event->recursOn( recDate ) ) { |
495 | recDate = recDate.addDays( -1 ); | 498 | recDate = recDate.addDays( -1 ); |
496 | 499 | ||
497 | } | 500 | } |
498 | st = QDateTime ( recDate, event->dtStart().time() ); | 501 | st = QDateTime ( recDate, event->dtStart().time() ); |
499 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); | 502 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); |
500 | } | 503 | } |
501 | else { | 504 | else { |
502 | st = event->dtStart(); | 505 | st = event->dtStart(); |
503 | end = event->dtEnd(); | 506 | end = event->dtEnd(); |
504 | } | 507 | } |
505 | 508 | ||
506 | 509 | ||
507 | QString dateText; | 510 | QString dateText; |
508 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); | 511 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); |
509 | if ( st.date() < mEventDate ) | 512 | if ( st.date() < mEventDate ) |
510 | dateText = "++:++-"; | 513 | dateText = "++:++-"; |
511 | else | 514 | else |
512 | dateText = event->dtStartTimeStr() + "-"; | 515 | dateText = event->dtStartTimeStr() + "-"; |
513 | if ( end.date() > mEventDate ) | 516 | if ( end.date() > mEventDate ) |
514 | dateText += "++:++"; | 517 | dateText += "++:++"; |
515 | else | 518 | else |
516 | dateText += event->dtEndTimeStr(); | 519 | dateText += event->dtEndTimeStr(); |
517 | if ( notRed ) | 520 | if ( notRed ) |
518 | tempText += dateText; | 521 | tempText += dateText; |
519 | else { | 522 | else { |
520 | if ( end < cdt ) { | 523 | if ( end < cdt ) { |
521 | if ( !KOPrefs::instance()->mWNViewShowsPast ) | 524 | if ( !KOPrefs::instance()->mWNViewShowsPast ) |
522 | return false; | 525 | return false; |
523 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; | 526 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; |
524 | } | 527 | } |
525 | else if ( st < cdt ) | 528 | else if ( st < cdt ) |
526 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; | 529 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; |
527 | else | 530 | else |
528 | tempText += dateText; | 531 | tempText += dateText; |
529 | 532 | ||
530 | } | 533 | } |
531 | 534 | ||
532 | } else { | 535 | } else { |
533 | tempText += i18n("Allday:"); | 536 | if ( bDay ) { |
537 | |||
538 | if ( ev->categories().contains( i18n("Birthday") )) | ||
539 | tempText += "<font color=\"#F00000\">" + i18n("Birthday") +":</font>"; | ||
540 | else | ||
541 | tempText += "<font color=\"#F00000\">" + i18n("Anniversary")+":</font>"; | ||
542 | } else { | ||
543 | tempText += i18n("Allday:"); | ||
544 | } | ||
534 | 545 | ||
535 | } | 546 | } |
536 | } | 547 | } |
537 | } else { | 548 | } else { |
538 | mTodos.append( ev ); | 549 | mTodos.append( ev ); |
539 | tempText += i18n("ToDo:"); | 550 | tempText += i18n("ToDo:"); |
540 | if (reply) { | 551 | if (reply) { |
541 | tempText += " "; | 552 | tempText += " "; |
542 | if ( noc != cdt ) { | 553 | if ( noc != cdt ) { |
543 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 554 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
544 | } | 555 | } |
545 | } else { | 556 | } else { |
546 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { | 557 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { |
547 | // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 558 | // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
548 | QString dfs = KGlobal::locale()->dateFormatShort(); | 559 | QString dfs = KGlobal::locale()->dateFormatShort(); |
549 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 560 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
550 | tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; | 561 | tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; |
551 | KGlobal::locale()->setDateFormatShort(dfs); | 562 | KGlobal::locale()->setDateFormatShort(dfs); |
552 | } else { | 563 | } else { |
553 | if (!ev->doesFloat() ) | 564 | if (!ev->doesFloat() ) |
554 | if( ( (Todo*)ev)->dtDue() < cdt ) { | 565 | if( ( (Todo*)ev)->dtDue() < cdt ) { |
555 | tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; | 566 | tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; |
556 | 567 | ||
557 | 568 | ||
558 | } else | 569 | } else |
559 | tempText +=((Todo*)ev)->dtDueTimeStr(); | 570 | tempText +=((Todo*)ev)->dtDueTimeStr(); |
560 | mTodos.append( ev ); | 571 | mTodos.append( ev ); |
561 | } | 572 | } |
562 | } | 573 | } |
563 | } | 574 | } |
564 | tempText += "</b></td><td>"; | 575 | tempText += "</b></td><td>"; |
565 | bool needClose = false; | 576 | bool needClose = false; |
566 | if ( ev->cancelled() ) { | 577 | if ( ev->cancelled() ) { |
567 | tempText += "<font color=\"#F00000\">[c"; | 578 | tempText += "<font color=\"#F00000\">[c"; |
568 | needClose =true; | 579 | needClose =true; |
569 | 580 | ||
570 | } | 581 | } |
571 | if ( ev->isAlarmEnabled() ) { | 582 | if ( ev->isAlarmEnabled() ) { |
572 | if ( !needClose) | 583 | if ( !needClose) |
573 | tempText +="["; | 584 | tempText +="["; |
574 | tempText += "a"; | 585 | tempText += "a"; |
575 | needClose =true; | 586 | needClose =true; |
576 | 587 | ||
577 | } | 588 | } |
578 | if ( ev->description().length() > 0 ) { | 589 | if ( ev->description().length() > 0 ) { |
579 | if ( !needClose) | 590 | if ( !needClose) |
580 | tempText +="["; | 591 | tempText +="["; |
581 | tempText += "i"; | 592 | tempText += "i"; |
582 | needClose =true; | 593 | needClose =true; |
583 | } | 594 | } |
584 | if ( ev->recurrence()->doesRecur() ) { | 595 | if ( ev->recurrence()->doesRecur() ) { |
585 | if ( !needClose) | 596 | if ( !needClose) |
586 | tempText +="["; | 597 | tempText +="["; |
587 | tempText += "r"; | 598 | tempText += "r"; |
588 | needClose =true; | 599 | needClose =true; |
589 | } | 600 | } |
590 | if ( needClose ) { | 601 | if ( needClose ) { |
591 | tempText += "] "; | 602 | tempText += "] "; |
592 | } | 603 | } |
593 | if ( ev->cancelled() ) | 604 | if ( ev->cancelled() ) |
594 | tempText += "</font>"; | 605 | tempText += "</font>"; |
595 | tempText += "<a "; | 606 | tempText += "<a "; |
596 | if (ev->type()=="Event") tempText += "href=\"event:"; | 607 | if (ev->type()=="Event") tempText += "href=\"event:"; |
597 | if (ev->type()=="Todo") tempText += "href=\"todo:"; | 608 | if (ev->type()=="Todo") tempText += "href=\"todo:"; |
598 | tempText += ev->uid() + "\">"; | 609 | tempText += ev->uid() + "\">"; |
599 | if ( ev->summary().length() > 0 ) | 610 | if ( ev->summary().length() > 0 ) |
600 | tempText += ev->summary(); | 611 | tempText += ev->summary(); |
601 | else | 612 | else |
602 | tempText += i18n("-no summary-"); | 613 | tempText += i18n("-no summary-"); |
603 | if ( ev->categories().contains( i18n("Birthday") ) || ev->categories().contains( i18n("Anniversary") ) ) { | 614 | if ( bDay ) { |
604 | noc = ev->getNextOccurence( cdt, &ok ); | 615 | noc = ev->getNextOccurence( cdt, &ok ); |
605 | if ( ok ) { | 616 | if ( ok ) { |
606 | int years = noc.date().year() - ev->dtStart().date().year(); | 617 | int years = noc.date().year() - ev->dtStart().date().year(); |
607 | tempText += i18n(" (%1 y.)"). arg( years ); | 618 | tempText += i18n(" (%1 y.)"). arg( years ); |
608 | } | 619 | } |
609 | } | 620 | } |
610 | 621 | ||
611 | tempText += "</a>"; | 622 | tempText += "</a>"; |
612 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 623 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
613 | if ( !ev->location().isEmpty() ) | 624 | if ( !ev->location().isEmpty() ) |
614 | tempText += " ("+ev->location() +")"; | 625 | tempText += " ("+ev->location() +")"; |
615 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) | 626 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) |
616 | tempText += " ["+ev->relatedTo()->summary() +"]"; | 627 | tempText += " ["+ev->relatedTo()->summary() +"]"; |
617 | tempText += "</td></tr>\n"; | 628 | tempText += "</td></tr>\n"; |
618 | mText += tempText; | 629 | mText += tempText; |
619 | return true; | 630 | return true; |
620 | } | 631 | } |
621 | 632 | ||
622 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) | 633 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) |
623 | { | 634 | { |
624 | if ( mTodos.find( ev ) != mTodos.end() ) return false; | 635 | if ( mTodos.find( ev ) != mTodos.end() ) return false; |
625 | 636 | ||
626 | mTodos.append( ev ); | 637 | mTodos.append( ev ); |
627 | if ( !isSub ) | 638 | if ( !isSub ) |
628 | mText += "<p>"; | 639 | mText += "<p>"; |
629 | else | 640 | else |
630 | mText += "<li>"; | 641 | mText += "<li>"; |
631 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; | 642 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; |
632 | 643 | ||
633 | 644 | ||
634 | mText += ind; | 645 | mText += ind; |
635 | bool needClose = false; | 646 | bool needClose = false; |
636 | if ( ev->cancelled() ) { | 647 | if ( ev->cancelled() ) { |
637 | mText += "<font color=\"#F00000\">[c"; | 648 | mText += "<font color=\"#F00000\">[c"; |
638 | needClose =true; | 649 | needClose =true; |
639 | 650 | ||
640 | } | 651 | } |
641 | if ( ev->isAlarmEnabled() ) { | 652 | if ( ev->isAlarmEnabled() ) { |
642 | if ( !needClose) | 653 | if ( !needClose) |
643 | mText +="["; | 654 | mText +="["; |
644 | mText += "a"; | 655 | mText += "a"; |
645 | needClose =true; | 656 | needClose =true; |
646 | 657 | ||
647 | } | 658 | } |
648 | 659 | ||
649 | if ( ev->description().length() > 0 ) { | 660 | if ( ev->description().length() > 0 ) { |
650 | if ( !needClose) | 661 | if ( !needClose) |
651 | mText +="["; | 662 | mText +="["; |
652 | mText += "i"; | 663 | mText += "i"; |
653 | needClose =true; | 664 | needClose =true; |
654 | } | 665 | } |
655 | // if ( ev->recurrence()->doesRecur() ) { | 666 | // if ( ev->recurrence()->doesRecur() ) { |
656 | // if ( !needClose) | 667 | // if ( !needClose) |
657 | // mText +="("; | 668 | // mText +="("; |
658 | // mText += "r"; | 669 | // mText += "r"; |
659 | // needClose =true; | 670 | // needClose =true; |
660 | // } | 671 | // } |
661 | if ( needClose ) | 672 | if ( needClose ) |
662 | mText += "] "; | 673 | mText += "] "; |
663 | if ( ev->cancelled() ) | 674 | if ( ev->cancelled() ) |
664 | mText += "</font>"; | 675 | mText += "</font>"; |
665 | mText += "<a href=\"todo:" + ev->uid() + "\">"; | 676 | mText += "<a href=\"todo:" + ev->uid() + "\">"; |
666 | if ( ev->summary().length() > 0 ) | 677 | if ( ev->summary().length() > 0 ) |
667 | mText += ev->summary(); | 678 | mText += ev->summary(); |
668 | else | 679 | else |
669 | mText += i18n("-no summary-"); | 680 | mText += i18n("-no summary-"); |
670 | mText += "</a>"; | 681 | mText += "</a>"; |
671 | if ( ((Todo*)ev)->hasDueDate () ) { | 682 | if ( ((Todo*)ev)->hasDueDate () ) { |
672 | QString year = ""; | 683 | QString year = ""; |
673 | int ye = ((Todo*)ev)->dtDue().date().year(); | 684 | int ye = ((Todo*)ev)->dtDue().date().year(); |
674 | if ( QDateTime::currentDateTime().date().year() != ye ) | 685 | if ( QDateTime::currentDateTime().date().year() != ye ) |
675 | year = QString::number( ye ); | 686 | year = QString::number( ye ); |
676 | QString dfs = KGlobal::locale()->dateFormatShort(); | 687 | QString dfs = KGlobal::locale()->dateFormatShort(); |
677 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 688 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
678 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; | 689 | mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; |
679 | KGlobal::locale()->setDateFormatShort(dfs); | 690 | KGlobal::locale()->setDateFormatShort(dfs); |
680 | } | 691 | } |
681 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 692 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
682 | if ( !ev->location().isEmpty() ) | 693 | if ( !ev->location().isEmpty() ) |
683 | mText += " ("+ev->location() +")"; | 694 | mText += " ("+ev->location() +")"; |
684 | if ( !isSub ) { | 695 | if ( !isSub ) { |
685 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) | 696 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) |
686 | mText += " ["+ev->relatedTo()->summary() +"]"; | 697 | mText += " ["+ev->relatedTo()->summary() +"]"; |
687 | mText += "</p>\n"; | 698 | mText += "</p>\n"; |
688 | } | 699 | } |
689 | else { | 700 | else { |
690 | ind += "-"; | 701 | ind += "-"; |
691 | mText += "</li>\n"; | 702 | mText += "</li>\n"; |
692 | } | 703 | } |
693 | QPtrList<Incidence> Relations = ev->relations(); | 704 | QPtrList<Incidence> Relations = ev->relations(); |
694 | Incidence *to; | 705 | Incidence *to; |
695 | for (to=Relations.first();to;to=Relations.next()) { | 706 | for (to=Relations.first();to;to=Relations.next()) { |
696 | if (!((Todo*)to)->isCompleted()) | 707 | if (!((Todo*)to)->isCompleted()) |
697 | appendTodo( to, ind , true ); | 708 | appendTodo( to, ind , true ); |
698 | } | 709 | } |
699 | 710 | ||
700 | return true; | 711 | return true; |
701 | } | 712 | } |
702 | 713 | ||
703 | /* | 714 | /* |
704 | void KOWhatsNextView::createEventViewer() | 715 | void KOWhatsNextView::createEventViewer() |
705 | { | 716 | { |
706 | if (!mEventViewer) { | 717 | if (!mEventViewer) { |
707 | 718 | ||
708 | mEventViewer = new KOEventViewerDialog(this); | 719 | mEventViewer = new KOEventViewerDialog(this); |
709 | } | 720 | } |
710 | } | 721 | } |
711 | */ | 722 | */ |
712 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) | 723 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) |
713 | { | 724 | { |
714 | mEventViewer = v; | 725 | mEventViewer = v; |
715 | } | 726 | } |
716 | 727 | ||
717 | // TODO: Create this function in CalendarView and remove it from here | 728 | // TODO: Create this function in CalendarView and remove it from here |
718 | void KOWhatsNextView::showIncidence(const QString &uid) | 729 | void KOWhatsNextView::showIncidence(const QString &uid) |
719 | { | 730 | { |
720 | 731 | ||
721 | if ( !mEventViewer ) { | 732 | if ( !mEventViewer ) { |
722 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); | 733 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); |
723 | return; | 734 | return; |
724 | } | 735 | } |
725 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; | 736 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; |
726 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); | 737 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); |
727 | if (uid.startsWith("event:")) { | 738 | if (uid.startsWith("event:")) { |
728 | #ifdef DESKTOP_VERSION | 739 | #ifdef DESKTOP_VERSION |
729 | Event *event = calendar()->event(uid.mid(8)); | 740 | Event *event = calendar()->event(uid.mid(8)); |
730 | #else | 741 | #else |
731 | Event *event = calendar()->event(uid.mid(6)); | 742 | Event *event = calendar()->event(uid.mid(6)); |
732 | #endif | 743 | #endif |
733 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); | 744 | //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); |
734 | if (!event) return; | 745 | if (!event) return; |
735 | //createEventViewer(); | 746 | //createEventViewer(); |
736 | mEventViewer->setEvent(event); | 747 | mEventViewer->setEvent(event); |
737 | } else if (uid.startsWith("todo:")) { | 748 | } else if (uid.startsWith("todo:")) { |
738 | #ifdef DESKTOP_VERSION | 749 | #ifdef DESKTOP_VERSION |
739 | Todo *todo = calendar()->todo(uid.mid(7)); | 750 | Todo *todo = calendar()->todo(uid.mid(7)); |
740 | #else | 751 | #else |
741 | Todo *todo = calendar()->todo(uid.mid(5)); | 752 | Todo *todo = calendar()->todo(uid.mid(5)); |
742 | #endif | 753 | #endif |
743 | if (!todo) return; | 754 | if (!todo) return; |
744 | //createEventViewer(); | 755 | //createEventViewer(); |
745 | mEventViewer->setTodo(todo); | 756 | mEventViewer->setTodo(todo); |
746 | } else { | 757 | } else { |
747 | return; | 758 | return; |
748 | 759 | ||
749 | } | 760 | } |
750 | mEventViewer->showMe(); | 761 | mEventViewer->showMe(); |
751 | mEventViewer->raise(); | 762 | mEventViewer->raise(); |
752 | } | 763 | } |