author | zautrix <zautrix> | 2005-02-06 20:09:33 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-06 20:09:33 (UTC) |
commit | 961fc44f4092c1f981eb3be4284715e6829f885c (patch) (unidiff) | |
tree | 005e999ddbf07af42c7da4f9193874ba0ba3870c /korganizer | |
parent | 536a16498de6b9c10b3f5b147ca18c5e4421401c (diff) | |
download | kdepimpi-961fc44f4092c1f981eb3be4284715e6829f885c.zip kdepimpi-961fc44f4092c1f981eb3be4284715e6829f885c.tar.gz kdepimpi-961fc44f4092c1f981eb3be4284715e6829f885c.tar.bz2 |
fixesss
-rw-r--r-- | korganizer/komonthview.cpp | 90 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 4 |
3 files changed, 42 insertions, 55 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index ffb2e1e..70cbf96 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -814,328 +814,328 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
814 | #endif | 814 | #endif |
815 | hb->addWidget( mWidStack ); | 815 | hb->addWidget( mWidStack ); |
816 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 816 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
817 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 817 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
818 | if ( mShowWeekView ) | 818 | if ( mShowWeekView ) |
819 | mWeekStartsMonday = true; | 819 | mWeekStartsMonday = true; |
820 | updatePossible = false; | 820 | updatePossible = false; |
821 | mCells.setAutoDelete( true ); | 821 | mCells.setAutoDelete( true ); |
822 | mDayLabels.resize( mDaysPerWeek ); | 822 | mDayLabels.resize( mDaysPerWeek ); |
823 | mDayLabelsW.resize( mDaysPerWeek ); | 823 | mDayLabelsW.resize( mDaysPerWeek ); |
824 | QFont bfont = font(); | 824 | QFont bfont = font(); |
825 | if ( QApplication::desktop()->width() < 650 ) { | 825 | if ( QApplication::desktop()->width() < 650 ) { |
826 | bfont.setPointSize( bfont.pointSize() - 2 ); | 826 | bfont.setPointSize( bfont.pointSize() - 2 ); |
827 | } | 827 | } |
828 | bfont.setBold( true ); | 828 | bfont.setBold( true ); |
829 | int i; | 829 | int i; |
830 | 830 | ||
831 | for( i = 0; i < mDaysPerWeek; i++ ) { | 831 | for( i = 0; i < mDaysPerWeek; i++ ) { |
832 | QLabel *label = new QLabel( mMonthView ); | 832 | QLabel *label = new QLabel( mMonthView ); |
833 | label->setFont(bfont); | 833 | label->setFont(bfont); |
834 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 834 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
835 | label->setLineWidth(1); | 835 | label->setLineWidth(1); |
836 | label->setAlignment(AlignCenter); | 836 | label->setAlignment(AlignCenter); |
837 | mDayLabels.insert( i, label ); | 837 | mDayLabels.insert( i, label ); |
838 | label = new QLabel( mWeekView ); | 838 | label = new QLabel( mWeekView ); |
839 | label->setFont(bfont); | 839 | label->setFont(bfont); |
840 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 840 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
841 | label->setLineWidth(1); | 841 | label->setLineWidth(1); |
842 | label->setAlignment(AlignCenter); | 842 | label->setAlignment(AlignCenter); |
843 | mDayLabelsW.insert( i, label ); | 843 | mDayLabelsW.insert( i, label ); |
844 | } | 844 | } |
845 | 845 | ||
846 | bfont.setBold( false ); | 846 | bfont.setBold( false ); |
847 | mWeekLabels.resize( mNumWeeks+1 ); | 847 | mWeekLabels.resize( mNumWeeks+1 ); |
848 | mWeekLabelsW.resize( 2 ); | 848 | mWeekLabelsW.resize( 2 ); |
849 | for( i = 0; i < mNumWeeks+1; i++ ) { | 849 | for( i = 0; i < mNumWeeks+1; i++ ) { |
850 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 850 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
851 | label->setFocusPolicy(NoFocus); | 851 | label->setFocusPolicy(NoFocus); |
852 | label->setFont(bfont); | 852 | label->setFont(bfont); |
853 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 853 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
854 | label->setFlat(true); | 854 | label->setFlat(true); |
855 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 855 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
856 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 856 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
857 | //label->setLineWidth(1); | 857 | //label->setLineWidth(1); |
858 | //label->setAlignment(AlignCenter); | 858 | //label->setAlignment(AlignCenter); |
859 | mWeekLabels.insert( i, label ); | 859 | mWeekLabels.insert( i, label ); |
860 | } | 860 | } |
861 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 861 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
862 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 862 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
863 | 863 | ||
864 | for( i = 0; i < 1+1; i++ ) { | 864 | for( i = 0; i < 1+1; i++ ) { |
865 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 865 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
866 | label->setFocusPolicy(NoFocus); | 866 | label->setFocusPolicy(NoFocus); |
867 | label->setFont(bfont); | 867 | label->setFont(bfont); |
868 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 868 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
869 | label->setFlat(true); | 869 | label->setFlat(true); |
870 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 870 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
871 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 871 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
872 | //label->setLineWidth(1); | 872 | //label->setLineWidth(1); |
873 | //label->setAlignment(AlignCenter); | 873 | //label->setAlignment(AlignCenter); |
874 | mWeekLabelsW.insert( i, label ); | 874 | mWeekLabelsW.insert( i, label ); |
875 | } | 875 | } |
876 | mWeekLabelsW[1]->setText( i18n("W")); | 876 | mWeekLabelsW[1]->setText( i18n("W")); |
877 | 877 | ||
878 | 878 | ||
879 | int row, col; | 879 | int row, col; |
880 | mCells.resize( mNumCells ); | 880 | mCells.resize( mNumCells ); |
881 | for( row = 0; row < mNumWeeks; ++row ) { | 881 | for( row = 0; row < mNumWeeks; ++row ) { |
882 | for( col = 0; col < mDaysPerWeek; ++col ) { | 882 | for( col = 0; col < mDaysPerWeek; ++col ) { |
883 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 883 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
884 | mCells.insert( row * mDaysPerWeek + col, cell ); | 884 | mCells.insert( row * mDaysPerWeek + col, cell ); |
885 | 885 | ||
886 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 886 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
887 | SLOT( defaultAction( Incidence * ) ) ); | 887 | SLOT( defaultAction( Incidence * ) ) ); |
888 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 888 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
889 | SIGNAL( newEventSignal( QDateTime ) ) ); | 889 | SIGNAL( newEventSignal( QDateTime ) ) ); |
890 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 890 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
891 | SIGNAL( showDaySignal( QDate ) ) ); | 891 | SIGNAL( showDaySignal( QDate ) ) ); |
892 | } | 892 | } |
893 | } | 893 | } |
894 | mCellsW.resize( mDaysPerWeek ); | 894 | mCellsW.resize( mDaysPerWeek ); |
895 | for( col = 0; col < mDaysPerWeek; ++col ) { | 895 | for( col = 0; col < mDaysPerWeek; ++col ) { |
896 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 896 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
897 | mCellsW.insert( col, cell ); | 897 | mCellsW.insert( col, cell ); |
898 | 898 | ||
899 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 899 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
900 | SLOT( defaultAction( Incidence * ) ) ); | 900 | SLOT( defaultAction( Incidence * ) ) ); |
901 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 901 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
902 | SIGNAL( newEventSignal( QDateTime ) ) ); | 902 | SIGNAL( newEventSignal( QDateTime ) ) ); |
903 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 903 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
904 | SIGNAL( showDaySignal( QDate ) ) ); | 904 | SIGNAL( showDaySignal( QDate ) ) ); |
905 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 905 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
906 | } | 906 | } |
907 | 907 | ||
908 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 908 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
909 | mContextMenu = eventPopup(); | 909 | mContextMenu = eventPopup(); |
910 | updateConfig(); //useless here | 910 | //updateConfig(); //useless here ... |
911 | // ... but we need mWidthLongDayLabel computed | ||
912 | QFontMetrics fontmetric(mDayLabels[0]->font()); | ||
913 | mWidthLongDayLabel = 0; | ||
914 | for (int i = 0; i < 7; i++) { | ||
915 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | ||
916 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | ||
917 | } | ||
911 | 918 | ||
912 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 919 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
913 | 920 | ||
914 | if ( mShowWeekView ) | 921 | if ( mShowWeekView ) |
915 | mWidStack->raiseWidget( mWeekView ); | 922 | mWidStack->raiseWidget( mWeekView ); |
916 | else | 923 | else |
917 | mWidStack->raiseWidget( mMonthView ); | 924 | mWidStack->raiseWidget( mMonthView ); |
918 | 925 | ||
919 | emit incidenceSelected( 0 ); | 926 | emit incidenceSelected( 0 ); |
920 | } | 927 | } |
921 | 928 | ||
922 | KOMonthView::~KOMonthView() | 929 | KOMonthView::~KOMonthView() |
923 | { | 930 | { |
924 | delete mContextMenu; | 931 | delete mContextMenu; |
925 | } | 932 | } |
926 | 933 | ||
927 | void KOMonthView::selectInternalWeekNum ( int n ) | 934 | void KOMonthView::selectInternalWeekNum ( int n ) |
928 | { | 935 | { |
929 | switchView(); | 936 | switchView(); |
930 | emit selectWeekNum ( n ); | 937 | emit selectWeekNum ( n ); |
931 | } | 938 | } |
932 | 939 | ||
933 | int KOMonthView::currentWeek() | 940 | int KOMonthView::currentWeek() |
934 | { | 941 | { |
935 | if ( mShowWeekView ) | 942 | if ( mShowWeekView ) |
936 | return mWeekLabelsW[0]->getWeekNum(); | 943 | return mWeekLabelsW[0]->getWeekNum(); |
937 | return mWeekLabels[0]->getWeekNum(); | 944 | return mWeekLabels[0]->getWeekNum(); |
938 | } | 945 | } |
939 | void KOMonthView::switchView() | 946 | void KOMonthView::switchView() |
940 | { | 947 | { |
941 | 948 | ||
942 | if ( selectedCell( ) ) | 949 | if ( selectedCell( ) ) |
943 | selectedCell()->deselect(); | 950 | selectedCell()->deselect(); |
944 | mShowWeekView = !mShowWeekView; | 951 | mShowWeekView = !mShowWeekView; |
945 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 952 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
946 | //emit showNavigator( !mShowWeekView ); | 953 | //emit showNavigator( !mShowWeekView ); |
947 | if ( clPending ) { | 954 | if ( clPending ) { |
948 | computeLayout(); | 955 | computeLayout(); |
949 | updateConfig(); | 956 | updateConfig(); |
950 | } | 957 | } |
951 | if ( mShowWeekView ) | 958 | if ( mShowWeekView ) |
952 | mWidStack->raiseWidget( mWeekView ); | 959 | mWidStack->raiseWidget( mWeekView ); |
953 | else | 960 | else |
954 | mWidStack->raiseWidget( mMonthView ); | 961 | mWidStack->raiseWidget( mMonthView ); |
955 | clPending = false; | 962 | clPending = false; |
956 | } | 963 | } |
957 | 964 | ||
958 | int KOMonthView::maxDatesHint() | 965 | int KOMonthView::maxDatesHint() |
959 | { | 966 | { |
960 | return mNumCells; | 967 | return mNumCells; |
961 | } | 968 | } |
962 | 969 | ||
963 | int KOMonthView::currentDateCount() | 970 | int KOMonthView::currentDateCount() |
964 | { | 971 | { |
965 | return mNumCells; | 972 | return mNumCells; |
966 | } | 973 | } |
967 | 974 | ||
968 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 975 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
969 | { | 976 | { |
970 | QPtrList<Incidence> selected; | 977 | QPtrList<Incidence> selected; |
971 | 978 | ||
972 | if ( mSelectedCell ) { | 979 | if ( mSelectedCell ) { |
973 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 980 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
974 | if ( incidence ) selected.append( incidence ); | 981 | if ( incidence ) selected.append( incidence ); |
975 | } | 982 | } |
976 | 983 | ||
977 | return selected; | 984 | return selected; |
978 | } | 985 | } |
979 | 986 | ||
980 | DateList KOMonthView::selectedDates() | 987 | DateList KOMonthView::selectedDates() |
981 | { | 988 | { |
982 | DateList selected; | 989 | DateList selected; |
983 | 990 | ||
984 | if ( mSelectedCell ) { | 991 | if ( mSelectedCell ) { |
985 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 992 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
986 | if ( qd.isValid() ) selected.append( qd ); | 993 | if ( qd.isValid() ) selected.append( qd ); |
987 | } | 994 | } |
988 | 995 | ||
989 | return selected; | 996 | return selected; |
990 | } | 997 | } |
991 | 998 | ||
992 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 999 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
993 | const QDate &td) | 1000 | const QDate &td) |
994 | { | 1001 | { |
995 | #ifndef KORG_NOPRINTER | 1002 | #ifndef KORG_NOPRINTER |
996 | calPrinter->preview(CalPrinter::Month, fd, td); | 1003 | calPrinter->preview(CalPrinter::Month, fd, td); |
997 | #endif | 1004 | #endif |
998 | } | 1005 | } |
999 | 1006 | ||
1000 | void KOMonthView::updateConfig() | 1007 | void KOMonthView::updateConfig() |
1001 | { | 1008 | { |
1002 | 1009 | ||
1003 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1010 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1004 | 1011 | ||
1005 | if ( mShowWeekView ) { | 1012 | if ( mShowWeekView ) { |
1006 | mWeekStartsMonday = true; | 1013 | mWeekStartsMonday = true; |
1007 | } | 1014 | } |
1008 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1015 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1009 | mWidthLongDayLabel = 0; | 1016 | mWidthLongDayLabel = 0; |
1010 | qDebug("KOMonthView::updateConfig() "); | ||
1011 | for (int i = 0; i < 7; i++) { | 1017 | for (int i = 0; i < 7; i++) { |
1012 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1018 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1013 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1019 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1014 | } | 1020 | } |
1015 | if ( ! mShowWeekView ) { | 1021 | if ( ! mShowWeekView ) { |
1016 | computeLayout(); | 1022 | computeLayout(); |
1017 | } | 1023 | } |
1018 | updateDayLabels(); | 1024 | updateDayLabels(); |
1019 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 1025 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
1020 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1026 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
1021 | //resizeEvent( 0 ); | 1027 | //resizeEvent( 0 ); |
1022 | for (uint i = 0; i < mCells.count(); ++i) { | 1028 | for (uint i = 0; i < mCells.count(); ++i) { |
1023 | mCells[i]->updateConfig(); | 1029 | mCells[i]->updateConfig(); |
1024 | } | 1030 | } |
1025 | 1031 | ||
1026 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1032 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1027 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); | 1033 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); |
1028 | } | 1034 | } |
1029 | #ifdef DESKTOP_VERSION | 1035 | #ifdef DESKTOP_VERSION |
1030 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 1036 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
1031 | #endif | 1037 | #endif |
1032 | updateView(); | 1038 | updateView(); |
1033 | } | 1039 | } |
1034 | 1040 | ||
1035 | void KOMonthView::updateDayLabels() | 1041 | void KOMonthView::updateDayLabels() |
1036 | { | 1042 | { |
1037 | 1043 | ||
1038 | QPtrVector<QLabel> *mDayLabelsT; | 1044 | QPtrVector<QLabel> *mDayLabelsT; |
1039 | #if 0 | 1045 | |
1040 | if (mShowWeekView ) | ||
1041 | mDayLabelsT = &mDayLabelsW; | ||
1042 | else | ||
1043 | mDayLabelsT = &mDayLabels; | ||
1044 | #endif | ||
1045 | qDebug("updateDayLabels W %d M %d ",mShortDayLabelsW ,mShortDayLabelsM); | ||
1046 | mDayLabelsT = &mDayLabelsW; | 1046 | mDayLabelsT = &mDayLabelsW; |
1047 | for (int i = 0; i < 7; i++) { | 1047 | for (int i = 0; i < 7; i++) { |
1048 | if (mWeekStartsMonday) { | 1048 | if (mWeekStartsMonday) { |
1049 | bool show = mShortDayLabelsW; | 1049 | bool show = mShortDayLabelsW; |
1050 | if ( i > 4 && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1050 | if ( i > 4 && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1051 | show = true; | 1051 | show = true; |
1052 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1052 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1053 | } else { | 1053 | } else { |
1054 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); | 1054 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); |
1055 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); | 1055 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); |
1056 | 1056 | ||
1057 | } | 1057 | } |
1058 | } | 1058 | } |
1059 | mDayLabelsT = &mDayLabels; | 1059 | mDayLabelsT = &mDayLabels; |
1060 | for (int i = 0; i < 7; i++) { | 1060 | for (int i = 0; i < 7; i++) { |
1061 | if (mWeekStartsMonday) { | 1061 | if (mWeekStartsMonday) { |
1062 | bool show = mShortDayLabelsM; | 1062 | bool show = mShortDayLabelsM; |
1063 | if ( i > 4 && KOPrefs::instance()->mMonthViewSatSunTog && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1063 | if ( i > 4 && KOPrefs::instance()->mMonthViewSatSunTog && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1064 | show = true; | 1064 | show = true; |
1065 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1065 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1066 | } else { | 1066 | } else { |
1067 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); | 1067 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); |
1068 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); | 1068 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); |
1069 | 1069 | ||
1070 | } | 1070 | } |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1075 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1076 | { | 1076 | { |
1077 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1077 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1078 | 1078 | ||
1079 | QPtrVector<MonthViewCell> *cells; | 1079 | QPtrVector<MonthViewCell> *cells; |
1080 | QPtrVector<QLabel> *dayLabels; | 1080 | QPtrVector<QLabel> *dayLabels; |
1081 | QPtrVector<KOWeekButton> *weekLabels; | 1081 | QPtrVector<KOWeekButton> *weekLabels; |
1082 | int weekNum = 6; | 1082 | int weekNum = 6; |
1083 | if ( mShowWeekView ) { | 1083 | if ( mShowWeekView ) { |
1084 | weekNum = 1; | 1084 | weekNum = 1; |
1085 | cells = &mCellsW; | 1085 | cells = &mCellsW; |
1086 | dayLabels = &mDayLabelsW; | 1086 | dayLabels = &mDayLabelsW; |
1087 | weekLabels = &mWeekLabelsW; | 1087 | weekLabels = &mWeekLabelsW; |
1088 | } else { | 1088 | } else { |
1089 | cells = &mCells; | 1089 | cells = &mCells; |
1090 | dayLabels = &mDayLabels; | 1090 | dayLabels = &mDayLabels; |
1091 | weekLabels = &mWeekLabels; | 1091 | weekLabels = &mWeekLabels; |
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | mStartDate = start; | 1094 | mStartDate = start; |
1095 | 1095 | ||
1096 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1096 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1097 | 1097 | ||
1098 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1098 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1099 | mStartDate = mStartDate.addDays( -1 ); | 1099 | mStartDate = mStartDate.addDays( -1 ); |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | bool primary = false; | 1102 | bool primary = false; |
1103 | uint i; | 1103 | uint i; |
1104 | for( i = 0; i < (*cells).size(); ++i ) { | 1104 | for( i = 0; i < (*cells).size(); ++i ) { |
1105 | QDate date = mStartDate.addDays( i ); | 1105 | QDate date = mStartDate.addDays( i ); |
1106 | (*cells)[i]->setDate( date ); | 1106 | (*cells)[i]->setDate( date ); |
1107 | 1107 | ||
1108 | #ifndef KORG_NOPLUGINS | 1108 | #ifndef KORG_NOPLUGINS |
1109 | // add holiday, if present | 1109 | // add holiday, if present |
1110 | QString hstring(KOCore::self()->holiday(date)); | 1110 | QString hstring(KOCore::self()->holiday(date)); |
1111 | (*cells)[i]->setHoliday( hstring ); | 1111 | (*cells)[i]->setHoliday( hstring ); |
1112 | #endif | 1112 | #endif |
1113 | 1113 | ||
1114 | } | 1114 | } |
1115 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1115 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
1116 | for( i = 0; i < weekNum; ++i ) { | 1116 | for( i = 0; i < weekNum; ++i ) { |
1117 | int wno; | 1117 | int wno; |
1118 | // remember, according to ISO 8601, the first week of the year is the | 1118 | // remember, according to ISO 8601, the first week of the year is the |
1119 | // first week that contains a thursday. Thus we must subtract off 4, | 1119 | // first week that contains a thursday. Thus we must subtract off 4, |
1120 | // not just 1. | 1120 | // not just 1. |
1121 | int dayOfYear = date.dayOfYear(); | 1121 | int dayOfYear = date.dayOfYear(); |
1122 | if (dayOfYear % 7 != 0) | 1122 | if (dayOfYear % 7 != 0) |
1123 | wno = dayOfYear / 7 + 1; | 1123 | wno = dayOfYear / 7 + 1; |
1124 | else | 1124 | else |
1125 | wno =dayOfYear / 7; | 1125 | wno =dayOfYear / 7; |
1126 | (*weekLabels)[i]->setWeekNum( wno ); | 1126 | (*weekLabels)[i]->setWeekNum( wno ); |
1127 | date = date.addDays( 7 ); | 1127 | date = date.addDays( 7 ); |
1128 | } | 1128 | } |
1129 | updateView(); | 1129 | updateView(); |
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | void KOMonthView::showEvents(QPtrList<Event>) | 1132 | void KOMonthView::showEvents(QPtrList<Event>) |
1133 | { | 1133 | { |
1134 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1134 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | void KOMonthView::changeEventDisplay(Event *, int) | 1137 | void KOMonthView::changeEventDisplay(Event *, int) |
1138 | { | 1138 | { |
1139 | // this should be re-written to be much more efficient, but this | 1139 | // this should be re-written to be much more efficient, but this |
1140 | // quick-and-dirty-hack gets the job done for right now. | 1140 | // quick-and-dirty-hack gets the job done for right now. |
1141 | updateView(); | 1141 | updateView(); |
@@ -1170,419 +1170,407 @@ void KOMonthView::updateView() | |||
1170 | QDate endDate = mStartDate.addDays( timeSpan ); | 1170 | QDate endDate = mStartDate.addDays( timeSpan ); |
1171 | for( event = events.first(); event; event = events.next() ) { // for event | 1171 | for( event = events.first(); event; event = events.next() ) { // for event |
1172 | if ( event->doesRecur() ) { | 1172 | if ( event->doesRecur() ) { |
1173 | bool last; | 1173 | bool last; |
1174 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1174 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1175 | QDateTime incidenceEnd; | 1175 | QDateTime incidenceEnd; |
1176 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1176 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1177 | bool invalid = false; | 1177 | bool invalid = false; |
1178 | while( true ) { | 1178 | while( true ) { |
1179 | if ( incidenceStart.isValid() ) { | 1179 | if ( incidenceStart.isValid() ) { |
1180 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1180 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1181 | int st = incidenceStart.date().daysTo( endDate ); | 1181 | int st = incidenceStart.date().daysTo( endDate ); |
1182 | if ( st >= 0 ) { // start before timeend | 1182 | if ( st >= 0 ) { // start before timeend |
1183 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1183 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1184 | if ( end >= 0 ) { // end after timestart --- got one! | 1184 | if ( end >= 0 ) { // end after timestart --- got one! |
1185 | //normalize | 1185 | //normalize |
1186 | st = timeSpan - st; | 1186 | st = timeSpan - st; |
1187 | if ( st < 0 ) st = 0; | 1187 | if ( st < 0 ) st = 0; |
1188 | if ( end > timeSpan ) end = timeSpan; | 1188 | if ( end > timeSpan ) end = timeSpan; |
1189 | int iii; | 1189 | int iii; |
1190 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1190 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1191 | for ( iii = st;iii<= end;++iii) | 1191 | for ( iii = st;iii<= end;++iii) |
1192 | (*cells)[iii]->insertEvent( event ); | 1192 | (*cells)[iii]->insertEvent( event ); |
1193 | } | 1193 | } |
1194 | } | 1194 | } |
1195 | } else { | 1195 | } else { |
1196 | if ( invalid ) | 1196 | if ( invalid ) |
1197 | break; | 1197 | break; |
1198 | invalid = true; | 1198 | invalid = true; |
1199 | //qDebug("invalid %s", event->summary().latin1()); | 1199 | //qDebug("invalid %s", event->summary().latin1()); |
1200 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 1200 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1201 | } | 1201 | } |
1202 | if ( last ) | 1202 | if ( last ) |
1203 | break; | 1203 | break; |
1204 | bool ok; | 1204 | bool ok; |
1205 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1205 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1206 | if ( ! ok ) | 1206 | if ( ! ok ) |
1207 | break; | 1207 | break; |
1208 | if ( incidenceStart.date() > endDate ) | 1208 | if ( incidenceStart.date() > endDate ) |
1209 | break; | 1209 | break; |
1210 | } | 1210 | } |
1211 | } else { // no recur | 1211 | } else { // no recur |
1212 | int st = event->dtStart().date().daysTo( endDate ); | 1212 | int st = event->dtStart().date().daysTo( endDate ); |
1213 | if ( st >= 0 ) { // start before timeend | 1213 | if ( st >= 0 ) { // start before timeend |
1214 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1214 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1215 | if ( end >= 0 ) { // end after timestart --- got one! | 1215 | if ( end >= 0 ) { // end after timestart --- got one! |
1216 | //normalize | 1216 | //normalize |
1217 | st = timeSpan - st; | 1217 | st = timeSpan - st; |
1218 | if ( st < 0 ) st = 0; | 1218 | if ( st < 0 ) st = 0; |
1219 | if ( end > timeSpan ) end = timeSpan; | 1219 | if ( end > timeSpan ) end = timeSpan; |
1220 | int iii; | 1220 | int iii; |
1221 | for ( iii = st;iii<= end;++iii) | 1221 | for ( iii = st;iii<= end;++iii) |
1222 | (*cells)[iii]->insertEvent( event ); | 1222 | (*cells)[iii]->insertEvent( event ); |
1223 | } | 1223 | } |
1224 | } | 1224 | } |
1225 | } | 1225 | } |
1226 | } | 1226 | } |
1227 | // insert due todos | 1227 | // insert due todos |
1228 | QPtrList<Todo> todos = calendar()->todos( ); | 1228 | QPtrList<Todo> todos = calendar()->todos( ); |
1229 | Todo *todo; | 1229 | Todo *todo; |
1230 | for(todo = todos.first(); todo; todo = todos.next()) { | 1230 | for(todo = todos.first(); todo; todo = todos.next()) { |
1231 | //insertTodo( todo ); | 1231 | //insertTodo( todo ); |
1232 | if ( todo->hasDueDate() ) { | 1232 | if ( todo->hasDueDate() ) { |
1233 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1233 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1234 | if ( day >= 0 && day < timeSpan + 1) { | 1234 | if ( day >= 0 && day < timeSpan + 1) { |
1235 | (*cells)[day]->insertTodo( todo ); | 1235 | (*cells)[day]->insertTodo( todo ); |
1236 | } | 1236 | } |
1237 | } | 1237 | } |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | for( i = 0; i < timeSpan+1; ++i ) { | 1240 | for( i = 0; i < timeSpan+1; ++i ) { |
1241 | (*cells)[i]->finishUpdateCell(); | 1241 | (*cells)[i]->finishUpdateCell(); |
1242 | } | 1242 | } |
1243 | processSelectionChange(); | 1243 | processSelectionChange(); |
1244 | (*cells)[0]->setFocus(); | 1244 | (*cells)[0]->setFocus(); |
1245 | 1245 | ||
1246 | 1246 | ||
1247 | #else | 1247 | #else |
1248 | // old code | 1248 | // old code |
1249 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1249 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1250 | int i; | 1250 | int i; |
1251 | for( i = 0; i < (*cells).count(); ++i ) { | 1251 | for( i = 0; i < (*cells).count(); ++i ) { |
1252 | (*cells)[i]->updateCell(); | 1252 | (*cells)[i]->updateCell(); |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | //qDebug("KOMonthView::updateView() "); | 1255 | //qDebug("KOMonthView::updateView() "); |
1256 | processSelectionChange(); | 1256 | processSelectionChange(); |
1257 | // qDebug("---------------------------------------------------------------------+ "); | 1257 | // qDebug("---------------------------------------------------------------------+ "); |
1258 | (*cells)[0]->setFocus(); | 1258 | (*cells)[0]->setFocus(); |
1259 | #endif | 1259 | #endif |
1260 | 1260 | ||
1261 | //qDebug("update time %d ", ti.elapsed()); | 1261 | //qDebug("update time %d ", ti.elapsed()); |
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1264 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1265 | { | 1265 | { |
1266 | qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1266 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1267 | if ( ignoreResizeEvent ) { | 1267 | if ( ignoreResizeEvent ) { |
1268 | int diff = e->size().height() - e->oldSize().height(); | 1268 | //qDebug("KOMonthView::resizeEvent ignored "); |
1269 | if ( diff < 0 ) | ||
1270 | diff = diff * (-1); | ||
1271 | if ( diff == ignoreResizeEventHeight ) { | ||
1272 | qDebug("KOMonthView::resizeEvent ignored "); | ||
1273 | --ignoreResizeEvent; | 1269 | --ignoreResizeEvent; |
1274 | return; | 1270 | return; |
1275 | } | 1271 | } |
1276 | ignoreResizeEvent = 0; | ||
1277 | } | ||
1278 | if ( e->size().width()+ e->size().height() < 240 ) | 1272 | if ( e->size().width()+ e->size().height() < 240 ) |
1279 | return; | 1273 | return; |
1280 | computeLayout(); | 1274 | computeLayout(); |
1281 | clPending = true; | 1275 | clPending = true; |
1282 | if ( mShowWeekView ) | 1276 | if ( mShowWeekView ) |
1283 | mCellsW[0]->setFocus(); | 1277 | mCellsW[0]->setFocus(); |
1284 | else | 1278 | else |
1285 | mCells[0]->setFocus(); | 1279 | mCells[0]->setFocus(); |
1286 | } | 1280 | } |
1287 | void KOMonthView::computeLayoutWeek() | 1281 | void KOMonthView::computeLayoutWeek() |
1288 | { | 1282 | { |
1289 | 1283 | static int widd = 0; | |
1284 | static int heigg = 0; | ||
1285 | if ( widd == width() && heigg == height () ) { | ||
1286 | return; | ||
1287 | } | ||
1288 | widd = width() ; | ||
1289 | heigg = height (); | ||
1290 | int daysToShow; | 1290 | int daysToShow; |
1291 | int tWid = topLevelWidget()->size().width(); | ||
1292 | int tHei = topLevelWidget()->size().height(); | ||
1293 | |||
1294 | int wid = size().width();//e | 1291 | int wid = size().width();//e |
1295 | int hei = size().height()-1; | 1292 | int hei = size().height()-1; |
1296 | |||
1297 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1298 | return; | ||
1299 | |||
1300 | if ( wid < hei ) | 1293 | if ( wid < hei ) |
1301 | daysToShow = 2; | 1294 | daysToShow = 2; |
1302 | else | 1295 | else |
1303 | daysToShow = 3; | 1296 | daysToShow = 3; |
1304 | bool combinedSatSun = true; | 1297 | bool combinedSatSun = true; |
1305 | 1298 | ||
1306 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | ||
1307 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1299 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1308 | int weeklabelwid = fm.width( "888" ); | 1300 | int weeklabelwid = fm.width( "888" ); |
1309 | wid -= weeklabelwid; | 1301 | wid -= weeklabelwid; |
1310 | 1302 | ||
1311 | int colWid = wid / daysToShow; | 1303 | int colWid = wid / daysToShow; |
1312 | int lastCol = wid - ( colWid*6 ); | 1304 | int lastCol = wid - ( colWid*6 ); |
1313 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1305 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1314 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1306 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1315 | int colModulo = wid % daysToShow; | 1307 | int colModulo = wid % daysToShow; |
1316 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1308 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1317 | //qDebug("rowmod %d ", rowModulo); | 1309 | //qDebug("rowmod %d ", rowModulo); |
1318 | int i; | 1310 | int i; |
1319 | int x,y,w,h; | 1311 | int x,y,w,h; |
1320 | x= 0; | 1312 | x= 0; |
1321 | y= 0; | 1313 | y= 0; |
1322 | w = colWid; | 1314 | w = colWid; |
1323 | h = dayLabelHei ; | 1315 | h = dayLabelHei ; |
1324 | for ( i = 0; i < 7; i++) { | 1316 | for ( i = 0; i < 7; i++) { |
1325 | if ( i && !( i % daysToShow) && i < 6) { | 1317 | if ( i && !( i % daysToShow) && i < 6) { |
1326 | y += hei/(5-daysToShow); | 1318 | y += hei/(5-daysToShow); |
1327 | x = 0; | 1319 | x = 0; |
1328 | w = colWid; | 1320 | w = colWid; |
1329 | } | 1321 | } |
1330 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1322 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1331 | ++w; | 1323 | ++w; |
1332 | } | 1324 | } |
1333 | if ( i >= 5 ) { | 1325 | if ( i >= 5 ) { |
1334 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); | 1326 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); |
1335 | x -= (w/2 ); | 1327 | x -= (w/2 ); |
1336 | } | 1328 | } |
1337 | else | 1329 | else |
1338 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); | 1330 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); |
1339 | x += w; | 1331 | x += w; |
1340 | } | 1332 | } |
1341 | x= 0; | 1333 | x= 0; |
1342 | y= dayLabelHei; | 1334 | y= dayLabelHei; |
1343 | w = colWid; | 1335 | w = colWid; |
1344 | h = cellHei; | 1336 | h = cellHei; |
1345 | for ( i = 0; i < mCellsW.count(); ++i) { | 1337 | for ( i = 0; i < mCellsW.count(); ++i) { |
1346 | if ( i > 6 ) { | 1338 | if ( i > 6 ) { |
1347 | mCellsW[i]->hide(); | 1339 | mCellsW[i]->hide(); |
1348 | continue; | 1340 | continue; |
1349 | } | 1341 | } |
1350 | 1342 | ||
1351 | w = colWid; | 1343 | w = colWid; |
1352 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1344 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1353 | ++w; | 1345 | ++w; |
1354 | } | 1346 | } |
1355 | if ( i == (daysToShow-1-rowModulo)*7) | 1347 | if ( i == (daysToShow-1-rowModulo)*7) |
1356 | ++h; | 1348 | ++h; |
1357 | 1349 | ||
1358 | if ( i >= 5 ) { | 1350 | if ( i >= 5 ) { |
1359 | if ( i ==5 ) { | 1351 | if ( i ==5 ) { |
1360 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1352 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1361 | x -= w ;y += h/2; | 1353 | x -= w ;y += h/2; |
1362 | } else { | 1354 | } else { |
1363 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1355 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1364 | ++w; | 1356 | ++w; |
1365 | } | 1357 | } |
1366 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1358 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1367 | y -= h/2; | 1359 | y -= h/2; |
1368 | } | 1360 | } |
1369 | } else | 1361 | } else |
1370 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1362 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1371 | 1363 | ||
1372 | 1364 | ||
1373 | x += w; | 1365 | x += w; |
1374 | if ( x + w/2 > wid ) { | 1366 | if ( x + w/2 > wid ) { |
1375 | x = 0; | 1367 | x = 0; |
1376 | y += h+dayLabelHei ; | 1368 | y += h+dayLabelHei ; |
1377 | } | 1369 | } |
1378 | } | 1370 | } |
1379 | y= dayLabelHei; | 1371 | y= dayLabelHei; |
1380 | h = cellHei ; | 1372 | h = cellHei ; |
1381 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1373 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1382 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1374 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1383 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1375 | |
1384 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | ||
1385 | mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; | 1376 | mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; |
1386 | updateDayLabels(); | 1377 | updateDayLabels(); |
1387 | bool forceUpdate = !updatePossible; | 1378 | bool forceUpdate = !updatePossible; |
1388 | updatePossible = true; | 1379 | updatePossible = true; |
1389 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1380 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1390 | if ( forceUpdate ) | 1381 | if ( forceUpdate ) |
1391 | updateView(); | 1382 | updateView(); |
1392 | } | 1383 | } |
1393 | void KOMonthView::computeLayout() | 1384 | void KOMonthView::computeLayout() |
1394 | { | 1385 | { |
1395 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 1386 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
1396 | // note this only changes the text if the requested size crosses the | 1387 | // note this only changes the text if the requested size crosses the |
1397 | // threshold between big enough to support the full name and not big | 1388 | // threshold between big enough to support the full name and not big |
1398 | // enough. | 1389 | // enough. |
1390 | |||
1391 | int tWid = topLevelWidget()->size().width(); | ||
1392 | int tHei = topLevelWidget()->size().height(); | ||
1393 | |||
1394 | int wid = size().width();//e | ||
1395 | int hei = size().height()-1; | ||
1396 | |||
1397 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1398 | return; | ||
1399 | |||
1400 | |||
1399 | if ( mShowWeekView ){ | 1401 | if ( mShowWeekView ){ |
1400 | computeLayoutWeek(); | 1402 | computeLayoutWeek(); |
1401 | return; | 1403 | return; |
1402 | } | 1404 | } |
1405 | static int widd = 0; | ||
1406 | static int heigg = 0; | ||
1407 | if ( widd == width() && heigg == height () ) { | ||
1408 | return; | ||
1409 | } | ||
1410 | widd = width() ; | ||
1411 | heigg = height (); | ||
1412 | |||
1403 | int daysToShow = 7; | 1413 | int daysToShow = 7; |
1404 | bool combinedSatSun = false; | 1414 | bool combinedSatSun = false; |
1405 | if (KOPrefs::instance()->mMonthViewSatSunTog ) { | 1415 | if (KOPrefs::instance()->mMonthViewSatSunTog ) { |
1406 | daysToShow = 6; | 1416 | daysToShow = 6; |
1407 | combinedSatSun = true; | 1417 | combinedSatSun = true; |
1408 | } | 1418 | } |
1409 | int tWid = topLevelWidget()->size().width(); | ||
1410 | int tHei = topLevelWidget()->size().height(); | ||
1411 | |||
1412 | int wid = size().width();//e | ||
1413 | int hei = size().height()-1; | ||
1414 | |||
1415 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | ||
1416 | return; | ||
1417 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | ||
1418 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1419 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1419 | int weeklabelwid = fm.width( "888" ); | 1420 | int weeklabelwid = fm.width( "888" ); |
1420 | wid -= weeklabelwid; | 1421 | wid -= weeklabelwid; |
1421 | 1422 | ||
1422 | int colWid = wid / daysToShow; | 1423 | int colWid = wid / daysToShow; |
1423 | int lastCol = wid - ( colWid*6 ); | 1424 | int lastCol = wid - ( colWid*6 ); |
1424 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1425 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1425 | int cellHei = (hei - dayLabelHei) /6; | 1426 | int cellHei = (hei - dayLabelHei) /6; |
1426 | int colModulo = wid % daysToShow; | 1427 | int colModulo = wid % daysToShow; |
1427 | int rowModulo = (hei- dayLabelHei) % 6; | 1428 | int rowModulo = (hei- dayLabelHei) % 6; |
1428 | //qDebug("rowmod %d ", rowModulo); | 1429 | //qDebug("rowmod %d ", rowModulo); |
1429 | int i; | 1430 | int i; |
1430 | int x,y,w,h; | 1431 | int x,y,w,h; |
1431 | x= 0; | 1432 | x= 0; |
1432 | y= 0; | 1433 | y= 0; |
1433 | w = colWid; | 1434 | w = colWid; |
1434 | h = dayLabelHei ; | 1435 | h = dayLabelHei ; |
1435 | for ( i = 0; i < 7; i++) { | 1436 | for ( i = 0; i < 7; i++) { |
1436 | if ( i == daysToShow-colModulo ) | 1437 | if ( i == daysToShow-colModulo ) |
1437 | ++w; | 1438 | ++w; |
1438 | if ( combinedSatSun ) { | 1439 | if ( combinedSatSun ) { |
1439 | if ( i >= daysToShow-1 ) { | 1440 | if ( i >= daysToShow-1 ) { |
1440 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1441 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1441 | x -= w/2 ; | 1442 | x -= w/2 ; |
1442 | } | 1443 | } |
1443 | else | 1444 | else |
1444 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1445 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1445 | } else | 1446 | } else |
1446 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1447 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1447 | x += w; | 1448 | x += w; |
1448 | } | 1449 | } |
1449 | x= 0; | 1450 | x= 0; |
1450 | y= dayLabelHei; | 1451 | y= dayLabelHei; |
1451 | w = colWid; | 1452 | w = colWid; |
1452 | h = cellHei ; | 1453 | h = cellHei ; |
1453 | for ( i = 0; i < mCells.count(); ++i) { | 1454 | for ( i = 0; i < mCells.count(); ++i) { |
1454 | w = colWid; | 1455 | w = colWid; |
1455 | if ( ((i) % 7) >= 7-colModulo ) { | 1456 | if ( ((i) % 7) >= 7-colModulo ) { |
1456 | ++w; | 1457 | ++w; |
1457 | } | 1458 | } |
1458 | if ( i == (6-rowModulo)*7) | 1459 | if ( i == (6-rowModulo)*7) |
1459 | ++h; | 1460 | ++h; |
1460 | if ( combinedSatSun ) { | 1461 | if ( combinedSatSun ) { |
1461 | if ( (i)%7 >= daysToShow-1 ) { | 1462 | if ( (i)%7 >= daysToShow-1 ) { |
1462 | if ( (i)%7 == daysToShow-1 ) { | 1463 | if ( (i)%7 == daysToShow-1 ) { |
1463 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1464 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1464 | x -= w ;y += h/2; | 1465 | x -= w ;y += h/2; |
1465 | } else { | 1466 | } else { |
1466 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1467 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1467 | y -= h/2; | 1468 | y -= h/2; |
1468 | } | 1469 | } |
1469 | } else | 1470 | } else |
1470 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1471 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1471 | 1472 | ||
1472 | } | 1473 | } |
1473 | else | 1474 | else |
1474 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1475 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1475 | x += w; | 1476 | x += w; |
1476 | if ( x + w/2 > wid ) { | 1477 | if ( x + w/2 > wid ) { |
1477 | x = 0; | 1478 | x = 0; |
1478 | y += h; | 1479 | y += h; |
1479 | } | 1480 | } |
1480 | } | 1481 | } |
1481 | y= dayLabelHei; | 1482 | y= dayLabelHei; |
1482 | h = cellHei ; | 1483 | h = cellHei ; |
1483 | for ( i = 0; i < 6; i++) { | 1484 | for ( i = 0; i < 6; i++) { |
1484 | if ( i == (6-rowModulo)) | 1485 | if ( i == (6-rowModulo)) |
1485 | ++h; | 1486 | ++h; |
1486 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1487 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1487 | y += h; | 1488 | y += h; |
1488 | } | 1489 | } |
1489 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1490 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1490 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | ||
1491 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | ||
1492 | mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1491 | mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1493 | qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel); | 1492 | qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel); |
1494 | updateDayLabels(); | 1493 | updateDayLabels(); |
1495 | bool forceUpdate = !updatePossible; | 1494 | bool forceUpdate = !updatePossible; |
1496 | updatePossible = true; | 1495 | updatePossible = true; |
1497 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | ||
1498 | if ( forceUpdate ) | 1496 | if ( forceUpdate ) |
1499 | updateView(); | 1497 | updateView(); |
1500 | } | 1498 | } |
1501 | 1499 | ||
1502 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1500 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1503 | { | 1501 | { |
1504 | mContextMenu->showIncidencePopup(incidence); | 1502 | mContextMenu->showIncidencePopup(incidence); |
1505 | /* | 1503 | |
1506 | if( incidence && incidence->type() == "Event" ) { | ||
1507 | Event *event = static_cast<Event *>(incidence); | ||
1508 | mContextMenu->showEventPopup(event); | ||
1509 | } else { | ||
1510 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | ||
1511 | } | ||
1512 | */ | ||
1513 | } | 1504 | } |
1514 | MonthViewCell * KOMonthView::selectedCell( ) | 1505 | MonthViewCell * KOMonthView::selectedCell( ) |
1515 | { | 1506 | { |
1516 | return mSelectedCell; | 1507 | return mSelectedCell; |
1517 | } | 1508 | } |
1518 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1509 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1519 | { | 1510 | { |
1520 | //qDebug("KOMonthView::setSelectedCell %x ", cell); | ||
1521 | if ( mSelectedCell && mSelectedCell != cell ) { | 1511 | if ( mSelectedCell && mSelectedCell != cell ) { |
1522 | MonthViewCell * mvc = mSelectedCell; | 1512 | MonthViewCell * mvc = mSelectedCell; |
1523 | mSelectedCell = cell; | 1513 | mSelectedCell = cell; |
1524 | mvc->deselect(); | 1514 | mvc->deselect(); |
1525 | } else | 1515 | } else |
1526 | mSelectedCell = cell; | 1516 | mSelectedCell = cell; |
1527 | // if ( mSelectedCell ) | ||
1528 | // mSelectedCell->select(); | ||
1529 | if ( !mSelectedCell ) | 1517 | if ( !mSelectedCell ) |
1530 | emit incidenceSelected( 0 ); | 1518 | emit incidenceSelected( 0 ); |
1531 | else | 1519 | else |
1532 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1520 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1533 | } | 1521 | } |
1534 | 1522 | ||
1535 | void KOMonthView::processSelectionChange() | 1523 | void KOMonthView::processSelectionChange() |
1536 | { | 1524 | { |
1537 | QPtrList<Incidence> incidences = selectedIncidences(); | 1525 | QPtrList<Incidence> incidences = selectedIncidences(); |
1538 | if (incidences.count() > 0) { | 1526 | if (incidences.count() > 0) { |
1539 | emit incidenceSelected( incidences.first() ); | 1527 | emit incidenceSelected( incidences.first() ); |
1540 | } else { | 1528 | } else { |
1541 | emit incidenceSelected( 0 ); | 1529 | emit incidenceSelected( 0 ); |
1542 | } | 1530 | } |
1543 | } | 1531 | } |
1544 | 1532 | ||
1545 | void KOMonthView::clearSelection() | 1533 | void KOMonthView::clearSelection() |
1546 | { | 1534 | { |
1547 | if ( mSelectedCell ) { | 1535 | if ( mSelectedCell ) { |
1548 | mSelectedCell->deselect(); | 1536 | mSelectedCell->deselect(); |
1549 | mSelectedCell = 0; | 1537 | mSelectedCell = 0; |
1550 | } | 1538 | } |
1551 | } | 1539 | } |
1552 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1540 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1553 | { | 1541 | { |
1554 | //qDebug("KOMonthView::keyPressEvent "); | 1542 | //qDebug("KOMonthView::keyPressEvent "); |
1555 | switch(e->key()) { | 1543 | switch(e->key()) { |
1556 | case Key_Up: | 1544 | case Key_Up: |
1557 | { | 1545 | { |
1558 | emit prevMonth(); | 1546 | emit prevMonth(); |
1559 | if ( mShowWeekView ) | 1547 | if ( mShowWeekView ) |
1560 | mCellsW[0]->setFocus(); | 1548 | mCellsW[0]->setFocus(); |
1561 | else | 1549 | else |
1562 | mCells[0]->setFocus(); | 1550 | mCells[0]->setFocus(); |
1563 | } | 1551 | } |
1564 | e->accept(); | 1552 | e->accept(); |
1565 | break; | 1553 | break; |
1566 | case Key_Down: | 1554 | case Key_Down: |
1567 | { | 1555 | { |
1568 | emit nextMonth(); | 1556 | emit nextMonth(); |
1569 | if ( mShowWeekView ) | 1557 | if ( mShowWeekView ) |
1570 | mCellsW[0]->setFocus(); | 1558 | mCellsW[0]->setFocus(); |
1571 | else | 1559 | else |
1572 | mCells[0]->setFocus(); | 1560 | mCells[0]->setFocus(); |
1573 | 1561 | ||
1574 | } | 1562 | } |
1575 | e->accept(); | 1563 | e->accept(); |
1576 | break; | 1564 | break; |
1577 | case Key_Return: | 1565 | case Key_Return: |
1578 | case Key_Enter: | 1566 | case Key_Enter: |
1579 | { | 1567 | { |
1580 | selectInternalWeekNum ( currentWeek() ); | 1568 | selectInternalWeekNum ( currentWeek() ); |
1581 | } | 1569 | } |
1582 | e->accept(); | 1570 | e->accept(); |
1583 | break; | 1571 | break; |
1584 | default: | 1572 | default: |
1585 | e->ignore(); | 1573 | e->ignore(); |
1586 | break; | 1574 | break; |
1587 | } | 1575 | } |
1588 | } | 1576 | } |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index d70cda1..9dbe319 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -133,166 +133,165 @@ class MonthViewCell : public QWidget | |||
133 | void setDate( const QDate & ); | 133 | void setDate( const QDate & ); |
134 | QDate date() const; | 134 | QDate date() const; |
135 | 135 | ||
136 | void setPrimary( bool ); | 136 | void setPrimary( bool ); |
137 | bool isPrimary() const; | 137 | bool isPrimary() const; |
138 | 138 | ||
139 | void setHoliday( bool ); | 139 | void setHoliday( bool ); |
140 | void setHoliday( const QString & ); | 140 | void setHoliday( const QString & ); |
141 | 141 | ||
142 | void updateCell(); | 142 | void updateCell(); |
143 | void startUpdateCell(); | 143 | void startUpdateCell(); |
144 | void finishUpdateCell(); | 144 | void finishUpdateCell(); |
145 | void insertEvent(Event *); | 145 | void insertEvent(Event *); |
146 | void insertTodo(Todo *); | 146 | void insertTodo(Todo *); |
147 | 147 | ||
148 | void updateConfig( bool bigFont = false ); | 148 | void updateConfig( bool bigFont = false ); |
149 | 149 | ||
150 | void enableScrollBars( bool ); | 150 | void enableScrollBars( bool ); |
151 | 151 | ||
152 | Incidence *selectedIncidence(); | 152 | Incidence *selectedIncidence(); |
153 | QDate selectedIncidenceDate(); | 153 | QDate selectedIncidenceDate(); |
154 | 154 | ||
155 | void deselect(); | 155 | void deselect(); |
156 | void select(); | 156 | void select(); |
157 | void clear(); | 157 | void clear(); |
158 | 158 | ||
159 | #ifdef DESKTOP_VERSION | 159 | #ifdef DESKTOP_VERSION |
160 | static QToolTipGroup *toolTipGroup(); | 160 | static QToolTipGroup *toolTipGroup(); |
161 | #endif | 161 | #endif |
162 | signals: | 162 | signals: |
163 | void defaultAction( Incidence * ); | 163 | void defaultAction( Incidence * ); |
164 | void newEventSignal( QDateTime ); | 164 | void newEventSignal( QDateTime ); |
165 | void showDaySignal( QDate ); | 165 | void showDaySignal( QDate ); |
166 | 166 | ||
167 | protected: | 167 | protected: |
168 | QString mToolTip; | 168 | QString mToolTip; |
169 | void resizeEvent( QResizeEvent * ); | 169 | void resizeEvent( QResizeEvent * ); |
170 | 170 | ||
171 | protected slots: | 171 | protected slots: |
172 | void defaultAction( QListBoxItem * ); | 172 | void defaultAction( QListBoxItem * ); |
173 | void contextMenu( QListBoxItem * ); | 173 | void contextMenu( QListBoxItem * ); |
174 | void selection( QListBoxItem * ); | 174 | void selection( QListBoxItem * ); |
175 | void cellClicked( QListBoxItem * ); | 175 | void cellClicked( QListBoxItem * ); |
176 | void newEvent(); | 176 | void newEvent(); |
177 | void showDay(); | 177 | void showDay(); |
178 | 178 | ||
179 | private: | 179 | private: |
180 | KOMonthView *mMonthView; | 180 | KOMonthView *mMonthView; |
181 | 181 | ||
182 | QDate mDate; | 182 | QDate mDate; |
183 | bool mPrimary; | 183 | bool mPrimary; |
184 | bool mHoliday; | 184 | bool mHoliday; |
185 | QString mHolidayString; | 185 | QString mHolidayString; |
186 | 186 | ||
187 | //QLabel *mLabel; | 187 | //QLabel *mLabel; |
188 | QPushButton *mLabel; | 188 | QPushButton *mLabel; |
189 | QListBox *mItemList; | 189 | QListBox *mItemList; |
190 | #ifdef DESKTOP_VERSION | 190 | #ifdef DESKTOP_VERSION |
191 | static QToolTipGroup *mToolTipGroup; | 191 | static QToolTipGroup *mToolTipGroup; |
192 | #endif | 192 | #endif |
193 | QSize mLabelSize; | 193 | QSize mLabelSize; |
194 | QSize mLabelBigSize; | 194 | QSize mLabelBigSize; |
195 | QPalette mHolidayPalette; | 195 | QPalette mHolidayPalette; |
196 | QPalette mStandardPalette; | 196 | QPalette mStandardPalette; |
197 | QPalette mPrimaryPalette; | 197 | QPalette mPrimaryPalette; |
198 | QPalette mNonPrimaryPalette; | 198 | QPalette mNonPrimaryPalette; |
199 | void setMyPalette(); | 199 | void setMyPalette(); |
200 | QPalette getPalette (); | 200 | QPalette getPalette (); |
201 | void keyPressEvent ( QKeyEvent * ) ; | 201 | void keyPressEvent ( QKeyEvent * ) ; |
202 | 202 | ||
203 | }; | 203 | }; |
204 | 204 | ||
205 | 205 | ||
206 | class KOMonthView: public KOEventView | 206 | class KOMonthView: public KOEventView |
207 | { | 207 | { |
208 | Q_OBJECT | 208 | Q_OBJECT |
209 | public: | 209 | public: |
210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
211 | ~KOMonthView(); | 211 | ~KOMonthView(); |
212 | 212 | ||
213 | /** Returns maximum number of days supported by the komonthview */ | 213 | /** Returns maximum number of days supported by the komonthview */ |
214 | virtual int maxDatesHint(); | 214 | virtual int maxDatesHint(); |
215 | 215 | ||
216 | /** Returns number of currently shown dates. */ | 216 | /** Returns number of currently shown dates. */ |
217 | virtual int currentDateCount(); | 217 | virtual int currentDateCount(); |
218 | 218 | ||
219 | /** returns the currently selected events */ | 219 | /** returns the currently selected events */ |
220 | virtual QPtrList<Incidence> selectedIncidences(); | 220 | virtual QPtrList<Incidence> selectedIncidences(); |
221 | 221 | ||
222 | /** returns dates of the currently selected events */ | 222 | /** returns dates of the currently selected events */ |
223 | virtual DateList selectedDates(); | 223 | virtual DateList selectedDates(); |
224 | 224 | ||
225 | virtual void printPreview(CalPrinter *calPrinter, | 225 | virtual void printPreview(CalPrinter *calPrinter, |
226 | const QDate &, const QDate &); | 226 | const QDate &, const QDate &); |
227 | bool isMonthView() { return true; } | 227 | bool isMonthView() { return true; } |
228 | bool isUpdatePossible() { return updatePossible; } | 228 | bool isUpdatePossible() { return updatePossible; } |
229 | void setIgnoreResizeEvent( int c, int h ) { ignoreResizeEvent = c ;ignoreResizeEventHeight = h;} | 229 | void setIgnoreResizeEvent( int c ) { ignoreResizeEvent = c ;} |
230 | 230 | ||
231 | MonthViewCell * selectedCell(); | 231 | MonthViewCell * selectedCell(); |
232 | public slots: | 232 | public slots: |
233 | virtual void updateView(); | 233 | virtual void updateView(); |
234 | virtual void updateConfig(); | 234 | virtual void updateConfig(); |
235 | virtual void showDates(const QDate &start, const QDate &end); | 235 | virtual void showDates(const QDate &start, const QDate &end); |
236 | virtual void showEvents(QPtrList<Event> eventList); | 236 | virtual void showEvents(QPtrList<Event> eventList); |
237 | 237 | ||
238 | void changeEventDisplay(Event *, int); | 238 | void changeEventDisplay(Event *, int); |
239 | 239 | ||
240 | void clearSelection(); | 240 | void clearSelection(); |
241 | 241 | ||
242 | void showContextMenu( Incidence * ); | 242 | void showContextMenu( Incidence * ); |
243 | 243 | ||
244 | void setSelectedCell( MonthViewCell * ); | 244 | void setSelectedCell( MonthViewCell * ); |
245 | 245 | ||
246 | protected slots: | 246 | protected slots: |
247 | void selectInternalWeekNum ( int ); | 247 | void selectInternalWeekNum ( int ); |
248 | void switchView(); | 248 | void switchView(); |
249 | void processSelectionChange(); | 249 | void processSelectionChange(); |
250 | signals: | 250 | signals: |
251 | void nextMonth(); | 251 | void nextMonth(); |
252 | void prevMonth(); | 252 | void prevMonth(); |
253 | void showNavigator( bool ); | 253 | void showNavigator( bool ); |
254 | void selectWeekNum ( int ); | 254 | void selectWeekNum ( int ); |
255 | void showDaySignal( QDate ); | 255 | void showDaySignal( QDate ); |
256 | protected: | 256 | protected: |
257 | void resizeEvent(QResizeEvent *); | 257 | void resizeEvent(QResizeEvent *); |
258 | void viewChanged(); | 258 | void viewChanged(); |
259 | void updateDayLabels(); | 259 | void updateDayLabels(); |
260 | 260 | ||
261 | private: | 261 | private: |
262 | int ignoreResizeEvent; | 262 | int ignoreResizeEvent; |
263 | int ignoreResizeEventHeight; | ||
264 | int currentWeek(); | 263 | int currentWeek(); |
265 | bool clPending; | 264 | bool clPending; |
266 | QWidgetStack * mWidStack; | 265 | QWidgetStack * mWidStack; |
267 | QWidget* mMonthView; | 266 | QWidget* mMonthView; |
268 | QWidget* mWeekView; | 267 | QWidget* mWeekView; |
269 | bool mShowWeekView; | 268 | bool mShowWeekView; |
270 | bool updatePossible; | 269 | bool updatePossible; |
271 | int mDaysPerWeek; | 270 | int mDaysPerWeek; |
272 | int mNumWeeks; | 271 | int mNumWeeks; |
273 | int mNumCells; | 272 | int mNumCells; |
274 | bool mWeekStartsMonday; | 273 | bool mWeekStartsMonday; |
275 | void computeLayout(); | 274 | void computeLayout(); |
276 | void computeLayoutWeek(); | 275 | void computeLayoutWeek(); |
277 | 276 | ||
278 | QPtrVector<MonthViewCell> mCells; | 277 | QPtrVector<MonthViewCell> mCells; |
279 | QPtrVector<QLabel> mDayLabels; | 278 | QPtrVector<QLabel> mDayLabels; |
280 | QPtrVector<KOWeekButton> mWeekLabels; | 279 | QPtrVector<KOWeekButton> mWeekLabels; |
281 | QPtrVector<MonthViewCell> mCellsW; | 280 | QPtrVector<MonthViewCell> mCellsW; |
282 | QPtrVector<QLabel> mDayLabelsW; | 281 | QPtrVector<QLabel> mDayLabelsW; |
283 | QPtrVector<KOWeekButton> mWeekLabelsW; | 282 | QPtrVector<KOWeekButton> mWeekLabelsW; |
284 | 283 | ||
285 | bool mShortDayLabelsM; | 284 | bool mShortDayLabelsM; |
286 | bool mShortDayLabelsW; | 285 | bool mShortDayLabelsW; |
287 | int mWidthLongDayLabel; | 286 | int mWidthLongDayLabel; |
288 | 287 | ||
289 | QDate mStartDate; | 288 | QDate mStartDate; |
290 | 289 | ||
291 | MonthViewCell *mSelectedCell; | 290 | MonthViewCell *mSelectedCell; |
292 | 291 | ||
293 | KOEventPopupMenu *mContextMenu; | 292 | KOEventPopupMenu *mContextMenu; |
294 | void keyPressEvent ( QKeyEvent * ) ; | 293 | void keyPressEvent ( QKeyEvent * ) ; |
295 | 294 | ||
296 | }; | 295 | }; |
297 | 296 | ||
298 | #endif | 297 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index c35de0a..62d3e7f 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -107,217 +107,217 @@ void KOViewManager::showDateView( int view, QDate date) | |||
107 | //qDebug("date %d %s", view, date.toString().latin1()); | 107 | //qDebug("date %d %s", view, date.toString().latin1()); |
108 | 108 | ||
109 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); | 109 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
110 | bool savemFlagShowNextxDays = mFlagShowNextxDays; | 110 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
111 | mFlagShowNextxDays = false; | 111 | mFlagShowNextxDays = false; |
112 | if ( view == 3 ) { | 112 | if ( view == 3 ) { |
113 | //mCurrentAgendaView = 1 ; | 113 | //mCurrentAgendaView = 1 ; |
114 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | 114 | lastDate = mMainView->dateNavigator()->selectedDates().first(); |
115 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | 115 | lastCount = mMainView->dateNavigator()->selectedDates().count(); |
116 | lastNDMode = savemFlagShowNextxDays; | 116 | lastNDMode = savemFlagShowNextxDays; |
117 | mMainView->showDay( date ); | 117 | mMainView->showDay( date ); |
118 | } else if (view == 4 ) { | 118 | } else if (view == 4 ) { |
119 | mCurrentAgendaView = 7 ; | 119 | mCurrentAgendaView = 7 ; |
120 | mMainView->dateNavigator()->selectDates( date, 7 ); | 120 | mMainView->dateNavigator()->selectDates( date, 7 ); |
121 | } else if (view == 5 ) { | 121 | } else if (view == 5 ) { |
122 | mCurrentAgendaView = 14 ; | 122 | mCurrentAgendaView = 14 ; |
123 | mMainView->dateNavigator()->selectDates( date, 14); | 123 | mMainView->dateNavigator()->selectDates( date, 14); |
124 | } else if (view == 6 ) { | 124 | } else if (view == 6 ) { |
125 | //mMainView->dateNavigator()->selectDates( date, 7 ); | 125 | //mMainView->dateNavigator()->selectDates( date, 7 ); |
126 | showMonthView(); | 126 | showMonthView(); |
127 | } else if (view == 7 ) { | 127 | } else if (view == 7 ) { |
128 | mMainView->dateNavigator()->selectDate( date ); | 128 | mMainView->dateNavigator()->selectDate( date ); |
129 | showJournalView(); | 129 | showJournalView(); |
130 | } else if (view == 8 ) { | 130 | } else if (view == 8 ) { |
131 | globalFlagBlockAgenda = 1; | 131 | globalFlagBlockAgenda = 1; |
132 | if ( mCurrentAgendaView != 3 ) | 132 | if ( mCurrentAgendaView != 3 ) |
133 | mCurrentAgendaView = -1; | 133 | mCurrentAgendaView = -1; |
134 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 134 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
135 | globalFlagBlockAgenda = 2; | 135 | globalFlagBlockAgenda = 2; |
136 | mMainView->dateNavigator()->selectDates( date , | 136 | mMainView->dateNavigator()->selectDates( date , |
137 | KOPrefs::instance()->mNextXDays ); | 137 | KOPrefs::instance()->mNextXDays ); |
138 | mFlagShowNextxDays = true; | 138 | mFlagShowNextxDays = true; |
139 | mCurrentAgendaView = 3 ; | 139 | mCurrentAgendaView = 3 ; |
140 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) | 140 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
141 | if ( lastMode ) { | 141 | if ( lastMode ) { |
142 | mCurrentAgendaView = lastCount ; | 142 | mCurrentAgendaView = lastCount ; |
143 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | 143 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); |
144 | mFlagShowNextxDays = lastNDMode; | 144 | mFlagShowNextxDays = lastNDMode; |
145 | if ( mFlagShowNextxDays ) { | 145 | if ( mFlagShowNextxDays ) { |
146 | mCurrentAgendaView = 3 ; | 146 | mCurrentAgendaView = 3 ; |
147 | } | 147 | } |
148 | } else | 148 | } else |
149 | showWeekView(); | 149 | showWeekView(); |
150 | } else if (view == 10) { | 150 | } else if (view == 10) { |
151 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 151 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
152 | } | 152 | } |
153 | lastMode = view; | 153 | lastMode = view; |
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
157 | 157 | ||
158 | void KOViewManager::writeSettings(KConfig *config) | 158 | void KOViewManager::writeSettings(KConfig *config) |
159 | { | 159 | { |
160 | config->setGroup("General"); | 160 | config->setGroup("General"); |
161 | 161 | ||
162 | QString view; | 162 | QString view; |
163 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 163 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
164 | else if (mCurrentView == mMonthView) view = "Month"; | 164 | else if (mCurrentView == mMonthView) view = "Month"; |
165 | else if (mCurrentView == mListView) view = "List"; | 165 | else if (mCurrentView == mListView) view = "List"; |
166 | else if (mCurrentView == mJournalView) view = "Journal"; | 166 | else if (mCurrentView == mJournalView) view = "Journal"; |
167 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 167 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
168 | else if (mCurrentView == mTodoView) view = "Todo"; | 168 | else if (mCurrentView == mTodoView) view = "Todo"; |
169 | else view = "Agenda"; | 169 | else view = "Agenda"; |
170 | 170 | ||
171 | config->writeEntry("Current View",view); | 171 | config->writeEntry("Current View",view); |
172 | 172 | ||
173 | if (mAgendaView) { | 173 | if (mAgendaView) { |
174 | mAgendaView->writeSettings(config); | 174 | mAgendaView->writeSettings(config); |
175 | } | 175 | } |
176 | if (mTimeSpanView) { | 176 | if (mTimeSpanView) { |
177 | mTimeSpanView->writeSettings(config); | 177 | mTimeSpanView->writeSettings(config); |
178 | } | 178 | } |
179 | if (mListView) { | 179 | if (mListView) { |
180 | mListView->writeSettings(config); | 180 | mListView->writeSettings(config); |
181 | } | 181 | } |
182 | if (mTodoView) { | 182 | if (mTodoView) { |
183 | mTodoView->saveLayout(config,"Todo View"); | 183 | mTodoView->saveLayout(config,"Todo View"); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 187 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
188 | { | 188 | { |
189 | 189 | ||
190 | //mFlagShowNextxDays = false; | 190 | //mFlagShowNextxDays = false; |
191 | //if(view == mCurrentView) return; | 191 | //if(view == mCurrentView) return; |
192 | if ( view == 0 ) { | 192 | if ( view == 0 ) { |
193 | view = mCurrentView; | 193 | view = mCurrentView; |
194 | if ( view == 0 ) | 194 | if ( view == 0 ) |
195 | return; | 195 | return; |
196 | } | 196 | } |
197 | bool full = fullScreen; | 197 | bool full = fullScreen; |
198 | if(view == mCurrentView && view != mWhatsNextView ) { | 198 | if(view == mCurrentView && view != mWhatsNextView ) { |
199 | if ( mCurrentAgendaView < 0 ) | 199 | if ( mCurrentAgendaView < 0 ) |
200 | return; | 200 | return; |
201 | full = mMainView->leftFrame()->isVisible(); | 201 | full = mMainView->leftFrame()->isVisible(); |
202 | } else { | 202 | } else { |
203 | if ( view == mMonthView && mMonthView) | ||
204 | mMonthView->setIgnoreResizeEvent( 1 ); | ||
203 | mCurrentView = view; | 205 | mCurrentView = view; |
204 | // bool full = fullScreen; | 206 | // bool full = fullScreen; |
205 | bool isFull = !mMainView->leftFrame()->isVisible(); | 207 | bool isFull = !mMainView->leftFrame()->isVisible(); |
206 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 208 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
207 | full = true; | 209 | full = true; |
208 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 210 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
209 | full = false; | 211 | full = false; |
210 | } | 212 | } |
211 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 213 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
212 | //raiseCurrentView( full ); | 214 | //raiseCurrentView( full ); |
213 | mMainView->processIncidenceSelection( 0 ); | 215 | mMainView->processIncidenceSelection( 0 ); |
214 | //mMainView->updateView(); | 216 | //mMainView->updateView(); |
215 | raiseCurrentView( full, true ); | 217 | raiseCurrentView( full, true ); |
216 | mMainView->adaptNavigationUnits(); | 218 | mMainView->adaptNavigationUnits(); |
217 | } | 219 | } |
218 | 220 | ||
219 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 221 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
220 | { | 222 | { |
221 | mCurrentAgendaView = 0; | 223 | mCurrentAgendaView = 0; |
222 | int wid = mMainView->width() ; | 224 | int wid = mMainView->width() ; |
223 | int hei = mMainView->height(); | 225 | int hei = mMainView->height(); |
224 | if ( mCurrentView == mMonthView ) { | 226 | if ( mCurrentView == mMonthView ) { |
225 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { | 227 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { |
226 | |||
227 | mMonthView->setIgnoreResizeEvent( 2 ,mMainView->navigatorBar()->height()); | ||
228 | mMainView->navigatorBar()->show(); | 228 | mMainView->navigatorBar()->show(); |
229 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 229 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
230 | } | 230 | } |
231 | //mMainView->navigatorBar()->hide(); | 231 | //mMainView->navigatorBar()->hide(); |
232 | } else { | 232 | } else { |
233 | mMainView->navigatorBar()->hide(); | 233 | mMainView->navigatorBar()->hide(); |
234 | } | 234 | } |
235 | if ( fullScreen ) { | 235 | if ( fullScreen ) { |
236 | mMainView->leftFrame()->hide(); | 236 | mMainView->leftFrame()->hide(); |
237 | } else { | 237 | } else { |
238 | mMainView->leftFrame()->show(); | 238 | mMainView->leftFrame()->show(); |
239 | if ( KOPrefs::instance()->mVerticalScreen ) | 239 | if ( KOPrefs::instance()->mVerticalScreen ) |
240 | hei -= mMainView->leftFrame()->height(); | 240 | hei -= mMainView->leftFrame()->height(); |
241 | else | 241 | else |
242 | wid -= mMainView->leftFrame()->width(); | 242 | wid -= mMainView->leftFrame()->width(); |
243 | } | 243 | } |
244 | emit signalFullScreen( !fullScreen ); | 244 | emit signalFullScreen( !fullScreen ); |
245 | if ( callUpdateView ) | 245 | if ( callUpdateView ) |
246 | mMainView->updateView(); | 246 | mMainView->updateView(); |
247 | 247 | ||
248 | if ( globalFlagBlockAgenda == 5 ) { | 248 | if ( globalFlagBlockAgenda == 5 ) { |
249 | globalFlagBlockAgenda = 4; | 249 | globalFlagBlockAgenda = 4; |
250 | globalFlagBlockAgendaItemPaint = 1; | 250 | globalFlagBlockAgendaItemPaint = 1; |
251 | } | 251 | } |
252 | mMainView->viewStack()->raiseWidget(mCurrentView); | 252 | mMainView->viewStack()->raiseWidget(mCurrentView); |
253 | if ( globalFlagBlockAgenda == 4 ) { | 253 | if ( globalFlagBlockAgenda == 4 ) { |
254 | if ( mCurrentView == mAgendaView ) { | 254 | if ( mCurrentView == mAgendaView ) { |
255 | //globalFlagBlockAgenda =1 ; | 255 | //globalFlagBlockAgenda =1 ; |
256 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 256 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
257 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 257 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
258 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 258 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
259 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 259 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
260 | qApp->processEvents(); | 260 | qApp->processEvents(); |
261 | //qDebug("qApp->processEvents() "); | 261 | //qDebug("qApp->processEvents() "); |
262 | globalFlagBlockAgenda = 0; | 262 | globalFlagBlockAgenda = 0; |
263 | mAgendaView->repaintAgenda(); | 263 | mAgendaView->repaintAgenda(); |
264 | 264 | ||
265 | } | 265 | } |
266 | globalFlagBlockAgenda = 0; | 266 | globalFlagBlockAgenda = 0; |
267 | } | 267 | } |
268 | emit signalAgendaView( mCurrentView == mAgendaView ); | 268 | emit signalAgendaView( mCurrentView == mAgendaView ); |
269 | //qDebug("raiseCurrentView ende "); | 269 | //qDebug("raiseCurrentView ende "); |
270 | 270 | ||
271 | } | 271 | } |
272 | 272 | ||
273 | void KOViewManager::updateView() | 273 | void KOViewManager::updateView() |
274 | { | 274 | { |
275 | // qDebug("KOViewManager::updateView() "); | 275 | // qDebug("KOViewManager::updateView() "); |
276 | // if we are updating mTodoView, we get endless recursion | 276 | // if we are updating mTodoView, we get endless recursion |
277 | if ( mTodoView == mCurrentView ) | 277 | if ( mTodoView == mCurrentView ) |
278 | return; | 278 | return; |
279 | if ( mCurrentView ) mCurrentView->updateView(); | 279 | if ( mCurrentView ) mCurrentView->updateView(); |
280 | 280 | ||
281 | } | 281 | } |
282 | 282 | ||
283 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 283 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
284 | { | 284 | { |
285 | // kdDebug() << "KOViewManager::updateView()" << endl; | 285 | // kdDebug() << "KOViewManager::updateView()" << endl; |
286 | 286 | ||
287 | if (mCurrentView) mCurrentView->showDates(start, end); | 287 | if (mCurrentView) mCurrentView->showDates(start, end); |
288 | 288 | ||
289 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); | 289 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
290 | } | 290 | } |
291 | 291 | ||
292 | 292 | ||
293 | void KOViewManager::updateWNview() | 293 | void KOViewManager::updateWNview() |
294 | { | 294 | { |
295 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 295 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
296 | mWhatsNextView->updateView(); | 296 | mWhatsNextView->updateView(); |
297 | 297 | ||
298 | } | 298 | } |
299 | void KOViewManager::showWhatsNextView() | 299 | void KOViewManager::showWhatsNextView() |
300 | { | 300 | { |
301 | if (!mWhatsNextView) { | 301 | if (!mWhatsNextView) { |
302 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 302 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
303 | "KOViewManager::WhatsNextView"); | 303 | "KOViewManager::WhatsNextView"); |
304 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 304 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
305 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 305 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
306 | addView(mWhatsNextView); | 306 | addView(mWhatsNextView); |
307 | connect(this, SIGNAL( printWNV() ), | 307 | connect(this, SIGNAL( printWNV() ), |
308 | mWhatsNextView, SLOT( printMe() ) ); | 308 | mWhatsNextView, SLOT( printMe() ) ); |
309 | } | 309 | } |
310 | globalFlagBlockAgenda = 1; | 310 | globalFlagBlockAgenda = 1; |
311 | showView(mWhatsNextView, true ); | 311 | showView(mWhatsNextView, true ); |
312 | //mWhatsNextView->updateView(); | 312 | //mWhatsNextView->updateView(); |
313 | 313 | ||
314 | } | 314 | } |
315 | 315 | ||
316 | void KOViewManager::showListView() | 316 | void KOViewManager::showListView() |
317 | { | 317 | { |
318 | if (!mListView) { | 318 | if (!mListView) { |
319 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 319 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
320 | addView(mListView); | 320 | addView(mListView); |
321 | 321 | ||
322 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 322 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
323 | mMainView, SLOT(showIncidence(Incidence *))); | 323 | mMainView, SLOT(showIncidence(Incidence *))); |