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 | |||
@@ -5,16 +5,18 @@ Info about the changes in new versions of KDE-Pim/Pi | |||
5 | KO/Pi: | 5 | KO/Pi: |
6 | Added feature for changing alarm settings for many items at once: | 6 | Added feature for changing alarm settings for many items at once: |
7 | Open list view (or search dialog), select the desired items and choose in | 7 | Open list view (or search dialog), select the desired items and choose in |
8 | the popup menu: Set alarm for selected... | 8 | the popup menu: Set alarm for selected... |
9 | 9 | ||
10 | Added to the event/todo viewer the option to send an email to | 10 | 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 | ||
15 | KO/Pi: | 17 | KO/Pi: |
16 | Fixed the layout problem of the day label buttons | 18 | Fixed the layout problem of the day label buttons |
17 | of the agenda view introduced in version 2.0.1. | 19 | of the agenda view introduced in version 2.0.1. |
18 | 20 | ||
19 | Added WhatsThis support for the todo view and the list view. | 21 | Added WhatsThis support for the todo view and the list view. |
20 | 22 | ||
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 9c1e4c3..daa37fd 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -18,16 +18,17 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
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> |
28 | #include <qpainter.h> | 29 | #include <qpainter.h> |
29 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
30 | #ifndef DESKTOP_VERSION | 31 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
32 | #else | 33 | #else |
33 | #include <qapplication.h> | 34 | #include <qapplication.h> |
@@ -263,18 +264,18 @@ int MonthViewItem::width(const QListBox *lb) const | |||
263 | if( mReply ) { | 264 | if( mReply ) { |
264 | x += size+1; | 265 | x += size+1; |
265 | } | 266 | } |
266 | 267 | ||
267 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 268 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
268 | } | 269 | } |
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 | { |
275 | 276 | ||
276 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 277 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
277 | 278 | ||
278 | // mLabel = new QLabel( this );QPushButton | 279 | // mLabel = new QLabel( this );QPushButton |
279 | mLabel = new QPushButton( this ); | 280 | mLabel = new QPushButton( this ); |
280 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 281 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
@@ -761,105 +762,169 @@ void MonthViewCell::selection( QListBoxItem *item ) | |||
761 | // ******************************************************************************* | 762 | // ******************************************************************************* |
762 | 763 | ||
763 | 764 | ||
764 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 765 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
765 | : KOEventView( calendar, parent, name ), | 766 | : KOEventView( calendar, parent, name ), |
766 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 767 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
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; |
771 | if ( mShowWeekView ) | 786 | if ( mShowWeekView ) |
772 | mWeekStartsMonday = true; | 787 | mWeekStartsMonday = true; |
773 | updatePossible = false; | 788 | updatePossible = false; |
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 ) { |
782 | bfont.setPointSize( bfont.pointSize() - 2 ); | 795 | bfont.setPointSize( bfont.pointSize() - 2 ); |
783 | } | 796 | } |
784 | bfont.setBold( true ); | 797 | bfont.setBold( true ); |
785 | int i; | 798 | int i; |
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); |
791 | label->setLineWidth(1); | 804 | label->setLineWidth(1); |
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 )) ); |
802 | label->setFlat(true); | 822 | label->setFlat(true); |
803 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 823 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
804 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 824 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
805 | //label->setLineWidth(1); | 825 | //label->setLineWidth(1); |
806 | //label->setAlignment(AlignCenter); | 826 | //label->setAlignment(AlignCenter); |
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 | ||
818 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 853 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
819 | SLOT( defaultAction( Incidence * ) ) ); | 854 | SLOT( defaultAction( Incidence * ) ) ); |
820 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 855 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
821 | SIGNAL( newEventSignal( QDateTime ) ) ); | 856 | SIGNAL( newEventSignal( QDateTime ) ) ); |
822 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 857 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
823 | SIGNAL( showDaySignal( QDate ) ) ); | 858 | SIGNAL( showDaySignal( QDate ) ) ); |
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() ) ); |
828 | mContextMenu = eventPopup(); | 875 | mContextMenu = eventPopup(); |
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 | } |
834 | 891 | ||
835 | KOMonthView::~KOMonthView() | 892 | KOMonthView::~KOMonthView() |
836 | { | 893 | { |
837 | delete mContextMenu; | 894 | delete mContextMenu; |
838 | } | 895 | } |
839 | void KOMonthView::selectDateWeekNum ( int ) | 896 | void KOMonthView::selectDateWeekNum ( int ) |
840 | { | 897 | { |
841 | 898 | ||
842 | } | 899 | } |
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(); |
853 | mShowWeekView = !mShowWeekView; | 911 | mShowWeekView = !mShowWeekView; |
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 | ||
860 | int KOMonthView::maxDatesHint() | 925 | int KOMonthView::maxDatesHint() |
861 | { | 926 | { |
862 | return mNumCells; | 927 | return mNumCells; |
863 | } | 928 | } |
864 | 929 | ||
865 | int KOMonthView::currentDateCount() | 930 | int KOMonthView::currentDateCount() |
@@ -901,17 +966,17 @@ void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | |||
901 | 966 | ||
902 | void KOMonthView::updateConfig() | 967 | void KOMonthView::updateConfig() |
903 | { | 968 | { |
904 | 969 | ||
905 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 970 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
906 | 971 | ||
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; |
912 | 977 | ||
913 | for (int i = 0; i < 7; i++) { | 978 | for (int i = 0; i < 7; i++) { |
914 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 979 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
915 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 980 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
916 | } | 981 | } |
917 | bool temp = mShowSatSunComp ; | 982 | bool temp = mShowSatSunComp ; |
@@ -931,68 +996,105 @@ void KOMonthView::updateConfig() | |||
931 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 996 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
932 | #endif | 997 | #endif |
933 | updateView(); | 998 | updateView(); |
934 | } | 999 | } |
935 | 1000 | ||
936 | void KOMonthView::updateDayLabels() | 1001 | 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 | ||
953 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1041 | void KOMonthView::showDates(const QDate &start, const QDate &) |
954 | { | 1042 | { |
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; |
959 | 1061 | ||
960 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1062 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
961 | 1063 | ||
962 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1064 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
963 | mStartDate = mStartDate.addDays( -1 ); | 1065 | mStartDate = mStartDate.addDays( -1 ); |
964 | } | 1066 | } |
965 | 1067 | ||
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 |
983 | // first week that contains a thursday. Thus we must subtract off 4, | 1085 | // first week that contains a thursday. Thus we must subtract off 4, |
984 | // not just 1. | 1086 | // not just 1. |
985 | int dayOfYear = date.dayOfYear(); | 1087 | int dayOfYear = date.dayOfYear(); |
986 | if (dayOfYear % 7 != 0) | 1088 | if (dayOfYear % 7 != 0) |
987 | wno = dayOfYear / 7 + 1; | 1089 | wno = dayOfYear / 7 + 1; |
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 | } |
993 | updateView(); | 1095 | updateView(); |
994 | } | 1096 | } |
995 | 1097 | ||
996 | void KOMonthView::showEvents(QPtrList<Event>) | 1098 | void KOMonthView::showEvents(QPtrList<Event>) |
997 | { | 1099 | { |
998 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1100 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
@@ -1007,23 +1109,29 @@ void KOMonthView::changeEventDisplay(Event *, int) | |||
1007 | 1109 | ||
1008 | void KOMonthView::updateView() | 1110 | void KOMonthView::updateView() |
1009 | { | 1111 | { |
1010 | 1112 | ||
1011 | if ( !updatePossible ) | 1113 | if ( !updatePossible ) |
1012 | return; | 1114 | return; |
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 | ||
1024 | QPtrList<Event> events = calendar()->events(); | 1132 | QPtrList<Event> events = calendar()->events(); |
1025 | Event *event; | 1133 | Event *event; |
1026 | QDateTime dt; | 1134 | QDateTime dt; |
1027 | bool ok; | 1135 | bool ok; |
1028 | QDate endDate = mStartDate.addDays( timeSpan ); | 1136 | QDate endDate = mStartDate.addDays( timeSpan ); |
1029 | for( event = events.first(); event; event = events.next() ) { // for event | 1137 | for( event = events.first(); event; event = events.next() ) { // for event |
@@ -1042,17 +1150,17 @@ void KOMonthView::updateView() | |||
1042 | if ( end >= 0 ) { // end after timestart --- got one! | 1150 | if ( end >= 0 ) { // end after timestart --- got one! |
1043 | //normalize | 1151 | //normalize |
1044 | st = timeSpan - st; | 1152 | st = timeSpan - st; |
1045 | if ( st < 0 ) st = 0; | 1153 | if ( st < 0 ) st = 0; |
1046 | if ( end > timeSpan ) end = timeSpan; | 1154 | if ( end > timeSpan ) end = timeSpan; |
1047 | int iii; | 1155 | int iii; |
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 | } |
1053 | } else { | 1161 | } else { |
1054 | if ( invalid ) | 1162 | if ( invalid ) |
1055 | break; | 1163 | break; |
1056 | invalid = true; | 1164 | invalid = true; |
1057 | //qDebug("invalid %s", event->summary().latin1()); | 1165 | //qDebug("invalid %s", event->summary().latin1()); |
1058 | incidenceStart = QDateTime( mStartDate ); | 1166 | incidenceStart = QDateTime( mStartDate ); |
@@ -1072,62 +1180,66 @@ void KOMonthView::updateView() | |||
1072 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1180 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1073 | if ( end >= 0 ) { // end after timestart --- got one! | 1181 | if ( end >= 0 ) { // end after timestart --- got one! |
1074 | //normalize | 1182 | //normalize |
1075 | st = timeSpan - st; | 1183 | st = timeSpan - st; |
1076 | if ( st < 0 ) st = 0; | 1184 | if ( st < 0 ) st = 0; |
1077 | if ( end > timeSpan ) end = timeSpan; | 1185 | if ( end > timeSpan ) end = timeSpan; |
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 | } |
1083 | } | 1191 | } |
1084 | } | 1192 | } |
1085 | // insert due todos | 1193 | // insert due todos |
1086 | QPtrList<Todo> todos = calendar()->todos( ); | 1194 | QPtrList<Todo> todos = calendar()->todos( ); |
1087 | Todo *todo; | 1195 | Todo *todo; |
1088 | for(todo = todos.first(); todo; todo = todos.next()) { | 1196 | for(todo = todos.first(); todo; todo = todos.next()) { |
1089 | //insertTodo( todo ); | 1197 | //insertTodo( todo ); |
1090 | if ( todo->hasDueDate() ) { | 1198 | if ( todo->hasDueDate() ) { |
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 | } |
1096 | } | 1204 | } |
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 | ||
1105 | #else | 1213 | #else |
1106 | // old code | 1214 | // old code |
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 | ||
1113 | //qDebug("KOMonthView::updateView() "); | 1221 | //qDebug("KOMonthView::updateView() "); |
1114 | processSelectionChange(); | 1222 | processSelectionChange(); |
1115 | // qDebug("---------------------------------------------------------------------+ "); | 1223 | // qDebug("---------------------------------------------------------------------+ "); |
1116 | mCells[0]->setFocus(); | 1224 | (*cells)[0]->setFocus(); |
1117 | #endif | 1225 | #endif |
1118 | 1226 | ||
1119 | //qDebug("update time %d ", ti.elapsed()); | 1227 | //qDebug("update time %d ", ti.elapsed()); |
1120 | } | 1228 | } |
1121 | 1229 | ||
1122 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1230 | 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() |
1128 | { | 1240 | { |
1129 | 1241 | ||
1130 | int daysToShow; | 1242 | int daysToShow; |
1131 | bool combinedSatSun = false; | 1243 | bool combinedSatSun = false; |
1132 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1244 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1133 | daysToShow = 6; | 1245 | daysToShow = 6; |
@@ -1151,17 +1263,17 @@ void KOMonthView::computeLayoutWeek() | |||
1151 | 1263 | ||
1152 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1264 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1153 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1265 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1154 | int weeklabelwid = fm.width( "888" ); | 1266 | int weeklabelwid = fm.width( "888" ); |
1155 | wid -= weeklabelwid; | 1267 | wid -= weeklabelwid; |
1156 | 1268 | ||
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; |
1162 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1274 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1163 | //qDebug("rowmod %d ", rowModulo); | 1275 | //qDebug("rowmod %d ", rowModulo); |
1164 | int i; | 1276 | int i; |
1165 | int x,y,w,h; | 1277 | int x,y,w,h; |
1166 | x= 0; | 1278 | x= 0; |
1167 | y= 0; | 1279 | y= 0; |
@@ -1172,71 +1284,68 @@ void KOMonthView::computeLayoutWeek() | |||
1172 | y += hei/(5-daysToShow); | 1284 | y += hei/(5-daysToShow); |
1173 | x = 0; | 1285 | x = 0; |
1174 | w = colWid; | 1286 | w = colWid; |
1175 | } | 1287 | } |
1176 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1288 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1177 | ++w; | 1289 | ++w; |
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 | } |
1187 | x= 0; | 1299 | x= 0; |
1188 | y= dayLabelHei; | 1300 | y= dayLabelHei; |
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 | } |
1196 | 1308 | ||
1197 | w = colWid; | 1309 | w = colWid; |
1198 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1310 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1199 | ++w; | 1311 | ++w; |
1200 | } | 1312 | } |
1201 | if ( i == (daysToShow-1-rowModulo)*7) | 1313 | if ( i == (daysToShow-1-rowModulo)*7) |
1202 | ++h; | 1314 | ++h; |
1203 | 1315 | ||
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 { |
1209 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1321 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
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 | ||
1219 | x += w; | 1331 | x += w; |
1220 | if ( x + w/2 > wid ) { | 1332 | if ( x + w/2 > wid ) { |
1221 | x = 0; | 1333 | x = 0; |
1222 | y += h+dayLabelHei ; | 1334 | y += h+dayLabelHei ; |
1223 | } | 1335 | } |
1224 | } | 1336 | } |
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; |
1237 | updatePossible = true; | 1346 | updatePossible = true; |
1238 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1347 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1239 | if ( forceUpdate ) | 1348 | if ( forceUpdate ) |
1240 | updateView(); | 1349 | updateView(); |
1241 | } | 1350 | } |
1242 | void KOMonthView::computeLayout() | 1351 | void KOMonthView::computeLayout() |
@@ -1295,17 +1404,16 @@ void KOMonthView::computeLayout() | |||
1295 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1404 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1296 | x += w; | 1405 | x += w; |
1297 | } | 1406 | } |
1298 | x= 0; | 1407 | x= 0; |
1299 | y= dayLabelHei; | 1408 | y= dayLabelHei; |
1300 | w = colWid; | 1409 | w = colWid; |
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 ) { |
1306 | ++w; | 1414 | ++w; |
1307 | } | 1415 | } |
1308 | if ( i == (6-rowModulo)*7) | 1416 | if ( i == (6-rowModulo)*7) |
1309 | ++h; | 1417 | ++h; |
1310 | if ( combinedSatSun ) { | 1418 | if ( combinedSatSun ) { |
1311 | if ( (i)%7 >= daysToShow-1 ) { | 1419 | if ( (i)%7 >= daysToShow-1 ) { |
@@ -1326,17 +1434,16 @@ void KOMonthView::computeLayout() | |||
1326 | if ( x + w/2 > wid ) { | 1434 | if ( x + w/2 > wid ) { |
1327 | x = 0; | 1435 | x = 0; |
1328 | y += h; | 1436 | y += h; |
1329 | } | 1437 | } |
1330 | } | 1438 | } |
1331 | y= dayLabelHei; | 1439 | y= dayLabelHei; |
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; |
1337 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1444 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1338 | y += h; | 1445 | y += h; |
1339 | } | 1446 | } |
1340 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1447 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1341 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1448 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1342 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1449 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 1ed200b..b89b2bc 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -20,16 +20,17 @@ | |||
20 | #ifndef _KOMONTHVIEW_H | 20 | #ifndef _KOMONTHVIEW_H |
21 | #define _KOMONTHVIEW_H | 21 | #define _KOMONTHVIEW_H |
22 | 22 | ||
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qframe.h> | 24 | #include <qframe.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
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> |
30 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
31 | #include <qvaluelist.h> | 32 | #include <qvaluelist.h> |
32 | #include <qptrvector.h> | 33 | #include <qptrvector.h> |
33 | 34 | ||
34 | #include <libkcal/calendar.h> | 35 | #include <libkcal/calendar.h> |
35 | #include <libkcal/event.h> | 36 | #include <libkcal/event.h> |
@@ -120,17 +121,17 @@ class MonthViewItem: public QListBoxItem | |||
120 | 121 | ||
121 | 122 | ||
122 | class KOMonthView; | 123 | class KOMonthView; |
123 | 124 | ||
124 | class MonthViewCell : public QWidget | 125 | class MonthViewCell : public QWidget |
125 | { | 126 | { |
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 & ); |
131 | QDate date() const; | 132 | QDate date() const; |
132 | 133 | ||
133 | void setPrimary( bool ); | 134 | void setPrimary( bool ); |
134 | bool isPrimary() const; | 135 | bool isPrimary() const; |
135 | 136 | ||
136 | void setHoliday( bool ); | 137 | void setHoliday( bool ); |
@@ -251,29 +252,36 @@ class KOMonthView: public KOEventView | |||
251 | void selectWeekNum ( int ); | 252 | void selectWeekNum ( int ); |
252 | void showDaySignal( QDate ); | 253 | void showDaySignal( QDate ); |
253 | protected: | 254 | protected: |
254 | void resizeEvent(QResizeEvent *); | 255 | void resizeEvent(QResizeEvent *); |
255 | void viewChanged(); | 256 | void viewChanged(); |
256 | void updateDayLabels(); | 257 | void updateDayLabels(); |
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; |
261 | int mDaysPerWeek; | 266 | int mDaysPerWeek; |
262 | int mNumWeeks; | 267 | int mNumWeeks; |
263 | int mNumCells; | 268 | int mNumCells; |
264 | bool mWeekStartsMonday; | 269 | bool mWeekStartsMonday; |
265 | bool mShowSatSunComp; | 270 | bool mShowSatSunComp; |
266 | void computeLayout(); | 271 | void computeLayout(); |
267 | void computeLayoutWeek(); | 272 | void computeLayoutWeek(); |
268 | 273 | ||
269 | QPtrVector<MonthViewCell> mCells; | 274 | QPtrVector<MonthViewCell> mCells; |
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; |
274 | int mWidthLongDayLabel; | 282 | int mWidthLongDayLabel; |
275 | 283 | ||
276 | QDate mStartDate; | 284 | QDate mStartDate; |
277 | 285 | ||
278 | MonthViewCell *mSelectedCell; | 286 | MonthViewCell *mSelectedCell; |
279 | 287 | ||