summaryrefslogtreecommitdiffabout
path: root/korganizer/kowhatsnextview.cpp
authorzautrix <zautrix>2005-01-27 12:14:32 (UTC)
committer zautrix <zautrix>2005-01-27 12:14:32 (UTC)
commitc8b484570a9cf8aacc070f92141c8bcfebbf3a93 (patch) (unidiff)
treeaf81a25ccc142582a60a5ed100dcd44956255b62 /korganizer/kowhatsnextview.cpp
parent9ff00e650e32d6f348a2333c9cf21da9c9a137ff (diff)
downloadkdepimpi-c8b484570a9cf8aacc070f92141c8bcfebbf3a93.zip
kdepimpi-c8b484570a9cf8aacc070f92141c8bcfebbf3a93.tar.gz
kdepimpi-c8b484570a9cf8aacc070f92141c8bcfebbf3a93.tar.bz2
birthday fixes
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
@@ -579,48 +579,56 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
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;
@@ -634,49 +642,52 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
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();