author | zautrix <zautrix> | 2005-07-27 23:40:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-27 23:40:19 (UTC) |
commit | 27ffa2e08ebb38e71f613af3a214750442418e2c (patch) (unidiff) | |
tree | de2bb4c541ab8795ee3739526e82ca8f4e952c09 /korganizer | |
parent | 0e38cffd7ba745f237c659e1c48080fcb25b126c (diff) | |
download | kdepimpi-27ffa2e08ebb38e71f613af3a214750442418e2c.zip kdepimpi-27ffa2e08ebb38e71f613af3a214750442418e2c.tar.gz kdepimpi-27ffa2e08ebb38e71f613af3a214750442418e2c.tar.bz2 |
fixcxcx
-rw-r--r-- | korganizer/komonthview.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index eea9a4d..4aeb20c 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -856,513 +856,517 @@ void MonthViewCell::insertTodo(Todo *todo) | |||
856 | QStringList categories = todo->categories(); | 856 | QStringList categories = todo->categories(); |
857 | QString cat = categories.first(); | 857 | QString cat = categories.first(); |
858 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 858 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
859 | pal = getPalette(); | 859 | pal = getPalette(); |
860 | if (cat.isEmpty()) { | 860 | if (cat.isEmpty()) { |
861 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 861 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
862 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() )); | 862 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() )); |
863 | } else { | 863 | } else { |
864 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 864 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
865 | } | 865 | } |
866 | 866 | ||
867 | } else { | 867 | } else { |
868 | if (cat.isEmpty()) { | 868 | if (cat.isEmpty()) { |
869 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 869 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
870 | pal = QPalette(KOPrefs::instance()->defaultColor( todo->calID() ), KOPrefs::instance()->defaultColor( todo->calID() )); | 870 | pal = QPalette(KOPrefs::instance()->defaultColor( todo->calID() ), KOPrefs::instance()->defaultColor( todo->calID() )); |
871 | } else { | 871 | } else { |
872 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 872 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
873 | } | 873 | } |
874 | } | 874 | } |
875 | 875 | ||
876 | } else { | 876 | } else { |
877 | pal = mStandardPalette ; | 877 | pal = mStandardPalette ; |
878 | } | 878 | } |
879 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); | 879 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); |
880 | item->setPalette( pal ); | 880 | item->setPalette( pal ); |
881 | item->setRecur( todo->doesRecur() ); | 881 | item->setRecur( todo->doesRecur() ); |
882 | item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); | 882 | item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); |
883 | item->setMoreInfo( todo->description().length() > 0 ); | 883 | item->setMoreInfo( todo->description().length() > 0 ); |
884 | insertItem( item , count()); | 884 | insertItem( item , count()); |
885 | #ifdef DESKTOP_VERSION | 885 | #ifdef DESKTOP_VERSION |
886 | mToolTip.append( text ); | 886 | mToolTip.append( text ); |
887 | #endif | 887 | #endif |
888 | } | 888 | } |
889 | void MonthViewCell::repaintfinishUpdateCell() | 889 | void MonthViewCell::repaintfinishUpdateCell() |
890 | { | 890 | { |
891 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 891 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
892 | while ( mitem ) { | 892 | while ( mitem ) { |
893 | mitem->setBlockRepaint( false ); | 893 | mitem->setBlockRepaint( false ); |
894 | updateItem ( mitem ); | 894 | updateItem ( mitem ); |
895 | mitem = (MonthViewItem *)mitem->next(); | 895 | mitem = (MonthViewItem *)mitem->next(); |
896 | } | 896 | } |
897 | blockSignals( false ); | 897 | blockSignals( false ); |
898 | } | 898 | } |
899 | void MonthViewCell::finishUpdateCell() | 899 | void MonthViewCell::finishUpdateCell() |
900 | { | 900 | { |
901 | 901 | ||
902 | 902 | ||
903 | 903 | ||
904 | #ifdef DESKTOP_VERSION | 904 | #ifdef DESKTOP_VERSION |
905 | if (mToolTip.count() > 0 ) { | 905 | if (mToolTip.count() > 0 ) { |
906 | mToolTip.sort(); | 906 | mToolTip.sort(); |
907 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); | 907 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); |
908 | } | 908 | } |
909 | #endif | 909 | #endif |
910 | //sort(); | 910 | //sort(); |
911 | //setMyPalette(); | 911 | //setMyPalette(); |
912 | setMyPalette(); | 912 | setMyPalette(); |
913 | 913 | ||
914 | resizeEvent( 0 ); | 914 | resizeEvent( 0 ); |
915 | 915 | ||
916 | } | 916 | } |
917 | void MonthViewCell::updateCell() | 917 | void MonthViewCell::updateCell() |
918 | { | 918 | { |
919 | if ( !mMonthView->isUpdatePossible() ) | 919 | if ( !mMonthView->isUpdatePossible() ) |
920 | return; | 920 | return; |
921 | startUpdateCell(); | 921 | startUpdateCell(); |
922 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 922 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
923 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 923 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
924 | Event *event; | 924 | Event *event; |
925 | for( event = events.first(); event; event = events.next() ) { // for event | 925 | for( event = events.first(); event; event = events.next() ) { // for event |
926 | insertEvent(event); | 926 | insertEvent(event); |
927 | } | 927 | } |
928 | // insert due todos | 928 | // insert due todos |
929 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 929 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
930 | Todo *todo; | 930 | Todo *todo; |
931 | for(todo = todos.first(); todo; todo = todos.next()) { | 931 | for(todo = todos.first(); todo; todo = todos.next()) { |
932 | insertTodo( todo ); | 932 | insertTodo( todo ); |
933 | } | 933 | } |
934 | finishUpdateCell(); | 934 | finishUpdateCell(); |
935 | // if ( isVisible()) | 935 | // if ( isVisible()) |
936 | //qApp->processEvents(); | 936 | //qApp->processEvents(); |
937 | } | 937 | } |
938 | 938 | ||
939 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 939 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
940 | { | 940 | { |
941 | 941 | ||
942 | if ( bigFont ) { | 942 | if ( bigFont ) { |
943 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 943 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
944 | int ps = fo.pointSize() + 2; | 944 | int ps = fo.pointSize() + 2; |
945 | if ( ps < 18 ) | 945 | if ( ps < 18 ) |
946 | ps += 2; | 946 | ps += 2; |
947 | fo.setPointSize( ps ); | 947 | fo.setPointSize( ps ); |
948 | setFont( fo ); | 948 | setFont( fo ); |
949 | } else | 949 | } else |
950 | setFont( KOPrefs::instance()->mMonthViewFont ); | 950 | setFont( KOPrefs::instance()->mMonthViewFont ); |
951 | 951 | ||
952 | QFontMetrics fm( font() ); | 952 | QFontMetrics fm( font() ); |
953 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 953 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
954 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 954 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
955 | mHolidayPalette = mStandardPalette; | 955 | mHolidayPalette = mStandardPalette; |
956 | mPrimaryPalette = mStandardPalette; | 956 | mPrimaryPalette = mStandardPalette; |
957 | mNonPrimaryPalette = mStandardPalette; | 957 | mNonPrimaryPalette = mStandardPalette; |
958 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 958 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
959 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 959 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
960 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 960 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
961 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 961 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
962 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 962 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
963 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 963 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
964 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 964 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
965 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 965 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
966 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 966 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
967 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 967 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
968 | } | 968 | } |
969 | //updateCell(); | 969 | //updateCell(); |
970 | } | 970 | } |
971 | 971 | ||
972 | void MonthViewCell::enableScrollBars( bool enabled ) | 972 | void MonthViewCell::enableScrollBars( bool enabled ) |
973 | { | 973 | { |
974 | 974 | ||
975 | return; | 975 | return; |
976 | if ( enabled ) { | 976 | if ( enabled ) { |
977 | QListBoxItem *fi = firstItem (); | 977 | QListBoxItem *fi = firstItem (); |
978 | if (fi ) { | 978 | if (fi ) { |
979 | int ihei = fi->height( this ); | 979 | int ihei = fi->height( this ); |
980 | int hei = numRows () * ihei; | 980 | int hei = numRows () * ihei; |
981 | if ( hei < height() - horizontalScrollBar()->height () ) { | 981 | if ( hei < height() - horizontalScrollBar()->height () ) { |
982 | setVScrollBarMode(QScrollView::AlwaysOff); | 982 | setVScrollBarMode(QScrollView::AlwaysOff); |
983 | } | 983 | } |
984 | else | 984 | else |
985 | setVScrollBarMode(QScrollView::Auto); | 985 | setVScrollBarMode(QScrollView::Auto); |
986 | if ( ihei *3 > height() ) { | 986 | if ( ihei *3 > height() ) { |
987 | setHScrollBarMode(QScrollView::AlwaysOff); | 987 | setHScrollBarMode(QScrollView::AlwaysOff); |
988 | } | 988 | } |
989 | else { | 989 | else { |
990 | setHScrollBarMode(QScrollView::Auto); | 990 | setHScrollBarMode(QScrollView::Auto); |
991 | } | 991 | } |
992 | } else { | 992 | } else { |
993 | setVScrollBarMode(QScrollView::Auto); | 993 | setVScrollBarMode(QScrollView::Auto); |
994 | setHScrollBarMode(QScrollView::Auto); | 994 | setHScrollBarMode(QScrollView::Auto); |
995 | } | 995 | } |
996 | } else { | 996 | } else { |
997 | setVScrollBarMode(QScrollView::AlwaysOff); | 997 | setVScrollBarMode(QScrollView::AlwaysOff); |
998 | setHScrollBarMode(QScrollView::AlwaysOff); | 998 | setHScrollBarMode(QScrollView::AlwaysOff); |
999 | } | 999 | } |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | Incidence *MonthViewCell::selectedIncidence() | 1002 | Incidence *MonthViewCell::selectedIncidence() |
1003 | { | 1003 | { |
1004 | int index = currentItem(); | 1004 | int index = currentItem(); |
1005 | if ( index < 0 ) return 0; | 1005 | if ( index < 0 ) return 0; |
1006 | 1006 | ||
1007 | MonthViewItem *mitem = | 1007 | MonthViewItem *mitem = |
1008 | static_cast<MonthViewItem *>( item( index ) ); | 1008 | static_cast<MonthViewItem *>( item( index ) ); |
1009 | 1009 | ||
1010 | if ( !mitem ) return 0; | 1010 | if ( !mitem ) return 0; |
1011 | 1011 | ||
1012 | return mitem->incidence(); | 1012 | return mitem->incidence(); |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | QDate MonthViewCell::selectedIncidenceDate() | 1015 | QDate MonthViewCell::selectedIncidenceDate() |
1016 | { | 1016 | { |
1017 | QDate qd; | 1017 | QDate qd; |
1018 | int index = currentItem(); | 1018 | int index = currentItem(); |
1019 | if ( index < 0 ) return qd; | 1019 | if ( index < 0 ) return qd; |
1020 | return mDate; | 1020 | return mDate; |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | void MonthViewCell::deselect() | 1023 | void MonthViewCell::deselect() |
1024 | { | 1024 | { |
1025 | clearSelection(); | 1025 | clearSelection(); |
1026 | enableScrollBars( false ); | 1026 | enableScrollBars( false ); |
1027 | // updateCell(); | 1027 | // updateCell(); |
1028 | } | 1028 | } |
1029 | void MonthViewCell::select() | 1029 | void MonthViewCell::select() |
1030 | { | 1030 | { |
1031 | ;// updateCell(); | 1031 | ;// updateCell(); |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | void MonthViewCell::resizeEvent ( QResizeEvent * e ) | 1034 | void MonthViewCell::resizeEvent ( QResizeEvent * e ) |
1035 | { | 1035 | { |
1036 | if ( !mMonthView->isUpdatePossible() ) | 1036 | if ( !mMonthView->isUpdatePossible() ) |
1037 | return; | 1037 | return; |
1038 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); | 1038 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); |
1039 | deselect(); | 1039 | deselect(); |
1040 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); | 1040 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); |
1041 | 1041 | ||
1042 | QString text; | 1042 | QString text; |
1043 | //mLabel->setText( text ); | 1043 | //mLabel->setText( text ); |
1044 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 1044 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
1045 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 1045 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
1046 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " " + QString::number( mDate.day() ); | 1046 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " " + QString::number( mDate.day() ); |
1047 | mLabel->resize( mLabelBigSize ); | 1047 | mLabel->resize( mLabelBigSize ); |
1048 | } else { | 1048 | } else { |
1049 | mLabel->resize( mLabelSize ); | 1049 | mLabel->resize( mLabelSize ); |
1050 | text = QString::number( mDate.day() ); | 1050 | text = QString::number( mDate.day() ); |
1051 | } | 1051 | } |
1052 | mLabel->setText( text ); | 1052 | mLabel->setText( text ); |
1053 | 1053 | ||
1054 | int size = height() - mLabel->height() - lineWidth()-1; | 1054 | int size = height() - mLabel->height() - lineWidth()-1; |
1055 | //qDebug("LW %d ", lineWidth()); | 1055 | //qDebug("LW %d ", lineWidth()); |
1056 | if ( size > 0 ) | 1056 | if ( size > 0 ) |
1057 | verticalScrollBar()->setMaximumHeight( size ); | 1057 | verticalScrollBar()->setMaximumHeight( size ); |
1058 | size = width() - mLabel->width() -lineWidth()-1; | 1058 | size = width() - mLabel->width() -lineWidth()-1; |
1059 | if ( size > 0 ) | 1059 | if ( size > 0 ) |
1060 | horizontalScrollBar()->setMaximumWidth( size ); | 1060 | horizontalScrollBar()->setMaximumWidth( size ); |
1061 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); | 1061 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); |
1062 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 1062 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
1063 | // mItemList->resize ( width(), height () ); | 1063 | // mItemList->resize ( width(), height () ); |
1064 | if ( e ) | 1064 | if ( e ) |
1065 | KNoScrollListBox::resizeEvent ( e ); | 1065 | KNoScrollListBox::resizeEvent ( e ); |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 1068 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
1069 | { | 1069 | { |
1070 | 1070 | ||
1071 | if ( !item ) { | 1071 | if ( !item ) { |
1072 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1072 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1073 | emit newEventSignal( dt ); | 1073 | emit newEventSignal( dt ); |
1074 | return; | 1074 | return; |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1077 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1078 | Incidence *incidence = eventItem->incidence(); | 1078 | Incidence *incidence = eventItem->incidence(); |
1079 | if ( incidence ) mMonthView->defaultAction( incidence ); | 1079 | if ( incidence ) mMonthView->defaultAction( incidence ); |
1080 | } | 1080 | } |
1081 | void MonthViewCell::showDay() | 1081 | void MonthViewCell::showDay() |
1082 | { | 1082 | { |
1083 | emit showDaySignal( date() ); | 1083 | emit showDaySignal( date() ); |
1084 | } | 1084 | } |
1085 | void MonthViewCell::newEvent() | 1085 | void MonthViewCell::newEvent() |
1086 | { | 1086 | { |
1087 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1087 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1088 | emit newEventSignal( dt ); | 1088 | emit newEventSignal( dt ); |
1089 | } | 1089 | } |
1090 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 1090 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
1091 | { | 1091 | { |
1092 | mMonthView->setSelectedCell( this ); | 1092 | mMonthView->setSelectedCell( this ); |
1093 | if ( item == 0 ) { | 1093 | if ( item == 0 ) { |
1094 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1094 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1095 | emit newEventSignal( dt ); | 1095 | emit newEventSignal( dt ); |
1096 | return; | 1096 | return; |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 1101 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
1102 | { | 1102 | { |
1103 | mMonthView->setPopupCell( this ); | 1103 | mMonthView->setPopupCell( this ); |
1104 | if ( !item ) { | 1104 | if ( !item ) { |
1105 | mMonthView->showContextMenu( 0 ); | 1105 | mMonthView->showContextMenu( 0 ); |
1106 | return; | 1106 | return; |
1107 | } | 1107 | } |
1108 | //selection( item ); | 1108 | //selection( item ); |
1109 | //qApp->processEvents(); | 1109 | //qApp->processEvents(); |
1110 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1110 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1111 | Incidence *incidence = eventItem->incidence(); | 1111 | Incidence *incidence = eventItem->incidence(); |
1112 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 1112 | if ( incidence ) { |
1113 | mMonthView->showContextMenu( incidence ); | ||
1114 | selection( item ); | ||
1115 | doHighLight( incidence ); | ||
1116 | } | ||
1113 | } | 1117 | } |
1114 | 1118 | ||
1115 | void MonthViewCell::selection( QListBoxItem *item ) | 1119 | void MonthViewCell::selection( QListBoxItem *item ) |
1116 | { | 1120 | { |
1117 | if ( !item ) { | 1121 | if ( !item ) { |
1118 | emit highlightIncidence( 0 , this, 0 ); | 1122 | emit highlightIncidence( 0 , this, 0 ); |
1119 | return; | 1123 | return; |
1120 | } | 1124 | } |
1121 | MonthViewItem * it = (static_cast<MonthViewItem *>( item )); | 1125 | MonthViewItem * it = (static_cast<MonthViewItem *>( item )); |
1122 | emit highlightIncidence( it->incidence(), this, it->multiDay() ); | 1126 | emit highlightIncidence( it->incidence(), this, it->multiDay() ); |
1123 | mMonthView->setSelectedCell( this ); | 1127 | mMonthView->setSelectedCell( this ); |
1124 | } | 1128 | } |
1125 | 1129 | ||
1126 | void MonthViewCell::deHighLight() | 1130 | void MonthViewCell::deHighLight() |
1127 | { | 1131 | { |
1128 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 1132 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
1129 | while ( mitem ) { | 1133 | while ( mitem ) { |
1130 | if ( mitem->setHighlightedFalse() ) | 1134 | if ( mitem->setHighlightedFalse() ) |
1131 | updateItem ( mitem ); | 1135 | updateItem ( mitem ); |
1132 | mitem = (MonthViewItem *)mitem->next(); | 1136 | mitem = (MonthViewItem *)mitem->next(); |
1133 | } | 1137 | } |
1134 | } | 1138 | } |
1135 | // returns true if no inc found | 1139 | // returns true if no inc found |
1136 | bool MonthViewCell::doHighLight( Incidence * inc ) | 1140 | bool MonthViewCell::doHighLight( Incidence * inc ) |
1137 | { | 1141 | { |
1138 | 1142 | ||
1139 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 1143 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
1140 | while ( mitem ) { | 1144 | while ( mitem ) { |
1141 | if ( mitem->incidence() == inc ) { | 1145 | if ( mitem->incidence() == inc ) { |
1142 | if ( mitem->setHighlighted( inc ) ) | 1146 | if ( mitem->setHighlighted( inc ) ) |
1143 | updateItem ( mitem ); | 1147 | updateItem ( mitem ); |
1144 | return false; | 1148 | return false; |
1145 | } | 1149 | } |
1146 | mitem = (MonthViewItem *)mitem->next(); | 1150 | mitem = (MonthViewItem *)mitem->next(); |
1147 | } | 1151 | } |
1148 | return true; | 1152 | return true; |
1149 | } | 1153 | } |
1150 | // ******************************************************************************* | 1154 | // ******************************************************************************* |
1151 | // ******************************************************************************* | 1155 | // ******************************************************************************* |
1152 | // ******************************************************************************* | 1156 | // ******************************************************************************* |
1153 | 1157 | ||
1154 | 1158 | ||
1155 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 1159 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
1156 | : KOEventView( calendar, parent, name ), | 1160 | : KOEventView( calendar, parent, name ), |
1157 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 1161 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
1158 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 1162 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
1159 | { | 1163 | { |
1160 | mFlagKeyPressed = false; | 1164 | mFlagKeyPressed = false; |
1161 | mShortDayLabelsM = false; | 1165 | mShortDayLabelsM = false; |
1162 | mShortDayLabelsW = false; | 1166 | mShortDayLabelsW = false; |
1163 | skipResize = false; | 1167 | skipResize = false; |
1164 | clPending = true; | 1168 | clPending = true; |
1165 | mPopupCell = 0; | 1169 | mPopupCell = 0; |
1166 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); | 1170 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); |
1167 | mWidStack = new QWidgetStack( this ); | 1171 | mWidStack = new QWidgetStack( this ); |
1168 | QVBoxLayout* hb = new QVBoxLayout( this ); | 1172 | QVBoxLayout* hb = new QVBoxLayout( this ); |
1169 | mMonthView = new QWidget( mWidStack ); | 1173 | mMonthView = new QWidget( mWidStack ); |
1170 | mWeekView = new QWidget( mWidStack ); | 1174 | mWeekView = new QWidget( mWidStack ); |
1171 | #if QT_VERSION >= 0x030000 | 1175 | #if QT_VERSION >= 0x030000 |
1172 | mWidStack->addWidget(mMonthView ); | 1176 | mWidStack->addWidget(mMonthView ); |
1173 | mWidStack->addWidget(mWeekView ); | 1177 | mWidStack->addWidget(mWeekView ); |
1174 | #else | 1178 | #else |
1175 | mWidStack->addWidget( mMonthView, 1 ); | 1179 | mWidStack->addWidget( mMonthView, 1 ); |
1176 | mWidStack->addWidget( mWeekView , 1 ); | 1180 | mWidStack->addWidget( mWeekView , 1 ); |
1177 | #endif | 1181 | #endif |
1178 | hb->addWidget( mNavigatorBar ); | 1182 | hb->addWidget( mNavigatorBar ); |
1179 | hb->addWidget( mWidStack ); | 1183 | hb->addWidget( mWidStack ); |
1180 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 1184 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
1181 | updatePossible = false; | 1185 | updatePossible = false; |
1182 | //updatePossible = true; | 1186 | //updatePossible = true; |
1183 | mCells.setAutoDelete( true ); | 1187 | mCells.setAutoDelete( true ); |
1184 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1188 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1185 | mDayLabels.resize( mDaysPerWeek ); | 1189 | mDayLabels.resize( mDaysPerWeek ); |
1186 | mDayLabelsW.resize( mDaysPerWeek ); | 1190 | mDayLabelsW.resize( mDaysPerWeek ); |
1187 | QFont bfont = font(); | 1191 | QFont bfont = font(); |
1188 | if ( QApplication::desktop()->width() < 650 ) { | 1192 | if ( QApplication::desktop()->width() < 650 ) { |
1189 | bfont.setPointSize( bfont.pointSize() - 2 ); | 1193 | bfont.setPointSize( bfont.pointSize() - 2 ); |
1190 | } | 1194 | } |
1191 | bfont.setBold( true ); | 1195 | bfont.setBold( true ); |
1192 | int i; | 1196 | int i; |
1193 | 1197 | ||
1194 | for( i = 0; i < mDaysPerWeek; i++ ) { | 1198 | for( i = 0; i < mDaysPerWeek; i++ ) { |
1195 | QLabel *label = new QLabel( mMonthView ); | 1199 | QLabel *label = new QLabel( mMonthView ); |
1196 | label->setFont(bfont); | 1200 | label->setFont(bfont); |
1197 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1201 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1198 | label->setLineWidth(1); | 1202 | label->setLineWidth(1); |
1199 | label->setAlignment(AlignCenter); | 1203 | label->setAlignment(AlignCenter); |
1200 | mDayLabels.insert( i, label ); | 1204 | mDayLabels.insert( i, label ); |
1201 | label = new QLabel( mWeekView ); | 1205 | label = new QLabel( mWeekView ); |
1202 | label->setFont(bfont); | 1206 | label->setFont(bfont); |
1203 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1207 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1204 | label->setLineWidth(1); | 1208 | label->setLineWidth(1); |
1205 | label->setAlignment(AlignCenter); | 1209 | label->setAlignment(AlignCenter); |
1206 | mDayLabelsW.insert( i, label ); | 1210 | mDayLabelsW.insert( i, label ); |
1207 | } | 1211 | } |
1208 | 1212 | ||
1209 | bfont.setBold( false ); | 1213 | bfont.setBold( false ); |
1210 | mWeekLabels.resize( mNumWeeks+1 ); | 1214 | mWeekLabels.resize( mNumWeeks+1 ); |
1211 | mWeekLabelsW.resize( 2 ); | 1215 | mWeekLabelsW.resize( 2 ); |
1212 | for( i = 0; i < mNumWeeks+1; i++ ) { | 1216 | for( i = 0; i < mNumWeeks+1; i++ ) { |
1213 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 1217 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
1214 | label->setFocusPolicy(NoFocus); | 1218 | label->setFocusPolicy(NoFocus); |
1215 | label->setFont(bfont); | 1219 | label->setFont(bfont); |
1216 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 1220 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
1217 | label->setFlat(true); | 1221 | label->setFlat(true); |
1218 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 1222 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
1219 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1223 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1220 | //label->setLineWidth(1); | 1224 | //label->setLineWidth(1); |
1221 | //label->setAlignment(AlignCenter); | 1225 | //label->setAlignment(AlignCenter); |
1222 | mWeekLabels.insert( i, label ); | 1226 | mWeekLabels.insert( i, label ); |
1223 | } | 1227 | } |
1224 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1228 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1225 | mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); | 1229 | mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); |
1226 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 1230 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
1227 | 1231 | ||
1228 | for( i = 0; i < 1+1; i++ ) { | 1232 | for( i = 0; i < 1+1; i++ ) { |
1229 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 1233 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
1230 | label->setFocusPolicy(NoFocus); | 1234 | label->setFocusPolicy(NoFocus); |
1231 | label->setFont(bfont); | 1235 | label->setFont(bfont); |
1232 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 1236 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
1233 | label->setFlat(true); | 1237 | label->setFlat(true); |
1234 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 1238 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
1235 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1239 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1236 | //label->setLineWidth(1); | 1240 | //label->setLineWidth(1); |
1237 | //label->setAlignment(AlignCenter); | 1241 | //label->setAlignment(AlignCenter); |
1238 | mWeekLabelsW.insert( i, label ); | 1242 | mWeekLabelsW.insert( i, label ); |
1239 | } | 1243 | } |
1240 | mWeekLabelsW[1]->setText( i18n("W")); | 1244 | mWeekLabelsW[1]->setText( i18n("W")); |
1241 | mWeekLabelsW[1]->setFocusPolicy(WheelFocus); | 1245 | mWeekLabelsW[1]->setFocusPolicy(WheelFocus); |
1242 | 1246 | ||
1243 | 1247 | ||
1244 | int row, col; | 1248 | int row, col; |
1245 | mCells.resize( mNumCells ); | 1249 | mCells.resize( mNumCells ); |
1246 | for( row = 0; row < mNumWeeks; ++row ) { | 1250 | for( row = 0; row < mNumWeeks; ++row ) { |
1247 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1251 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1248 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 1252 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
1249 | mCells.insert( row * mDaysPerWeek + col, cell ); | 1253 | mCells.insert( row * mDaysPerWeek + col, cell ); |
1250 | 1254 | ||
1251 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1255 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1252 | SLOT( defaultAction( Incidence * ) ) ); | 1256 | SLOT( defaultAction( Incidence * ) ) ); |
1253 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1257 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1254 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1258 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1255 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1259 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1256 | SIGNAL( showDaySignal( QDate ) ) ); | 1260 | SIGNAL( showDaySignal( QDate ) ) ); |
1257 | connect( cell, SIGNAL( nextCell() ), | 1261 | connect( cell, SIGNAL( nextCell() ), |
1258 | SLOT( nextCell() ) ); | 1262 | SLOT( nextCell() ) ); |
1259 | connect( cell, SIGNAL( prevCell() ), | 1263 | connect( cell, SIGNAL( prevCell() ), |
1260 | SLOT( prevCell() ) ); | 1264 | SLOT( prevCell() ) ); |
1261 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), | 1265 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), |
1262 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); | 1266 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); |
1263 | } | 1267 | } |
1264 | } | 1268 | } |
1265 | mCellsW.resize( mDaysPerWeek ); | 1269 | mCellsW.resize( mDaysPerWeek ); |
1266 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1270 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1267 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 1271 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
1268 | mCellsW.insert( col, cell ); | 1272 | mCellsW.insert( col, cell ); |
1269 | 1273 | ||
1270 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1274 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1271 | SLOT( defaultAction( Incidence * ) ) ); | 1275 | SLOT( defaultAction( Incidence * ) ) ); |
1272 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1276 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1273 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1277 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1274 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1278 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1275 | SIGNAL( showDaySignal( QDate ) ) ); | 1279 | SIGNAL( showDaySignal( QDate ) ) ); |
1276 | connect( cell, SIGNAL( nextCell() ), | 1280 | connect( cell, SIGNAL( nextCell() ), |
1277 | SLOT( nextCell() ) ); | 1281 | SLOT( nextCell() ) ); |
1278 | connect( cell, SIGNAL( prevCell() ), | 1282 | connect( cell, SIGNAL( prevCell() ), |
1279 | SLOT( prevCell() ) ); | 1283 | SLOT( prevCell() ) ); |
1280 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), | 1284 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), |
1281 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); | 1285 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); |
1282 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 1286 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
1283 | } | 1287 | } |
1284 | 1288 | ||
1285 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 1289 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
1286 | mContextMenu = eventPopup(); | 1290 | mContextMenu = eventPopup(); |
1287 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1291 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1288 | i18n("New Event..."),this, | 1292 | i18n("New Event..."),this, |
1289 | SLOT(slotNewEvent()),false); | 1293 | SLOT(slotNewEvent()),false); |
1290 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1294 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1291 | i18n("New Todo..."),this, | 1295 | i18n("New Todo..."),this, |
1292 | SLOT(slotNewTodo()),false); | 1296 | SLOT(slotNewTodo()),false); |
1293 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1297 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1294 | i18n("Journal"),this, | 1298 | i18n("Journal"),this, |
1295 | SLOT(slotEditJournal()),false); | 1299 | SLOT(slotEditJournal()),false); |
1296 | 1300 | ||
1297 | connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this, | 1301 | connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this, |
1298 | SLOT( catChanged( Incidence * ) )); | 1302 | SLOT( catChanged( Incidence * ) )); |
1299 | 1303 | ||
1300 | 1304 | ||
1301 | QString pathString = ""; | 1305 | QString pathString = ""; |
1302 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { | 1306 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { |
1303 | if ( QApplication::desktop()->width() < 480 ) | 1307 | if ( QApplication::desktop()->width() < 480 ) |
1304 | pathString += "icons16/"; | 1308 | pathString += "icons16/"; |
1305 | } else | 1309 | } else |
1306 | pathString += "iconsmini/"; | 1310 | pathString += "iconsmini/"; |
1307 | mNewItemMenu = new QPopupMenu( this ); | 1311 | mNewItemMenu = new QPopupMenu( this ); |
1308 | mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); | 1312 | mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); |
1309 | mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false); | 1313 | mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false); |
1310 | mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false); | 1314 | mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false); |
1311 | 1315 | ||
1312 | // updateConfig(); //useless here... | 1316 | // updateConfig(); //useless here... |
1313 | // ... but we need mWidthLongDayLabel computed | 1317 | // ... but we need mWidthLongDayLabel computed |
1314 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1318 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1315 | mWidthLongDayLabel = 0; | 1319 | mWidthLongDayLabel = 0; |
1316 | for (int i = 0; i < 7; i++) { | 1320 | for (int i = 0; i < 7; i++) { |
1317 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1321 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1318 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1322 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1319 | } | 1323 | } |
1320 | 1324 | ||
1321 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1325 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1322 | 1326 | ||
1323 | #if 0 | 1327 | #if 0 |
1324 | if ( mShowWeekView ) | 1328 | if ( mShowWeekView ) |
1325 | mWidStack->raiseWidget( mWeekView ); | 1329 | mWidStack->raiseWidget( mWeekView ); |
1326 | else | 1330 | else |
1327 | mWidStack->raiseWidget( mMonthView ); | 1331 | mWidStack->raiseWidget( mMonthView ); |
1328 | #endif | 1332 | #endif |
1329 | 1333 | ||
1330 | emit incidenceSelected( 0 ); | 1334 | emit incidenceSelected( 0 ); |
1331 | 1335 | ||
1332 | mComputeLayoutTimer = new QTimer( this ); | 1336 | mComputeLayoutTimer = new QTimer( this ); |
1333 | connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); | 1337 | connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); |
1334 | 1338 | ||
1335 | 1339 | ||
1336 | #ifndef DESKTOP_VERSION | 1340 | #ifndef DESKTOP_VERSION |
1337 | resize( QApplication::desktop()->size() ); | 1341 | resize( QApplication::desktop()->size() ); |
1338 | #else | 1342 | #else |
1339 | resize(640, 480 ); | 1343 | resize(640, 480 ); |
1340 | updatePossible = true; | 1344 | updatePossible = true; |
1341 | #endif | 1345 | #endif |
1342 | computeLayout(); | 1346 | computeLayout(); |
1343 | 1347 | ||
1344 | if ( mShowWeekView ) | 1348 | if ( mShowWeekView ) |
1345 | mWidStack->raiseWidget( mWeekView ); | 1349 | mWidStack->raiseWidget( mWeekView ); |
1346 | else | 1350 | else |
1347 | mWidStack->raiseWidget( mMonthView ); | 1351 | mWidStack->raiseWidget( mMonthView ); |
1348 | } | 1352 | } |
1349 | 1353 | ||
1350 | KOMonthView::~KOMonthView() | 1354 | KOMonthView::~KOMonthView() |
1351 | { | 1355 | { |
1352 | delete mContextMenu; | 1356 | delete mContextMenu; |
1353 | } | 1357 | } |
1354 | 1358 | ||
1355 | void KOMonthView::catChanged( Incidence * ) | 1359 | void KOMonthView::catChanged( Incidence * ) |
1356 | { | 1360 | { |
1357 | updateView(); | 1361 | updateView(); |
1358 | } | 1362 | } |
1359 | void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) | 1363 | void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) |
1360 | { | 1364 | { |
1361 | static Incidence * lastInc = 0; | 1365 | static Incidence * lastInc = 0; |
1362 | static MonthViewCell * lastCell = 0; | 1366 | static MonthViewCell * lastCell = 0; |
1363 | 1367 | ||
1364 | if ( lastInc == inc && lastCell == mc ) | 1368 | if ( lastInc == inc && lastCell == mc ) |
1365 | return; | 1369 | return; |
1366 | lastInc = inc; | 1370 | lastInc = inc; |
1367 | lastCell = mc; | 1371 | lastCell = mc; |
1368 | //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); | 1372 | //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); |