-rw-r--r-- | korganizer/komonthview.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 4dfb9df..65d6acf 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -620,106 +620,116 @@ void MonthViewCell::startUpdateCell() | |||
620 | while ( CurrentAvailItem ) { | 620 | while ( CurrentAvailItem ) { |
621 | MonthViewItem *item = CurrentAvailItem; | 621 | MonthViewItem *item = CurrentAvailItem; |
622 | CurrentAvailItem = (MonthViewItem *)item->next(); | 622 | CurrentAvailItem = (MonthViewItem *)item->next(); |
623 | mAvailItemList.append( item ); | 623 | mAvailItemList.append( item ); |
624 | takeItem ( item ); | 624 | takeItem ( item ); |
625 | } | 625 | } |
626 | 626 | ||
627 | #ifdef DESKTOP_VERSION | 627 | #ifdef DESKTOP_VERSION |
628 | QToolTip::remove(this); | 628 | QToolTip::remove(this); |
629 | #endif | 629 | #endif |
630 | mToolTip.clear(); | 630 | mToolTip.clear(); |
631 | //qApp->processEvents(); | 631 | //qApp->processEvents(); |
632 | #if 0 | 632 | #if 0 |
633 | if ( !mHolidayString.isEmpty() ) { | 633 | if ( !mHolidayString.isEmpty() ) { |
634 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 634 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
635 | item->setPalette( mHolidayPalette ); | 635 | item->setPalette( mHolidayPalette ); |
636 | insertItem( item ); | 636 | insertItem( item ); |
637 | mToolTip.append ( mHolidayString ); | 637 | mToolTip.append ( mHolidayString ); |
638 | } | 638 | } |
639 | #endif | 639 | #endif |
640 | } | 640 | } |
641 | 641 | ||
642 | int MonthViewCell::insertEvent(Event *event) | 642 | int MonthViewCell::insertEvent(Event *event) |
643 | { | 643 | { |
644 | bool useToolTips = true; | ||
645 | #ifndef DEKSTOP_VERSION | ||
646 | useToolTips = false; | ||
647 | #endif | ||
644 | QString mToolTipText; | 648 | QString mToolTipText; |
645 | setFocusPolicy(WheelFocus); | 649 | setFocusPolicy(WheelFocus); |
646 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 650 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
647 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 651 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
648 | return mdayCount; | 652 | return mdayCount; |
649 | else | 653 | else |
650 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 654 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
651 | return mdayCount; | 655 | return mdayCount; |
652 | } | 656 | } |
653 | 657 | ||
654 | if ( event->isHoliday()) { | 658 | if ( event->isHoliday()) { |
655 | setHoliday( true ); | 659 | setHoliday( true ); |
656 | if ( mDate.dayOfWeek() == 7 ) | 660 | if ( mDate.dayOfWeek() == 7 ) |
657 | setLineWidth( 3 ); | 661 | setLineWidth( 3 ); |
658 | } | 662 | } |
659 | QString text; | 663 | QString text; |
660 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 664 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
661 | if (event->isMultiDay()) { | 665 | if (event->isMultiDay()) { |
662 | QString prefix = "<->";multiday = 2; | 666 | QString prefix = "<->";multiday = 2; |
663 | QString time; | 667 | QString time; |
664 | if ( event->doesRecur() ) { | 668 | if ( event->doesRecur() ) { |
665 | if ( event->recursOn( mDate) ) { | 669 | if ( event->recursOn( mDate) ) { |
666 | prefix ="->" ;multiday = 1; | 670 | prefix ="->" ;multiday = 1; |
667 | } | 671 | } |
668 | else { | 672 | else { |
669 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 673 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
670 | if ( event->recursOn( mDate.addDays( -days)) ) { | 674 | if ( event->recursOn( mDate.addDays( -days)) ) { |
671 | prefix ="<-" ;multiday = 3; | 675 | prefix ="<-" ;multiday = 3; |
672 | } | 676 | } |
673 | } | 677 | } |
674 | 678 | ||
675 | } else { | 679 | } else { |
676 | if (mDate == event->dtStart().date()) { | 680 | if (mDate == event->dtStart().date()) { |
677 | prefix ="->" ;multiday = 1; | 681 | prefix ="->" ;multiday = 1; |
678 | } else if (mDate == event->dtEnd().date()) { | 682 | } else if (mDate == event->dtEnd().date()) { |
679 | prefix ="<-" ;multiday = 3; | 683 | prefix ="<-" ;multiday = 3; |
680 | } | 684 | } |
681 | } | 685 | } |
682 | if ( !event->doesFloat() ) { | 686 | if ( !event->doesFloat() ) { |
683 | if ( mDate == event->dtStart().date () ) | 687 | if ( mDate == event->dtStart().date () ) |
684 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 688 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
685 | else if ( mDate == event->dtEnd().date () ) | 689 | else if ( mDate == event->dtEnd().date () ) |
686 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 690 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
687 | 691 | ||
688 | } | 692 | } |
689 | text = time + event->summary(); | 693 | text = time + event->summary(); |
694 | if ( useToolTips ) | ||
690 | mToolTipText += prefix + text; | 695 | mToolTipText += prefix + text; |
691 | } else { | 696 | } else { |
692 | if (event->doesFloat()) { | 697 | if (event->doesFloat()) { |
693 | text = event->summary(); | 698 | text = event->summary(); |
699 | if ( useToolTips ) | ||
694 | mToolTipText += text; | 700 | mToolTipText += text; |
695 | } | 701 | } |
696 | else { | 702 | else { |
697 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 703 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
698 | text += " " + event->summary(); | 704 | text += " " + event->summary(); |
705 | if ( useToolTips ) | ||
699 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 706 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
700 | } | 707 | } |
701 | } | 708 | } |
709 | if ( useToolTips && ! event->location().isEmpty() ) { | ||
710 | mToolTipText += " (" + event->location() +")"; | ||
711 | } | ||
702 | MonthViewItem *item ; | 712 | MonthViewItem *item ; |
703 | 713 | ||
704 | if ( mAvailItemList.count() ) { | 714 | if ( mAvailItemList.count() ) { |
705 | item = mAvailItemList.first(); | 715 | item = mAvailItemList.first(); |
706 | mAvailItemList.remove( item ); | 716 | mAvailItemList.remove( item ); |
707 | item->recycle( event, mDate, text ); | 717 | item->recycle( event, mDate, text ); |
708 | } else { | 718 | } else { |
709 | item = new MonthViewItem( event, mDate, text ); | 719 | item = new MonthViewItem( event, mDate, text ); |
710 | } | 720 | } |
711 | 721 | ||
712 | QPalette pal; | 722 | QPalette pal; |
713 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 723 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
714 | QStringList categories = event->categories(); | 724 | QStringList categories = event->categories(); |
715 | QString cat = categories.first(); | 725 | QString cat = categories.first(); |
716 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 726 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
717 | pal = getPalette(); | 727 | pal = getPalette(); |
718 | if (cat.isEmpty()) { | 728 | if (cat.isEmpty()) { |
719 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 729 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
720 | } else { | 730 | } else { |
721 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 731 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
722 | } | 732 | } |
723 | 733 | ||
724 | } else { | 734 | } else { |
725 | if (cat.isEmpty()) { | 735 | if (cat.isEmpty()) { |
@@ -743,48 +753,49 @@ int MonthViewCell::insertEvent(Event *event) | |||
743 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 753 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
744 | item->setReply(true && multiday < 2); | 754 | item->setReply(true && multiday < 2); |
745 | else | 755 | else |
746 | item->setReply(false); | 756 | item->setReply(false); |
747 | } else | 757 | } else |
748 | item->setReply(false); | 758 | item->setReply(false); |
749 | #endif | 759 | #endif |
750 | item->setMultiDay( multiday ); | 760 | item->setMultiDay( multiday ); |
751 | if ( multiday ) { | 761 | if ( multiday ) { |
752 | insertItem( item ,mdayCount); | 762 | insertItem( item ,mdayCount); |
753 | ++mdayCount; | 763 | ++mdayCount; |
754 | } else { | 764 | } else { |
755 | uint i; | 765 | uint i; |
756 | int pos = mdayCount; | 766 | int pos = mdayCount; |
757 | for ( i = mdayCount; i < count();++i ) { | 767 | for ( i = mdayCount; i < count();++i ) { |
758 | QListBoxItem* it = this->item ( i ); | 768 | QListBoxItem* it = this->item ( i ); |
759 | if ( text < it->text() ) { | 769 | if ( text < it->text() ) { |
760 | pos = i; | 770 | pos = i; |
761 | break; | 771 | break; |
762 | } | 772 | } |
763 | ++pos; | 773 | ++pos; |
764 | } | 774 | } |
765 | insertItem( item ,pos); | 775 | insertItem( item ,pos); |
766 | } | 776 | } |
777 | if ( useToolTips ) | ||
767 | mToolTip.append( mToolTipText ); | 778 | mToolTip.append( mToolTipText ); |
768 | return mdayCount; | 779 | return mdayCount; |
769 | } | 780 | } |
770 | void MonthViewCell::insertTodo(Todo *todo) | 781 | void MonthViewCell::insertTodo(Todo *todo) |
771 | { | 782 | { |
772 | setFocusPolicy(WheelFocus); | 783 | setFocusPolicy(WheelFocus); |
773 | QString text; | 784 | QString text; |
774 | if (todo->hasDueDate()) { | 785 | if (todo->hasDueDate()) { |
775 | if (!todo->doesFloat()) { | 786 | if (!todo->doesFloat()) { |
776 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 787 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
777 | text += " "; | 788 | text += " "; |
778 | } | 789 | } |
779 | } | 790 | } |
780 | text += todo->summary(); | 791 | text += todo->summary(); |
781 | MonthViewItem *item ; | 792 | MonthViewItem *item ; |
782 | if ( mAvailItemList.count() ) { | 793 | if ( mAvailItemList.count() ) { |
783 | item = mAvailItemList.first(); | 794 | item = mAvailItemList.first(); |
784 | mAvailItemList.remove( item ); | 795 | mAvailItemList.remove( item ); |
785 | item->recycle( todo, mDate, text ); | 796 | item->recycle( todo, mDate, text ); |
786 | } else { | 797 | } else { |
787 | item = new MonthViewItem( todo, mDate, text ); | 798 | item = new MonthViewItem( todo, mDate, text ); |
788 | } | 799 | } |
789 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 800 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
790 | //item->setPalette( mStandardPalette ); | 801 | //item->setPalette( mStandardPalette ); |
@@ -795,49 +806,51 @@ void MonthViewCell::insertTodo(Todo *todo) | |||
795 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 806 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
796 | pal = getPalette(); | 807 | pal = getPalette(); |
797 | if (cat.isEmpty()) { | 808 | if (cat.isEmpty()) { |
798 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 809 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
799 | } else { | 810 | } else { |
800 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 811 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
801 | } | 812 | } |
802 | 813 | ||
803 | } else { | 814 | } else { |
804 | if (cat.isEmpty()) { | 815 | if (cat.isEmpty()) { |
805 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 816 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
806 | } else { | 817 | } else { |
807 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 818 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
808 | } | 819 | } |
809 | } | 820 | } |
810 | 821 | ||
811 | } else { | 822 | } else { |
812 | pal = mStandardPalette ; | 823 | pal = mStandardPalette ; |
813 | } | 824 | } |
814 | item->setPalette( pal ); | 825 | item->setPalette( pal ); |
815 | item->setRecur( todo->recurrence()->doesRecur() ); | 826 | item->setRecur( todo->recurrence()->doesRecur() ); |
816 | item->setAlarm( todo->isAlarmEnabled() ); | 827 | item->setAlarm( todo->isAlarmEnabled() ); |
817 | item->setMoreInfo( todo->description().length() > 0 ); | 828 | item->setMoreInfo( todo->description().length() > 0 ); |
818 | insertItem( item , count()); | 829 | insertItem( item , count()); |
830 | #ifdef DESKTOP_VERSION | ||
819 | mToolTip.append( text ); | 831 | mToolTip.append( text ); |
832 | #endif | ||
820 | } | 833 | } |
821 | void MonthViewCell::repaintfinishUpdateCell() | 834 | void MonthViewCell::repaintfinishUpdateCell() |
822 | { | 835 | { |
823 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 836 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
824 | while ( mitem ) { | 837 | while ( mitem ) { |
825 | mitem->setBlockRepaint( false ); | 838 | mitem->setBlockRepaint( false ); |
826 | updateItem ( mitem ); | 839 | updateItem ( mitem ); |
827 | mitem = (MonthViewItem *)mitem->next(); | 840 | mitem = (MonthViewItem *)mitem->next(); |
828 | } | 841 | } |
829 | } | 842 | } |
830 | void MonthViewCell::finishUpdateCell() | 843 | void MonthViewCell::finishUpdateCell() |
831 | { | 844 | { |
832 | 845 | ||
833 | 846 | ||
834 | 847 | ||
835 | #ifdef DESKTOP_VERSION | 848 | #ifdef DESKTOP_VERSION |
836 | if (mToolTip.count() > 0 ) { | 849 | if (mToolTip.count() > 0 ) { |
837 | mToolTip.sort(); | 850 | mToolTip.sort(); |
838 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); | 851 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); |
839 | } | 852 | } |
840 | #endif | 853 | #endif |
841 | //sort(); | 854 | //sort(); |
842 | //setMyPalette(); | 855 | //setMyPalette(); |
843 | setMyPalette(); | 856 | setMyPalette(); |