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