-rw-r--r-- | korganizer/kowhatsnextview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 57623e6..d7ff9f2 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -487,257 +487,257 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
487 | else | 487 | else |
488 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 488 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
489 | 489 | ||
490 | } else { | 490 | } else { |
491 | if (!ev->doesFloat()) { | 491 | if (!ev->doesFloat()) { |
492 | Event *event = static_cast<Event *>(ev); | 492 | Event *event = static_cast<Event *>(ev); |
493 | QDateTime st,end; | 493 | QDateTime st,end; |
494 | if ( event->recurrence()->doesRecur() ) { | 494 | if ( event->recurrence()->doesRecur() ) { |
495 | QDate recDate= mEventDate; | 495 | QDate recDate= mEventDate; |
496 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | 496 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); |
497 | while ( ! event->recursOn( recDate ) ) { | 497 | while ( ! event->recursOn( recDate ) ) { |
498 | recDate = recDate.addDays( -1 ); | 498 | recDate = recDate.addDays( -1 ); |
499 | 499 | ||
500 | } | 500 | } |
501 | st = QDateTime ( recDate, event->dtStart().time() ); | 501 | st = QDateTime ( recDate, event->dtStart().time() ); |
502 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); | 502 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); |
503 | } | 503 | } |
504 | else { | 504 | else { |
505 | st = event->dtStart(); | 505 | st = event->dtStart(); |
506 | end = event->dtEnd(); | 506 | end = event->dtEnd(); |
507 | } | 507 | } |
508 | 508 | ||
509 | 509 | ||
510 | QString dateText; | 510 | QString dateText; |
511 | // 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() ); |
512 | if ( st.date() < mEventDate ) | 512 | if ( st.date() < mEventDate ) |
513 | dateText = "++:++-"; | 513 | dateText = "++:++-"; |
514 | else | 514 | else |
515 | dateText = event->dtStartTimeStr() + "-"; | 515 | dateText = event->dtStartTimeStr() + "-"; |
516 | if ( end.date() > mEventDate ) | 516 | if ( end.date() > mEventDate ) |
517 | dateText += "++:++"; | 517 | dateText += "++:++"; |
518 | else | 518 | else |
519 | dateText += event->dtEndTimeStr(); | 519 | dateText += event->dtEndTimeStr(); |
520 | if ( notRed ) | 520 | if ( notRed ) |
521 | tempText += dateText; | 521 | tempText += dateText; |
522 | else { | 522 | else { |
523 | if ( end < cdt ) { | 523 | if ( end < cdt ) { |
524 | if ( !KOPrefs::instance()->mWNViewShowsPast ) | 524 | if ( !KOPrefs::instance()->mWNViewShowsPast ) |
525 | return false; | 525 | return false; |
526 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; | 526 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; |
527 | } | 527 | } |
528 | else if ( st < cdt ) | 528 | else if ( st < cdt ) |
529 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; | 529 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; |
530 | else | 530 | else |
531 | tempText += dateText; | 531 | tempText += dateText; |
532 | 532 | ||
533 | } | 533 | } |
534 | 534 | ||
535 | } else { | 535 | } else { |
536 | if ( bDay ) { | 536 | if ( bDay ) { |
537 | 537 | ||
538 | if ( ev->categories().contains( i18n("Birthday") )) | 538 | if ( ev->categories().contains( i18n("Birthday") )) |
539 | tempText += "<font color=\"#F00000\">" + i18n("Birthday") +":</font>"; | 539 | tempText += "<font color=\"#F00000\">" + i18n("Birthday") +":</font>"; |
540 | else | 540 | else |
541 | tempText += "<font color=\"#F00000\">" + i18n("Anniversary")+":</font>"; | 541 | tempText += "<font color=\"#F00000\">" + i18n("Anniversary")+":</font>"; |
542 | } else { | 542 | } else { |
543 | tempText += i18n("Allday:"); | 543 | tempText += i18n("Allday:"); |
544 | } | 544 | } |
545 | 545 | ||
546 | } | 546 | } |
547 | } | 547 | } |
548 | } else { | 548 | } else { |
549 | mTodos.append( ev ); | 549 | mTodos.append( ev ); |
550 | tempText += i18n("ToDo:"); | 550 | tempText += i18n("ToDo:"); |
551 | if (reply) { | 551 | if (reply) { |
552 | tempText += " "; | 552 | tempText += " "; |
553 | if ( noc != cdt ) { | 553 | if ( noc != cdt ) { |
554 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 554 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
555 | } | 555 | } |
556 | } else { | 556 | } else { |
557 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { | 557 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { |
558 | // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 558 | // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
559 | QString dfs = KGlobal::locale()->dateFormatShort(); | 559 | QString dfs = KGlobal::locale()->dateFormatShort(); |
560 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 560 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
561 | 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>"; |
562 | KGlobal::locale()->setDateFormatShort(dfs); | 562 | KGlobal::locale()->setDateFormatShort(dfs); |
563 | } else { | 563 | } else { |
564 | if (!ev->doesFloat() ) | 564 | if (!ev->doesFloat() ) |
565 | if( ( (Todo*)ev)->dtDue() < cdt ) { | 565 | if( ( (Todo*)ev)->dtDue() < cdt ) { |
566 | tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; | 566 | tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; |
567 | 567 | ||
568 | 568 | ||
569 | } else | 569 | } else |
570 | tempText +=((Todo*)ev)->dtDueTimeStr(); | 570 | tempText +=((Todo*)ev)->dtDueTimeStr(); |
571 | mTodos.append( ev ); | 571 | mTodos.append( ev ); |
572 | } | 572 | } |
573 | } | 573 | } |
574 | } | 574 | } |
575 | tempText += "</b></td><td>"; | 575 | tempText += "</b></td><td>"; |
576 | bool needClose = false; | 576 | bool needClose = false; |
577 | if ( ev->cancelled() ) { | 577 | if ( ev->cancelled() ) { |
578 | tempText += "<font color=\"#F00000\">[c"; | 578 | tempText += "<font color=\"#F00000\">[c"; |
579 | needClose =true; | 579 | needClose =true; |
580 | 580 | ||
581 | } | 581 | } |
582 | if ( ev->isAlarmEnabled() ) { | 582 | if ( ev->isAlarmEnabled() ) { |
583 | if ( !needClose) | 583 | if ( !needClose) |
584 | tempText +="["; | 584 | tempText +="["; |
585 | tempText += "a"; | 585 | tempText += "a"; |
586 | needClose =true; | 586 | needClose =true; |
587 | 587 | ||
588 | } | 588 | } |
589 | if ( ev->description().length() > 0 ) { | 589 | if ( ev->description().length() > 0 ) { |
590 | if ( !needClose) | 590 | if ( !needClose) |
591 | tempText +="["; | 591 | tempText +="["; |
592 | tempText += "i"; | 592 | tempText += "i"; |
593 | needClose =true; | 593 | needClose =true; |
594 | } | 594 | } |
595 | if ( ev->recurrence()->doesRecur() ) { | 595 | if ( ev->recurrence()->doesRecur() ) { |
596 | if ( !needClose) | 596 | if ( !needClose) |
597 | tempText +="["; | 597 | tempText +="["; |
598 | tempText += "r"; | 598 | tempText += "r"; |
599 | needClose =true; | 599 | needClose =true; |
600 | } | 600 | } |
601 | if ( needClose ) { | 601 | if ( needClose ) { |
602 | tempText += "] "; | 602 | tempText += "] "; |
603 | } | 603 | } |
604 | if ( ev->cancelled() ) | 604 | if ( ev->cancelled() ) |
605 | tempText += "</font>"; | 605 | tempText += "</font>"; |
606 | tempText += "<a "; | 606 | tempText += "<a "; |
607 | if (ev->type()=="Event") tempText += "href=\"event:"; | 607 | if (ev->type()=="Event") tempText += "href=\"event:"; |
608 | if (ev->type()=="Todo") tempText += "href=\"todo:"; | 608 | if (ev->type()=="Todo") tempText += "href=\"todo:"; |
609 | tempText += ev->uid() + "\">"; | 609 | tempText += ev->uid() + "\">"; |
610 | if ( ev->summary().length() > 0 ) | 610 | if ( ev->summary().length() > 0 ) |
611 | tempText += ev->summary(); | 611 | tempText += ev->summary(); |
612 | else | 612 | else |
613 | tempText += i18n("-no summary-"); | 613 | tempText += i18n("-no summary-"); |
614 | if ( bDay ) { | 614 | if ( bDay ) { |
615 | noc = ev->getNextOccurence( cdt, &ok ); | 615 | noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); |
616 | if ( ok ) { | 616 | if ( ok ) { |
617 | int years = noc.date().year() - ev->dtStart().date().year(); | 617 | int years = noc.date().year() - ev->dtStart().date().year(); |
618 | tempText += i18n(" (%1 y.)"). arg( years ); | 618 | tempText += i18n(" (%1 y.)"). arg( years ); |
619 | } | 619 | } |
620 | } | 620 | } |
621 | 621 | ||
622 | tempText += "</a>"; | 622 | tempText += "</a>"; |
623 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 623 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
624 | if ( !ev->location().isEmpty() ) | 624 | if ( !ev->location().isEmpty() ) |
625 | tempText += " ("+ev->location() +")"; | 625 | tempText += " ("+ev->location() +")"; |
626 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) | 626 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) |
627 | tempText += " ["+ev->relatedTo()->summary() +"]"; | 627 | tempText += " ["+ev->relatedTo()->summary() +"]"; |
628 | tempText += "</td></tr>\n"; | 628 | tempText += "</td></tr>\n"; |
629 | mText += tempText; | 629 | mText += tempText; |
630 | return true; | 630 | return true; |
631 | } | 631 | } |
632 | 632 | ||
633 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) | 633 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) |
634 | { | 634 | { |
635 | if ( mTodos.find( ev ) != mTodos.end() ) return false; | 635 | if ( mTodos.find( ev ) != mTodos.end() ) return false; |
636 | 636 | ||
637 | mTodos.append( ev ); | 637 | mTodos.append( ev ); |
638 | if ( !isSub ) | 638 | if ( !isSub ) |
639 | mText += "<p>"; | 639 | mText += "<p>"; |
640 | else | 640 | else |
641 | mText += "<li>"; | 641 | mText += "<li>"; |
642 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; | 642 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; |
643 | 643 | ||
644 | 644 | ||
645 | mText += ind; | 645 | mText += ind; |
646 | bool needClose = false; | 646 | bool needClose = false; |
647 | if ( ev->cancelled() ) { | 647 | if ( ev->cancelled() ) { |
648 | mText += "<font color=\"#F00000\">[c"; | 648 | mText += "<font color=\"#F00000\">[c"; |
649 | needClose =true; | 649 | needClose =true; |
650 | 650 | ||
651 | } | 651 | } |
652 | if ( ev->isAlarmEnabled() ) { | 652 | if ( ev->isAlarmEnabled() ) { |
653 | if ( !needClose) | 653 | if ( !needClose) |
654 | mText +="["; | 654 | mText +="["; |
655 | mText += "a"; | 655 | mText += "a"; |
656 | needClose =true; | 656 | needClose =true; |
657 | 657 | ||
658 | } | 658 | } |
659 | 659 | ||
660 | if ( ev->description().length() > 0 ) { | 660 | if ( ev->description().length() > 0 ) { |
661 | if ( !needClose) | 661 | if ( !needClose) |
662 | mText +="["; | 662 | mText +="["; |
663 | mText += "i"; | 663 | mText += "i"; |
664 | needClose =true; | 664 | needClose =true; |
665 | } | 665 | } |
666 | // if ( ev->recurrence()->doesRecur() ) { | 666 | // if ( ev->recurrence()->doesRecur() ) { |
667 | // if ( !needClose) | 667 | // if ( !needClose) |
668 | // mText +="("; | 668 | // mText +="("; |
669 | // mText += "r"; | 669 | // mText += "r"; |
670 | // needClose =true; | 670 | // needClose =true; |
671 | // } | 671 | // } |
672 | if ( needClose ) | 672 | if ( needClose ) |
673 | mText += "] "; | 673 | mText += "] "; |
674 | if ( ev->cancelled() ) | 674 | if ( ev->cancelled() ) |
675 | mText += "</font>"; | 675 | mText += "</font>"; |
676 | mText += "<a href=\"todo:" + ev->uid() + "\">"; | 676 | mText += "<a href=\"todo:" + ev->uid() + "\">"; |
677 | if ( ev->summary().length() > 0 ) | 677 | if ( ev->summary().length() > 0 ) |
678 | mText += ev->summary(); | 678 | mText += ev->summary(); |
679 | else | 679 | else |
680 | mText += i18n("-no summary-"); | 680 | mText += i18n("-no summary-"); |
681 | mText += "</a>"; | 681 | mText += "</a>"; |
682 | if ( ((Todo*)ev)->hasDueDate () ) { | 682 | if ( ((Todo*)ev)->hasDueDate () ) { |
683 | QString year = ""; | 683 | QString year = ""; |
684 | int ye = ((Todo*)ev)->dtDue().date().year(); | 684 | int ye = ((Todo*)ev)->dtDue().date().year(); |
685 | if ( QDateTime::currentDateTime().date().year() != ye ) | 685 | if ( QDateTime::currentDateTime().date().year() != ye ) |
686 | year = QString::number( ye ); | 686 | year = QString::number( ye ); |
687 | QString dfs = KGlobal::locale()->dateFormatShort(); | 687 | QString dfs = KGlobal::locale()->dateFormatShort(); |
688 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 688 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
689 | 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>"; |
690 | KGlobal::locale()->setDateFormatShort(dfs); | 690 | KGlobal::locale()->setDateFormatShort(dfs); |
691 | } | 691 | } |
692 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 692 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
693 | if ( !ev->location().isEmpty() ) | 693 | if ( !ev->location().isEmpty() ) |
694 | mText += " ("+ev->location() +")"; | 694 | mText += " ("+ev->location() +")"; |
695 | if ( !isSub ) { | 695 | if ( !isSub ) { |
696 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) | 696 | if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) |
697 | mText += " ["+ev->relatedTo()->summary() +"]"; | 697 | mText += " ["+ev->relatedTo()->summary() +"]"; |
698 | mText += "</p>\n"; | 698 | mText += "</p>\n"; |
699 | } | 699 | } |
700 | else { | 700 | else { |
701 | ind += "-"; | 701 | ind += "-"; |
702 | mText += "</li>\n"; | 702 | mText += "</li>\n"; |
703 | } | 703 | } |
704 | QPtrList<Incidence> Relations = ev->relations(); | 704 | QPtrList<Incidence> Relations = ev->relations(); |
705 | Incidence *to; | 705 | Incidence *to; |
706 | for (to=Relations.first();to;to=Relations.next()) { | 706 | for (to=Relations.first();to;to=Relations.next()) { |
707 | if (!((Todo*)to)->isCompleted()) | 707 | if (!((Todo*)to)->isCompleted()) |
708 | appendTodo( to, ind , true ); | 708 | appendTodo( to, ind , true ); |
709 | } | 709 | } |
710 | 710 | ||
711 | return true; | 711 | return true; |
712 | } | 712 | } |
713 | 713 | ||
714 | /* | 714 | /* |
715 | void KOWhatsNextView::createEventViewer() | 715 | void KOWhatsNextView::createEventViewer() |
716 | { | 716 | { |
717 | if (!mEventViewer) { | 717 | if (!mEventViewer) { |
718 | 718 | ||
719 | mEventViewer = new KOEventViewerDialog(this); | 719 | mEventViewer = new KOEventViewerDialog(this); |
720 | } | 720 | } |
721 | } | 721 | } |
722 | */ | 722 | */ |
723 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) | 723 | void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) |
724 | { | 724 | { |
725 | mEventViewer = v; | 725 | mEventViewer = v; |
726 | } | 726 | } |
727 | 727 | ||
728 | // TODO: Create this function in CalendarView and remove it from here | 728 | // TODO: Create this function in CalendarView and remove it from here |
729 | void KOWhatsNextView::showIncidence(const QString &uid) | 729 | void KOWhatsNextView::showIncidence(const QString &uid) |
730 | { | 730 | { |
731 | 731 | ||
732 | if ( !mEventViewer ) { | 732 | if ( !mEventViewer ) { |
733 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); | 733 | qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); |
734 | return; | 734 | return; |
735 | } | 735 | } |
736 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; | 736 | //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; |
737 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); | 737 | //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); |
738 | if (uid.startsWith("event:")) { | 738 | if (uid.startsWith("event:")) { |
739 | #ifdef DESKTOP_VERSION | 739 | #ifdef DESKTOP_VERSION |
740 | Event *event = calendar()->event(uid.mid(8)); | 740 | Event *event = calendar()->event(uid.mid(8)); |
741 | #else | 741 | #else |
742 | Event *event = calendar()->event(uid.mid(6)); | 742 | Event *event = calendar()->event(uid.mid(6)); |
743 | #endif | 743 | #endif |