-rw-r--r-- | korganizer/komonthview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 7927307..8ee1363 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -677,193 +677,193 @@ int MonthViewCell::insertEvent(Event *event) | |||
677 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 677 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
678 | if ( event->recursOn( mDate.addDays( -days)) ) { | 678 | if ( event->recursOn( mDate.addDays( -days)) ) { |
679 | prefix ="<-" ;multiday = 3; | 679 | prefix ="<-" ;multiday = 3; |
680 | } | 680 | } |
681 | } | 681 | } |
682 | 682 | ||
683 | } else { | 683 | } else { |
684 | if (mDate == event->dtStart().date()) { | 684 | if (mDate == event->dtStart().date()) { |
685 | prefix ="->" ;multiday = 1; | 685 | prefix ="->" ;multiday = 1; |
686 | } else if (mDate == event->dtEnd().date()) { | 686 | } else if (mDate == event->dtEnd().date()) { |
687 | prefix ="<-" ;multiday = 3; | 687 | prefix ="<-" ;multiday = 3; |
688 | } | 688 | } |
689 | } | 689 | } |
690 | if ( !event->doesFloat() ) { | 690 | if ( !event->doesFloat() ) { |
691 | if ( mDate == event->dtStart().date () ) | 691 | if ( mDate == event->dtStart().date () ) |
692 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 692 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
693 | else if ( mDate == event->dtEnd().date () ) | 693 | else if ( mDate == event->dtEnd().date () ) |
694 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 694 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
695 | 695 | ||
696 | } | 696 | } |
697 | text = time + event->summary(); | 697 | text = time + event->summary(); |
698 | if ( useToolTips ) | 698 | if ( useToolTips ) |
699 | mToolTipText += prefix + text; | 699 | mToolTipText += prefix + text; |
700 | } else { | 700 | } else { |
701 | if (event->doesFloat()) { | 701 | if (event->doesFloat()) { |
702 | text = event->summary(); | 702 | text = event->summary(); |
703 | if ( useToolTips ) | 703 | if ( useToolTips ) |
704 | mToolTipText += text; | 704 | mToolTipText += text; |
705 | } | 705 | } |
706 | else { | 706 | else { |
707 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 707 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
708 | text += " " + event->summary(); | 708 | text += " " + event->summary(); |
709 | if ( useToolTips ) | 709 | if ( useToolTips ) |
710 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 710 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
711 | } | 711 | } |
712 | } | 712 | } |
713 | if ( useToolTips && ! event->location().isEmpty() ) { | 713 | if ( useToolTips && ! event->location().isEmpty() ) { |
714 | mToolTipText += " (" + event->location() +")"; | 714 | mToolTipText += " (" + event->location() +")"; |
715 | } | 715 | } |
716 | MonthViewItem *item ; | 716 | MonthViewItem *item ; |
717 | 717 | ||
718 | if ( mAvailItemList.count() ) { | 718 | if ( mAvailItemList.count() ) { |
719 | item = mAvailItemList.first(); | 719 | item = mAvailItemList.first(); |
720 | mAvailItemList.remove( item ); | 720 | mAvailItemList.remove( item ); |
721 | item->recycle( event, mDate, text ); | 721 | item->recycle( event, mDate, text ); |
722 | } else { | 722 | } else { |
723 | item = new MonthViewItem( event, mDate, text ); | 723 | item = new MonthViewItem( event, mDate, text ); |
724 | } | 724 | } |
725 | 725 | ||
726 | QPalette pal; | 726 | QPalette pal; |
727 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 727 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
728 | QStringList categories = event->categories(); | 728 | QStringList categories = event->categories(); |
729 | QString cat = categories.first(); | 729 | QString cat = categories.first(); |
730 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 730 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
731 | pal = getPalette(); | 731 | pal = getPalette(); |
732 | if (cat.isEmpty()) { | 732 | if (cat.isEmpty()) { |
733 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 733 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
734 | } else { | 734 | } else { |
735 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 735 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
736 | } | 736 | } |
737 | 737 | ||
738 | } else { | 738 | } else { |
739 | if (cat.isEmpty()) { | 739 | if (cat.isEmpty()) { |
740 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 740 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
741 | } else { | 741 | } else { |
742 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 742 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
743 | } | 743 | } |
744 | } | 744 | } |
745 | 745 | ||
746 | } else { | 746 | } else { |
747 | pal = mStandardPalette ; | 747 | pal = mStandardPalette ; |
748 | } | 748 | } |
749 | item->setPalette( pal ); | 749 | item->setPalette( pal ); |
750 | item->setRecur( event->recurrence()->doesRecur() ); | 750 | item->setRecur( event->recurrence()->doesRecur() ); |
751 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); | 751 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); |
752 | item->setMoreInfo( event->description().length() > 0 ); | 752 | item->setMoreInfo( event->description().length() > 0 ); |
753 | #ifdef DESKTOP_VERSION | 753 | #ifdef DESKTOP_VERSION |
754 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 754 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
755 | KOPrefs::instance()->email()); | 755 | KOPrefs::instance()->email()); |
756 | if ( me != 0 ) { | 756 | if ( me != 0 ) { |
757 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 757 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
758 | item->setReply(true && multiday < 2); | 758 | item->setReply(true && multiday < 2); |
759 | else | 759 | else |
760 | item->setReply(false); | 760 | item->setReply(false); |
761 | } else | 761 | } else |
762 | item->setReply(false); | 762 | item->setReply(false); |
763 | #endif | 763 | #endif |
764 | item->setMultiDay( multiday ); | 764 | item->setMultiDay( multiday ); |
765 | if ( multiday ) { | 765 | if ( multiday ) { |
766 | insertItem( item ,mdayCount); | 766 | insertItem( item ,mdayCount); |
767 | ++mdayCount; | 767 | ++mdayCount; |
768 | } else { | 768 | } else { |
769 | uint i; | 769 | uint i; |
770 | int pos = mdayCount; | 770 | int pos = mdayCount; |
771 | for ( i = mdayCount; i < count();++i ) { | 771 | for ( i = mdayCount; i < count();++i ) { |
772 | QListBoxItem* it = this->item ( i ); | 772 | QListBoxItem* it = this->item ( i ); |
773 | if ( text < it->text() ) { | 773 | if ( it && text < it->text() ) { |
774 | pos = i; | 774 | pos = i; |
775 | break; | 775 | break; |
776 | } | 776 | } |
777 | ++pos; | 777 | ++pos; |
778 | } | 778 | } |
779 | insertItem( item ,pos); | 779 | insertItem( item ,pos); |
780 | } | 780 | } |
781 | if ( useToolTips ) { | 781 | if ( useToolTips ) { |
782 | mToolTip.append( mToolTipText ); | 782 | mToolTip.append( mToolTipText ); |
783 | } | 783 | } |
784 | return mdayCount; | 784 | return mdayCount; |
785 | } | 785 | } |
786 | void MonthViewCell::insertTodo(Todo *todo) | 786 | void MonthViewCell::insertTodo(Todo *todo) |
787 | { | 787 | { |
788 | setFocusPolicy(WheelFocus); | 788 | setFocusPolicy(WheelFocus); |
789 | QString text; | 789 | QString text; |
790 | if (todo->hasDueDate()) { | 790 | if (todo->hasDueDate()) { |
791 | if (!todo->doesFloat()) { | 791 | if (!todo->doesFloat()) { |
792 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 792 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
793 | text += " "; | 793 | text += " "; |
794 | } | 794 | } |
795 | } | 795 | } |
796 | text += todo->summary(); | 796 | text += todo->summary(); |
797 | MonthViewItem *item ; | 797 | MonthViewItem *item ; |
798 | if ( mAvailItemList.count() ) { | 798 | if ( mAvailItemList.count() ) { |
799 | item = mAvailItemList.first(); | 799 | item = mAvailItemList.first(); |
800 | mAvailItemList.remove( item ); | 800 | mAvailItemList.remove( item ); |
801 | item->recycle( todo, mDate, text ); | 801 | item->recycle( todo, mDate, text ); |
802 | } else { | 802 | } else { |
803 | item = new MonthViewItem( todo, mDate, text ); | 803 | item = new MonthViewItem( todo, mDate, text ); |
804 | } | 804 | } |
805 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 805 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
806 | //item->setPalette( mStandardPalette ); | 806 | //item->setPalette( mStandardPalette ); |
807 | QPalette pal; | 807 | QPalette pal; |
808 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 808 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
809 | QStringList categories = todo->categories(); | 809 | QStringList categories = todo->categories(); |
810 | QString cat = categories.first(); | 810 | QString cat = categories.first(); |
811 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 811 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
812 | pal = getPalette(); | 812 | pal = getPalette(); |
813 | if (cat.isEmpty()) { | 813 | if (cat.isEmpty()) { |
814 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 814 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
815 | } else { | 815 | } else { |
816 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 816 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
817 | } | 817 | } |
818 | 818 | ||
819 | } else { | 819 | } else { |
820 | if (cat.isEmpty()) { | 820 | if (cat.isEmpty()) { |
821 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 821 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
822 | } else { | 822 | } else { |
823 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 823 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
824 | } | 824 | } |
825 | } | 825 | } |
826 | 826 | ||
827 | } else { | 827 | } else { |
828 | pal = mStandardPalette ; | 828 | pal = mStandardPalette ; |
829 | } | 829 | } |
830 | item->setPalette( pal ); | 830 | item->setPalette( pal ); |
831 | item->setRecur( todo->recurrence()->doesRecur() ); | 831 | item->setRecur( todo->recurrence()->doesRecur() ); |
832 | item->setAlarm( todo->isAlarmEnabled() ); | 832 | item->setAlarm( todo->isAlarmEnabled() ); |
833 | item->setMoreInfo( todo->description().length() > 0 ); | 833 | item->setMoreInfo( todo->description().length() > 0 ); |
834 | insertItem( item , count()); | 834 | insertItem( item , count()); |
835 | #ifdef DESKTOP_VERSION | 835 | #ifdef DESKTOP_VERSION |
836 | mToolTip.append( text ); | 836 | mToolTip.append( text ); |
837 | #endif | 837 | #endif |
838 | } | 838 | } |
839 | void MonthViewCell::repaintfinishUpdateCell() | 839 | void MonthViewCell::repaintfinishUpdateCell() |
840 | { | 840 | { |
841 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 841 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
842 | while ( mitem ) { | 842 | while ( mitem ) { |
843 | mitem->setBlockRepaint( false ); | 843 | mitem->setBlockRepaint( false ); |
844 | updateItem ( mitem ); | 844 | updateItem ( mitem ); |
845 | mitem = (MonthViewItem *)mitem->next(); | 845 | mitem = (MonthViewItem *)mitem->next(); |
846 | } | 846 | } |
847 | } | 847 | } |
848 | void MonthViewCell::finishUpdateCell() | 848 | void MonthViewCell::finishUpdateCell() |
849 | { | 849 | { |
850 | 850 | ||
851 | 851 | ||
852 | 852 | ||
853 | #ifdef DESKTOP_VERSION | 853 | #ifdef DESKTOP_VERSION |
854 | if (mToolTip.count() > 0 ) { | 854 | if (mToolTip.count() > 0 ) { |
855 | mToolTip.sort(); | 855 | mToolTip.sort(); |
856 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); | 856 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); |
857 | } | 857 | } |
858 | #endif | 858 | #endif |
859 | //sort(); | 859 | //sort(); |
860 | //setMyPalette(); | 860 | //setMyPalette(); |
861 | setMyPalette(); | 861 | setMyPalette(); |
862 | 862 | ||
863 | resizeEvent( 0 ); | 863 | resizeEvent( 0 ); |
864 | 864 | ||
865 | } | 865 | } |
866 | void MonthViewCell::updateCell() | 866 | void MonthViewCell::updateCell() |
867 | { | 867 | { |
868 | if ( !mMonthView->isUpdatePossible() ) | 868 | if ( !mMonthView->isUpdatePossible() ) |
869 | return; | 869 | return; |