author | zautrix <zautrix> | 2005-02-04 16:26:39 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-04 16:26:39 (UTC) |
commit | b7c502a598566264e6e7129524104b6e39438f03 (patch) (unidiff) | |
tree | 9be2449e9607b7bb73f94f85ae3abb27412fe682 | |
parent | 76e6ad6cc6a3be8df896a3e7cf8375234b3212a9 (diff) | |
download | kdepimpi-b7c502a598566264e6e7129524104b6e39438f03.zip kdepimpi-b7c502a598566264e6e7129524104b6e39438f03.tar.gz kdepimpi-b7c502a598566264e6e7129524104b6e39438f03.tar.bz2 |
mv faster
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 207 | ||||
-rw-r--r-- | korganizer/komonthview.h | 10 |
3 files changed, 168 insertions, 51 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index e24ee43..3ba0841 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -11,4 +11,6 @@ Added to the event/todo viewer the option to send an email to | |||
11 | all attendees or all selected (with RSVP) attendees. | 11 | all attendees or all selected (with RSVP) attendees. |
12 | 12 | ||
13 | Made the week-month mode changing in month view faster. | ||
14 | |||
13 | ********** VERSION 2.0.2 ************ | 15 | ********** VERSION 2.0.2 ************ |
14 | 16 | ||
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 9c1e4c3..daa37fd 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -24,4 +24,5 @@ | |||
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qwidgetstack.h> | ||
26 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
27 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
@@ -269,6 +270,6 @@ int MonthViewItem::width(const QListBox *lb) const | |||
269 | 270 | ||
270 | 271 | ||
271 | MonthViewCell::MonthViewCell( KOMonthView *parent) | 272 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
272 | : QWidget( parent ), | 273 | : QWidget( par ), |
273 | mMonthView( parent ) | 274 | mMonthView( parent ) |
274 | { | 275 | { |
@@ -767,4 +768,18 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
767 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 768 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
768 | { | 769 | { |
770 | |||
771 | clPending = true; | ||
772 | mWidStack = new QWidgetStack( this ); | ||
773 | QHBoxLayout* hb = new QHBoxLayout( this ); | ||
774 | mMonthView = new QWidget( mWidStack ); | ||
775 | mWeekView = new QWidget( mWidStack ); | ||
776 | #if QT_VERSION >= 0x030000 | ||
777 | mWidStack->addWidget(mMonthView ); | ||
778 | mWidStack->addWidget(mWeekView ); | ||
779 | #else | ||
780 | mWidStack->addWidget( mMonthView, 1 ); | ||
781 | mWidStack->addWidget( mWeekView , 1 ); | ||
782 | #endif | ||
783 | hb->addWidget( mWidStack ); | ||
769 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 784 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
770 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 785 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
@@ -774,8 +789,6 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
774 | mCells.setAutoDelete( true ); | 789 | mCells.setAutoDelete( true ); |
775 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 790 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
776 | // mDayLayout = new QGridLayout( this ); | ||
777 | // create the day of the week labels (Sun, Mon, etc) and add them to | ||
778 | // the layout. | ||
779 | mDayLabels.resize( mDaysPerWeek ); | 791 | mDayLabels.resize( mDaysPerWeek ); |
792 | mDayLabelsW.resize( mDaysPerWeek ); | ||
780 | QFont bfont = font(); | 793 | QFont bfont = font(); |
781 | if ( QApplication::desktop()->width() < 650 ) { | 794 | if ( QApplication::desktop()->width() < 650 ) { |
@@ -786,5 +799,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
786 | 799 | ||
787 | for( i = 0; i < mDaysPerWeek; i++ ) { | 800 | for( i = 0; i < mDaysPerWeek; i++ ) { |
788 | QLabel *label = new QLabel( this ); | 801 | QLabel *label = new QLabel( mMonthView ); |
789 | label->setFont(bfont); | 802 | label->setFont(bfont); |
790 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 803 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
@@ -792,10 +805,17 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
792 | label->setAlignment(AlignCenter); | 805 | label->setAlignment(AlignCenter); |
793 | mDayLabels.insert( i, label ); | 806 | mDayLabels.insert( i, label ); |
807 | label = new QLabel( mWeekView ); | ||
808 | label->setFont(bfont); | ||
809 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | ||
810 | label->setLineWidth(1); | ||
811 | label->setAlignment(AlignCenter); | ||
812 | mDayLabelsW.insert( i, label ); | ||
794 | } | 813 | } |
795 | 814 | ||
796 | bfont.setBold( false ); | 815 | bfont.setBold( false ); |
797 | mWeekLabels.resize( mNumWeeks+1 ); | 816 | mWeekLabels.resize( mNumWeeks+1 ); |
817 | mWeekLabelsW.resize( 2 ); | ||
798 | for( i = 0; i < mNumWeeks+1; i++ ) { | 818 | for( i = 0; i < mNumWeeks+1; i++ ) { |
799 | KOWeekButton *label = new KOWeekButton( this ); | 819 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
800 | label->setFont(bfont); | 820 | label->setFont(bfont); |
801 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 821 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
@@ -807,11 +827,26 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
807 | mWeekLabels.insert( i, label ); | 827 | mWeekLabels.insert( i, label ); |
808 | } | 828 | } |
809 | mWeekLabels[mNumWeeks]->setText( i18n("")); | 829 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
810 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 830 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
831 | |||
832 | for( i = 0; i < 1+1; i++ ) { | ||
833 | KOWeekButton *label = new KOWeekButton( mWeekView ); | ||
834 | label->setFont(bfont); | ||
835 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | ||
836 | label->setFlat(true); | ||
837 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | ||
838 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | ||
839 | //label->setLineWidth(1); | ||
840 | //label->setAlignment(AlignCenter); | ||
841 | mWeekLabelsW.insert( i, label ); | ||
842 | } | ||
843 | mWeekLabelsW[1]->setText( i18n("W")); | ||
844 | |||
845 | |||
811 | int row, col; | 846 | int row, col; |
812 | mCells.resize( mNumCells ); | 847 | mCells.resize( mNumCells ); |
813 | for( row = 0; row < mNumWeeks; ++row ) { | 848 | for( row = 0; row < mNumWeeks; ++row ) { |
814 | for( col = 0; col < mDaysPerWeek; ++col ) { | 849 | for( col = 0; col < mDaysPerWeek; ++col ) { |
815 | MonthViewCell *cell = new MonthViewCell( this ); | 850 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
816 | mCells.insert( row * mDaysPerWeek + col, cell ); | 851 | mCells.insert( row * mDaysPerWeek + col, cell ); |
817 | 852 | ||
@@ -824,4 +859,16 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
824 | } | 859 | } |
825 | } | 860 | } |
861 | mCellsW.resize( mDaysPerWeek ); | ||
862 | for( col = 0; col < mDaysPerWeek; ++col ) { | ||
863 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | ||
864 | mCellsW.insert( col, cell ); | ||
865 | |||
866 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | ||
867 | SLOT( defaultAction( Incidence * ) ) ); | ||
868 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | ||
869 | SIGNAL( newEventSignal( QDateTime ) ) ); | ||
870 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | ||
871 | SIGNAL( showDaySignal( QDate ) ) ); | ||
872 | } | ||
826 | 873 | ||
827 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 874 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
@@ -829,5 +876,15 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
829 | // updateConfig(); //useless here | 876 | // updateConfig(); //useless here |
830 | 877 | ||
831 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 878 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
879 | #if 0 | ||
880 | mWidStack = new QWidgetStack( this ); | ||
881 | mMonthView = new QWidget( mWidStack ); | ||
882 | mWeekView = new QWidget( mWidStack ); | ||
883 | #endif | ||
884 | if ( mShowWeekView ) | ||
885 | mWidStack->raiseWidget( mWeekView ); | ||
886 | else | ||
887 | mWidStack->raiseWidget( mMonthView ); | ||
888 | |||
832 | emit incidenceSelected( 0 ); | 889 | emit incidenceSelected( 0 ); |
833 | } | 890 | } |
@@ -843,10 +900,11 @@ void KOMonthView::selectDateWeekNum ( int ) | |||
843 | void KOMonthView::selectInternalWeekNum ( int n ) | 900 | void KOMonthView::selectInternalWeekNum ( int n ) |
844 | { | 901 | { |
845 | emit selectWeekNum ( n ); | ||
846 | switchView(); | 902 | switchView(); |
903 | emit selectWeekNum ( n ); | ||
847 | } | 904 | } |
848 | 905 | ||
849 | void KOMonthView::switchView() | 906 | void KOMonthView::switchView() |
850 | { | 907 | { |
908 | |||
851 | if ( selectedCell( ) ) | 909 | if ( selectedCell( ) ) |
852 | selectedCell()->deselect(); | 910 | selectedCell()->deselect(); |
@@ -854,6 +912,13 @@ void KOMonthView::switchView() | |||
854 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 912 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
855 | //emit showNavigator( !mShowWeekView ); | 913 | //emit showNavigator( !mShowWeekView ); |
856 | computeLayout(); | 914 | if ( clPending ) { |
857 | updateConfig(); | 915 | computeLayout(); |
916 | updateConfig(); | ||
917 | } | ||
918 | if ( mShowWeekView ) | ||
919 | mWidStack->raiseWidget( mWeekView ); | ||
920 | else | ||
921 | mWidStack->raiseWidget( mMonthView ); | ||
922 | clPending = false; | ||
858 | } | 923 | } |
859 | 924 | ||
@@ -907,5 +972,5 @@ void KOMonthView::updateConfig() | |||
907 | if ( mShowWeekView ) { | 972 | if ( mShowWeekView ) { |
908 | mWeekStartsMonday = true; | 973 | mWeekStartsMonday = true; |
909 | } | 974 | } |
910 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 975 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
911 | mWidthLongDayLabel = 0; | 976 | mWidthLongDayLabel = 0; |
@@ -937,16 +1002,39 @@ void KOMonthView::updateDayLabels() | |||
937 | { | 1002 | { |
938 | 1003 | ||
1004 | QPtrVector<QLabel> *mDayLabelsT; | ||
1005 | #if 0 | ||
1006 | if (mShowWeekView ) | ||
1007 | mDayLabelsT = &mDayLabelsW; | ||
1008 | else | ||
1009 | mDayLabelsT = &mDayLabels; | ||
1010 | #endif | ||
1011 | |||
1012 | mDayLabelsT = &mDayLabelsW; | ||
1013 | for (int i = 0; i < 7; i++) { | ||
1014 | if (mWeekStartsMonday) { | ||
1015 | bool show = mShortDayLabels; | ||
1016 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | ||
1017 | show = true; | ||
1018 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | ||
1019 | } else { | ||
1020 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | ||
1021 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | ||
1022 | |||
1023 | } | ||
1024 | } | ||
1025 | mDayLabelsT = &mDayLabels; | ||
939 | for (int i = 0; i < 7; i++) { | 1026 | for (int i = 0; i < 7; i++) { |
940 | if (mWeekStartsMonday) { | 1027 | if (mWeekStartsMonday) { |
941 | bool show = mShortDayLabels; | 1028 | bool show = mShortDayLabels; |
942 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) | 1029 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
943 | show = true; | 1030 | show = true; |
944 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1031 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
945 | } else { | 1032 | } else { |
946 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 1033 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
947 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 1034 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
948 | 1035 | ||
949 | } | 1036 | } |
950 | } | 1037 | } |
1038 | |||
951 | } | 1039 | } |
952 | 1040 | ||
@@ -955,4 +1043,18 @@ void KOMonthView::showDates(const QDate &start, const QDate &) | |||
955 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1043 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
956 | 1044 | ||
1045 | QPtrVector<MonthViewCell> *cells; | ||
1046 | QPtrVector<QLabel> *dayLabels; | ||
1047 | QPtrVector<KOWeekButton> *weekLabels; | ||
1048 | int weekNum = 6; | ||
1049 | if ( mShowWeekView ) { | ||
1050 | weekNum = 1; | ||
1051 | cells = &mCellsW; | ||
1052 | dayLabels = &mDayLabelsW; | ||
1053 | weekLabels = &mWeekLabelsW; | ||
1054 | } else { | ||
1055 | cells = &mCells; | ||
1056 | dayLabels = &mDayLabels; | ||
1057 | weekLabels = &mWeekLabels; | ||
1058 | } | ||
957 | 1059 | ||
958 | mStartDate = start; | 1060 | mStartDate = start; |
@@ -966,17 +1068,17 @@ void KOMonthView::showDates(const QDate &start, const QDate &) | |||
966 | bool primary = false; | 1068 | bool primary = false; |
967 | uint i; | 1069 | uint i; |
968 | for( i = 0; i < mCells.size(); ++i ) { | 1070 | for( i = 0; i < (*cells).size(); ++i ) { |
969 | QDate date = mStartDate.addDays( i ); | 1071 | QDate date = mStartDate.addDays( i ); |
970 | mCells[i]->setDate( date ); | 1072 | (*cells)[i]->setDate( date ); |
971 | 1073 | ||
972 | #ifndef KORG_NOPLUGINS | 1074 | #ifndef KORG_NOPLUGINS |
973 | // add holiday, if present | 1075 | // add holiday, if present |
974 | QString hstring(KOCore::self()->holiday(date)); | 1076 | QString hstring(KOCore::self()->holiday(date)); |
975 | mCells[i]->setHoliday( hstring ); | 1077 | (*cells)[i]->setHoliday( hstring ); |
976 | #endif | 1078 | #endif |
977 | 1079 | ||
978 | } | 1080 | } |
979 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1081 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
980 | for( i = 0; i < 6; ++i ) { | 1082 | for( i = 0; i < weekNum; ++i ) { |
981 | int wno; | 1083 | int wno; |
982 | // remember, according to ISO 8601, the first week of the year is the | 1084 | // remember, according to ISO 8601, the first week of the year is the |
@@ -988,5 +1090,5 @@ void KOMonthView::showDates(const QDate &start, const QDate &) | |||
988 | else | 1090 | else |
989 | wno =dayOfYear / 7; | 1091 | wno =dayOfYear / 7; |
990 | mWeekLabels[i]->setWeekNum( wno ); | 1092 | (*weekLabels)[i]->setWeekNum( wno ); |
991 | date = date.addDays( 7 ); | 1093 | date = date.addDays( 7 ); |
992 | } | 1094 | } |
@@ -1013,11 +1115,17 @@ void KOMonthView::updateView() | |||
1013 | //QTime ti; | 1115 | //QTime ti; |
1014 | //ti.start(); | 1116 | //ti.start(); |
1117 | QPtrVector<MonthViewCell> *cells; | ||
1118 | if ( mShowWeekView ) { | ||
1119 | cells = &mCellsW; | ||
1120 | } else { | ||
1121 | cells = &mCells; | ||
1122 | } | ||
1015 | #if 1 | 1123 | #if 1 |
1016 | int i; | 1124 | int i; |
1017 | int timeSpan = mCells.size()-1; | 1125 | int timeSpan = (*cells).size()-1; |
1018 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1126 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1019 | timeSpan = 6; | 1127 | timeSpan = 6; |
1020 | for( i = 0; i < timeSpan + 1; ++i ) { | 1128 | for( i = 0; i < timeSpan + 1; ++i ) { |
1021 | mCells[i]->startUpdateCell(); | 1129 | (*cells)[i]->startUpdateCell(); |
1022 | } | 1130 | } |
1023 | 1131 | ||
@@ -1048,5 +1156,5 @@ void KOMonthView::updateView() | |||
1048 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1156 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1049 | for ( iii = st;iii<= end;++iii) | 1157 | for ( iii = st;iii<= end;++iii) |
1050 | mCells[iii]->insertEvent( event ); | 1158 | (*cells)[iii]->insertEvent( event ); |
1051 | } | 1159 | } |
1052 | } | 1160 | } |
@@ -1078,5 +1186,5 @@ void KOMonthView::updateView() | |||
1078 | int iii; | 1186 | int iii; |
1079 | for ( iii = st;iii<= end;++iii) | 1187 | for ( iii = st;iii<= end;++iii) |
1080 | mCells[iii]->insertEvent( event ); | 1188 | (*cells)[iii]->insertEvent( event ); |
1081 | } | 1189 | } |
1082 | } | 1190 | } |
@@ -1091,5 +1199,5 @@ void KOMonthView::updateView() | |||
1091 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1199 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1092 | if ( day >= 0 && day < timeSpan + 1) { | 1200 | if ( day >= 0 && day < timeSpan + 1) { |
1093 | mCells[day]->insertTodo( todo ); | 1201 | (*cells)[day]->insertTodo( todo ); |
1094 | } | 1202 | } |
1095 | } | 1203 | } |
@@ -1097,8 +1205,8 @@ void KOMonthView::updateView() | |||
1097 | 1205 | ||
1098 | for( i = 0; i < timeSpan+1; ++i ) { | 1206 | for( i = 0; i < timeSpan+1; ++i ) { |
1099 | mCells[i]->finishUpdateCell(); | 1207 | (*cells)[i]->finishUpdateCell(); |
1100 | } | 1208 | } |
1101 | processSelectionChange(); | 1209 | processSelectionChange(); |
1102 | mCells[0]->setFocus(); | 1210 | (*cells)[0]->setFocus(); |
1103 | 1211 | ||
1104 | 1212 | ||
@@ -1107,6 +1215,6 @@ void KOMonthView::updateView() | |||
1107 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1215 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1108 | int i; | 1216 | int i; |
1109 | for( i = 0; i < mCells.count(); ++i ) { | 1217 | for( i = 0; i < (*cells).count(); ++i ) { |
1110 | mCells[i]->updateCell(); | 1218 | (*cells)[i]->updateCell(); |
1111 | } | 1219 | } |
1112 | 1220 | ||
@@ -1114,5 +1222,5 @@ void KOMonthView::updateView() | |||
1114 | processSelectionChange(); | 1222 | processSelectionChange(); |
1115 | // qDebug("---------------------------------------------------------------------+ "); | 1223 | // qDebug("---------------------------------------------------------------------+ "); |
1116 | mCells[0]->setFocus(); | 1224 | (*cells)[0]->setFocus(); |
1117 | #endif | 1225 | #endif |
1118 | 1226 | ||
@@ -1123,5 +1231,9 @@ void KOMonthView::resizeEvent(QResizeEvent * e) | |||
1123 | { | 1231 | { |
1124 | computeLayout(); | 1232 | computeLayout(); |
1125 | mCells[0]->setFocus(); | 1233 | clPending = true; |
1234 | if ( mShowWeekView ) | ||
1235 | mCellsW[0]->setFocus(); | ||
1236 | else | ||
1237 | mCells[0]->setFocus(); | ||
1126 | } | 1238 | } |
1127 | void KOMonthView::computeLayoutWeek() | 1239 | void KOMonthView::computeLayoutWeek() |
@@ -1157,5 +1269,5 @@ void KOMonthView::computeLayoutWeek() | |||
1157 | int colWid = wid / daysToShow; | 1269 | int colWid = wid / daysToShow; |
1158 | int lastCol = wid - ( colWid*6 ); | 1270 | int lastCol = wid - ( colWid*6 ); |
1159 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1271 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1160 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1272 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1161 | int colModulo = wid % daysToShow; | 1273 | int colModulo = wid % daysToShow; |
@@ -1178,9 +1290,9 @@ void KOMonthView::computeLayoutWeek() | |||
1178 | } | 1290 | } |
1179 | if ( i >= 5 ) { | 1291 | if ( i >= 5 ) { |
1180 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); | 1292 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); |
1181 | x -= (w/2 ); | 1293 | x -= (w/2 ); |
1182 | } | 1294 | } |
1183 | else | 1295 | else |
1184 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1296 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); |
1185 | x += w; | 1297 | x += w; |
1186 | } | 1298 | } |
@@ -1189,7 +1301,7 @@ void KOMonthView::computeLayoutWeek() | |||
1189 | w = colWid; | 1301 | w = colWid; |
1190 | h = cellHei; | 1302 | h = cellHei; |
1191 | for ( i = 0; i < mCells.count(); ++i) { | 1303 | for ( i = 0; i < mCellsW.count(); ++i) { |
1192 | if ( i > 6 ) { | 1304 | if ( i > 6 ) { |
1193 | mCells[i]->hide(); | 1305 | mCellsW[i]->hide(); |
1194 | continue; | 1306 | continue; |
1195 | } | 1307 | } |
@@ -1204,5 +1316,5 @@ void KOMonthView::computeLayoutWeek() | |||
1204 | if ( i >= 5 ) { | 1316 | if ( i >= 5 ) { |
1205 | if ( i ==5 ) { | 1317 | if ( i ==5 ) { |
1206 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1318 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1207 | x -= w ;y += h/2; | 1319 | x -= w ;y += h/2; |
1208 | } else { | 1320 | } else { |
@@ -1210,9 +1322,9 @@ void KOMonthView::computeLayoutWeek() | |||
1210 | ++w; | 1322 | ++w; |
1211 | } | 1323 | } |
1212 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1324 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1213 | y -= h/2; | 1325 | y -= h/2; |
1214 | } | 1326 | } |
1215 | } else | 1327 | } else |
1216 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1328 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1217 | 1329 | ||
1218 | 1330 | ||
@@ -1225,12 +1337,9 @@ void KOMonthView::computeLayoutWeek() | |||
1225 | y= dayLabelHei; | 1337 | y= dayLabelHei; |
1226 | h = cellHei ; | 1338 | h = cellHei ; |
1227 | mWeekLabels[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1339 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1228 | for ( i = 1; i < 6; i++) { | 1340 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1229 | mWeekLabels[i]->hide(); | ||
1230 | } | ||
1231 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | ||
1232 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1341 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1233 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1342 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1234 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1343 | mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; |
1235 | updateDayLabels(); | 1344 | updateDayLabels(); |
1236 | bool forceUpdate = !updatePossible; | 1345 | bool forceUpdate = !updatePossible; |
@@ -1301,5 +1410,4 @@ void KOMonthView::computeLayout() | |||
1301 | h = cellHei ; | 1410 | h = cellHei ; |
1302 | for ( i = 0; i < mCells.count(); ++i) { | 1411 | for ( i = 0; i < mCells.count(); ++i) { |
1303 | mCells[i]->show(); | ||
1304 | w = colWid; | 1412 | w = colWid; |
1305 | if ( ((i) % 7) >= 7-colModulo ) { | 1413 | if ( ((i) % 7) >= 7-colModulo ) { |
@@ -1332,5 +1440,4 @@ void KOMonthView::computeLayout() | |||
1332 | h = cellHei ; | 1440 | h = cellHei ; |
1333 | for ( i = 0; i < 6; i++) { | 1441 | for ( i = 0; i < 6; i++) { |
1334 | mWeekLabels[i]->show(); | ||
1335 | if ( i == (6-rowModulo)) | 1442 | if ( i == (6-rowModulo)) |
1336 | ++h; | 1443 | ++h; |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 1ed200b..b89b2bc 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -26,4 +26,5 @@ | |||
26 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qwidgetstack.h> | ||
28 | #include <qlayout.h> | 29 | #include <qlayout.h> |
29 | #include <qintdict.h> | 30 | #include <qintdict.h> |
@@ -126,5 +127,5 @@ class MonthViewCell : public QWidget | |||
126 | Q_OBJECT | 127 | Q_OBJECT |
127 | public: | 128 | public: |
128 | MonthViewCell( KOMonthView * ); | 129 | MonthViewCell(KOMonthView *,QWidget* ); |
129 | 130 | ||
130 | void setDate( const QDate & ); | 131 | void setDate( const QDate & ); |
@@ -257,4 +258,8 @@ class KOMonthView: public KOEventView | |||
257 | 258 | ||
258 | private: | 259 | private: |
260 | bool clPending; | ||
261 | QWidgetStack * mWidStack; | ||
262 | QWidget* mMonthView; | ||
263 | QWidget* mWeekView; | ||
259 | bool mShowWeekView; | 264 | bool mShowWeekView; |
260 | bool updatePossible; | 265 | bool updatePossible; |
@@ -270,4 +275,7 @@ class KOMonthView: public KOEventView | |||
270 | QPtrVector<QLabel> mDayLabels; | 275 | QPtrVector<QLabel> mDayLabels; |
271 | QPtrVector<KOWeekButton> mWeekLabels; | 276 | QPtrVector<KOWeekButton> mWeekLabels; |
277 | QPtrVector<MonthViewCell> mCellsW; | ||
278 | QPtrVector<QLabel> mDayLabelsW; | ||
279 | QPtrVector<KOWeekButton> mWeekLabelsW; | ||
272 | 280 | ||
273 | bool mShortDayLabels; | 281 | bool mShortDayLabels; |