-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 | |||
@@ -455,48 +455,51 @@ void KOWhatsNextView::changeEventDisplay(Event *, int action) | |||
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(); |
@@ -509,49 +512,57 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
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 | ||
@@ -579,49 +590,49 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
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 ) |