summaryrefslogtreecommitdiffabout
path: root/korganizer/kowhatsnextview.cpp
Unidiff
Diffstat (limited to 'korganizer/kowhatsnextview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kowhatsnextview.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 7166a01..4111c5d 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -555,152 +555,163 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
555 tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; 555 tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
556 556
557 557
558 } else 558 } else
559 tempText +=((Todo*)ev)->dtDueTimeStr(); 559 tempText +=((Todo*)ev)->dtDueTimeStr();
560 mTodos.append( ev ); 560 mTodos.append( ev );
561 } 561 }
562 } 562 }
563 } 563 }
564 tempText += "</b></td><td>"; 564 tempText += "</b></td><td>";
565 bool needClose = false; 565 bool needClose = false;
566 if ( ev->cancelled() ) { 566 if ( ev->cancelled() ) {
567 tempText += "<font color=\"#F00000\">[c"; 567 tempText += "<font color=\"#F00000\">[c";
568 needClose =true; 568 needClose =true;
569 569
570 } 570 }
571 if ( ev->isAlarmEnabled() ) { 571 if ( ev->isAlarmEnabled() ) {
572 if ( !needClose) 572 if ( !needClose)
573 tempText +="["; 573 tempText +="[";
574 tempText += "a"; 574 tempText += "a";
575 needClose =true; 575 needClose =true;
576 576
577 } 577 }
578 if ( ev->description().length() > 0 ) { 578 if ( ev->description().length() > 0 ) {
579 if ( !needClose) 579 if ( !needClose)
580 tempText +="["; 580 tempText +="[";
581 tempText += "i"; 581 tempText += "i";
582 needClose =true; 582 needClose =true;
583 } 583 }
584 if ( ev->recurrence()->doesRecur() ) { 584 if ( ev->recurrence()->doesRecur() ) {
585 if ( !needClose) 585 if ( !needClose)
586 tempText +="["; 586 tempText +="[";
587 tempText += "r"; 587 tempText += "r";
588 needClose =true; 588 needClose =true;
589 } 589 }
590 if ( needClose ) { 590 if ( needClose ) {
591 tempText += "] "; 591 tempText += "] ";
592 } 592 }
593 if ( ev->cancelled() ) 593 if ( ev->cancelled() )
594 tempText += "</font>"; 594 tempText += "</font>";
595 tempText += "<a "; 595 tempText += "<a ";
596 if (ev->type()=="Event") tempText += "href=\"event:"; 596 if (ev->type()=="Event") tempText += "href=\"event:";
597 if (ev->type()=="Todo") tempText += "href=\"todo:"; 597 if (ev->type()=="Todo") tempText += "href=\"todo:";
598 tempText += ev->uid() + "\">"; 598 tempText += ev->uid() + "\">";
599 if ( ev->summary().length() > 0 ) 599 if ( ev->summary().length() > 0 )
600 tempText += ev->summary(); 600 tempText += ev->summary();
601 else 601 else
602 tempText += i18n("-no summary-"); 602 tempText += i18n("-no summary-");
603 if ( ev->categories().contains( i18n("Birthday") ) || ev->categories().contains( i18n("Anniversary") ) ) {
604 noc = ev->getNextOccurence( cdt, &ok );
605 if ( ok ) {
606 int years = noc.date().year() - ev->dtStart().date().year();
607 tempText += i18n(" (%1 y.)"). arg( years );
608 }
609 }
610
603 tempText += "</a>"; 611 tempText += "</a>";
604 if ( KOPrefs::instance()->mWNViewShowLocation ) 612 if ( KOPrefs::instance()->mWNViewShowLocation )
605 if ( !ev->location().isEmpty() ) 613 if ( !ev->location().isEmpty() )
606 tempText += " ("+ev->location() +")"; 614 tempText += " ("+ev->location() +")";
607 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) 615 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
608 tempText += " ["+ev->relatedTo()->summary() +"]"; 616 tempText += " ["+ev->relatedTo()->summary() +"]";
609 tempText += "</td></tr>\n"; 617 tempText += "</td></tr>\n";
610 mText += tempText; 618 mText += tempText;
611 return true; 619 return true;
612} 620}
613 621
614bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) 622bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
615{ 623{
616 if ( mTodos.find( ev ) != mTodos.end() ) return false; 624 if ( mTodos.find( ev ) != mTodos.end() ) return false;
617 625
618 mTodos.append( ev ); 626 mTodos.append( ev );
619 if ( !isSub ) 627 if ( !isSub )
620 mText += "<p>"; 628 mText += "<p>";
621 else 629 else
622 mText += "<li>"; 630 mText += "<li>";
623 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; 631 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] ";
624 632
625 633
626 mText += ind; 634 mText += ind;
627 bool needClose = false; 635 bool needClose = false;
628 if ( ev->cancelled() ) { 636 if ( ev->cancelled() ) {
629 mText += "<font color=\"#F00000\">[c"; 637 mText += "<font color=\"#F00000\">[c";
630 needClose =true; 638 needClose =true;
631 639
632 } 640 }
633 if ( ev->isAlarmEnabled() ) { 641 if ( ev->isAlarmEnabled() ) {
634 if ( !needClose) 642 if ( !needClose)
635 mText +="["; 643 mText +="[";
636 mText += "a"; 644 mText += "a";
637 needClose =true; 645 needClose =true;
638 646
639 } 647 }
640 648
641 if ( ev->description().length() > 0 ) { 649 if ( ev->description().length() > 0 ) {
642 if ( !needClose) 650 if ( !needClose)
643 mText +="["; 651 mText +="[";
644 mText += "i"; 652 mText += "i";
645 needClose =true; 653 needClose =true;
646 } 654 }
647 // if ( ev->recurrence()->doesRecur() ) { 655 // if ( ev->recurrence()->doesRecur() ) {
648 // if ( !needClose) 656 // if ( !needClose)
649 // mText +="("; 657 // mText +="(";
650 // mText += "r"; 658 // mText += "r";
651 // needClose =true; 659 // needClose =true;
652 // } 660 // }
653 if ( needClose ) 661 if ( needClose )
654 mText += "] "; 662 mText += "] ";
655 if ( ev->cancelled() ) 663 if ( ev->cancelled() )
656 mText += "</font>"; 664 mText += "</font>";
657 mText += "<a href=\"todo:" + ev->uid() + "\">"; 665 mText += "<a href=\"todo:" + ev->uid() + "\">";
666 if ( ev->summary().length() > 0 )
658 mText += ev->summary(); 667 mText += ev->summary();
668 else
669 mText += i18n("-no summary-");
659 mText += "</a>"; 670 mText += "</a>";
660 if ( ((Todo*)ev)->hasDueDate () ) { 671 if ( ((Todo*)ev)->hasDueDate () ) {
661 QString year = ""; 672 QString year = "";
662 int ye = ((Todo*)ev)->dtDue().date().year(); 673 int ye = ((Todo*)ev)->dtDue().date().year();
663 if ( QDateTime::currentDateTime().date().year() != ye ) 674 if ( QDateTime::currentDateTime().date().year() != ye )
664 year = QString::number( ye ); 675 year = QString::number( ye );
665 QString dfs = KGlobal::locale()->dateFormatShort(); 676 QString dfs = KGlobal::locale()->dateFormatShort();
666 KGlobal::locale()->setDateFormatShort("%d.%b"); 677 KGlobal::locale()->setDateFormatShort("%d.%b");
667 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; 678 mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
668 KGlobal::locale()->setDateFormatShort(dfs); 679 KGlobal::locale()->setDateFormatShort(dfs);
669 } 680 }
670 if ( KOPrefs::instance()->mWNViewShowLocation ) 681 if ( KOPrefs::instance()->mWNViewShowLocation )
671 if ( !ev->location().isEmpty() ) 682 if ( !ev->location().isEmpty() )
672 mText += " ("+ev->location() +")"; 683 mText += " ("+ev->location() +")";
673 if ( !isSub ) { 684 if ( !isSub ) {
674 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) 685 if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents)
675 mText += " ["+ev->relatedTo()->summary() +"]"; 686 mText += " ["+ev->relatedTo()->summary() +"]";
676 mText += "</p>\n"; 687 mText += "</p>\n";
677 } 688 }
678 else { 689 else {
679 ind += "-"; 690 ind += "-";
680 mText += "</li>\n"; 691 mText += "</li>\n";
681 } 692 }
682 QPtrList<Incidence> Relations = ev->relations(); 693 QPtrList<Incidence> Relations = ev->relations();
683 Incidence *to; 694 Incidence *to;
684 for (to=Relations.first();to;to=Relations.next()) { 695 for (to=Relations.first();to;to=Relations.next()) {
685 if (!((Todo*)to)->isCompleted()) 696 if (!((Todo*)to)->isCompleted())
686 appendTodo( to, ind , true ); 697 appendTodo( to, ind , true );
687 } 698 }
688 699
689 return true; 700 return true;
690} 701}
691 702
692/* 703/*
693 void KOWhatsNextView::createEventViewer() 704 void KOWhatsNextView::createEventViewer()
694 { 705 {
695 if (!mEventViewer) { 706 if (!mEventViewer) {
696 707
697 mEventViewer = new KOEventViewerDialog(this); 708 mEventViewer = new KOEventViewerDialog(this);
698 } 709 }
699 } 710 }
700*/ 711*/
701void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) 712void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v )
702{ 713{
703 mEventViewer = v; 714 mEventViewer = v;
704} 715}
705 716
706// TODO: Create this function in CalendarView and remove it from here 717// TODO: Create this function in CalendarView and remove it from here