summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-04 16:26:39 (UTC)
committer zautrix <zautrix>2005-02-04 16:26:39 (UTC)
commitb7c502a598566264e6e7129524104b6e39438f03 (patch) (unidiff)
tree9be2449e9607b7bb73f94f85ae3abb27412fe682
parent76e6ad6cc6a3be8df896a3e7cf8375234b3212a9 (diff)
downloadkdepimpi-b7c502a598566264e6e7129524104b6e39438f03.zip
kdepimpi-b7c502a598566264e6e7129524104b6e39438f03.tar.gz
kdepimpi-b7c502a598566264e6e7129524104b6e39438f03.tar.bz2
mv faster
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt2
-rw-r--r--korganizer/komonthview.cpp207
-rw-r--r--korganizer/komonthview.h10
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
@@ -12,2 +12,4 @@ all attendees or all selected (with RSVP) attendees.
12 12
13Made the week-month mode changing in month view faster.
14
13********** VERSION 2.0.2 ************ 15********** VERSION 2.0.2 ************
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 9c1e4c3..daa37fd 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -25,2 +25,3 @@
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qwidgetstack.h>
26#include <qpushbutton.h> 27#include <qpushbutton.h>
@@ -270,4 +271,4 @@ int MonthViewItem::width(const QListBox *lb) const
270 271
271MonthViewCell::MonthViewCell( KOMonthView *parent) 272MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
272 : QWidget( parent ), 273 : QWidget( par ),
273 mMonthView( parent ) 274 mMonthView( parent )
@@ -768,2 +769,16 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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();
@@ -775,6 +790,4 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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();
@@ -787,3 +800,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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);
@@ -793,2 +806,8 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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 }
@@ -797,4 +816,5 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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);
@@ -808,4 +828,19 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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;
@@ -814,3 +849,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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 );
@@ -825,2 +860,14 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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
@@ -830,3 +877,13 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
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 );
@@ -844,4 +901,4 @@ void KOMonthView::selectInternalWeekNum ( int n )
844{ 901{
845 emit selectWeekNum ( n );
846 switchView(); 902 switchView();
903 emit selectWeekNum ( n );
847} 904}
@@ -850,2 +907,3 @@ void KOMonthView::switchView()
850{ 907{
908
851 if ( selectedCell( ) ) 909 if ( selectedCell( ) )
@@ -855,4 +913,11 @@ void KOMonthView::switchView()
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}
@@ -908,3 +973,3 @@ void KOMonthView::updateConfig()
908 mWeekStartsMonday = true; 973 mWeekStartsMonday = true;
909 } 974 }
910 QFontMetrics fontmetric(mDayLabels[0]->font()); 975 QFontMetrics fontmetric(mDayLabels[0]->font());
@@ -938,2 +1003,24 @@ void KOMonthView::updateDayLabels()
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++) {
@@ -941,8 +1028,8 @@ void KOMonthView::updateDayLabels()
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
@@ -950,2 +1037,3 @@ void KOMonthView::updateDayLabels()
950 } 1037 }
1038
951} 1039}
@@ -956,2 +1044,16 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
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
@@ -967,5 +1069,5 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
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
@@ -974,3 +1076,3 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
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
@@ -979,3 +1081,3 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
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;
@@ -989,3 +1091,3 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
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 );
@@ -1014,5 +1116,11 @@ void KOMonthView::updateView()
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 )
@@ -1020,3 +1128,3 @@ void KOMonthView::updateView()
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 }
@@ -1049,3 +1157,3 @@ void KOMonthView::updateView()
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 }
@@ -1079,3 +1187,3 @@ void KOMonthView::updateView()
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 }
@@ -1092,3 +1200,3 @@ void KOMonthView::updateView()
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 }
@@ -1098,6 +1206,6 @@ void KOMonthView::updateView()
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
@@ -1108,4 +1216,4 @@ void KOMonthView::updateView()
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 }
@@ -1115,3 +1223,3 @@ void KOMonthView::updateView()
1115 // qDebug("---------------------------------------------------------------------+ "); 1223 // qDebug("---------------------------------------------------------------------+ ");
1116 mCells[0]->setFocus(); 1224 (*cells)[0]->setFocus();
1117#endif 1225#endif
@@ -1124,3 +1232,7 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
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}
@@ -1158,3 +1270,3 @@ void KOMonthView::computeLayoutWeek()
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 );
@@ -1179,3 +1291,3 @@ void KOMonthView::computeLayoutWeek()
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 );
@@ -1183,3 +1295,3 @@ void KOMonthView::computeLayoutWeek()
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;
@@ -1190,5 +1302,5 @@ void KOMonthView::computeLayoutWeek()
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;
@@ -1205,3 +1317,3 @@ void KOMonthView::computeLayoutWeek()
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;
@@ -1211,3 +1323,3 @@ void KOMonthView::computeLayoutWeek()
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;
@@ -1215,3 +1327,3 @@ void KOMonthView::computeLayoutWeek()
1215 } else 1327 } else
1216 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1328 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h );
1217 1329
@@ -1226,10 +1338,7 @@ void KOMonthView::computeLayoutWeek()
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();
@@ -1302,3 +1411,2 @@ void KOMonthView::computeLayout()
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;
@@ -1333,3 +1441,2 @@ void KOMonthView::computeLayout()
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))
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 1ed200b..b89b2bc 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -27,2 +27,3 @@
27#include <qpoint.h> 27#include <qpoint.h>
28#include <qwidgetstack.h>
28#include <qlayout.h> 29#include <qlayout.h>
@@ -127,3 +128,3 @@ class MonthViewCell : public QWidget
127 public: 128 public:
128 MonthViewCell( KOMonthView * ); 129 MonthViewCell(KOMonthView *,QWidget* );
129 130
@@ -258,2 +259,6 @@ class KOMonthView: public KOEventView
258 private: 259 private:
260 bool clPending;
261 QWidgetStack * mWidStack;
262 QWidget* mMonthView;
263 QWidget* mWeekView;
259 bool mShowWeekView; 264 bool mShowWeekView;
@@ -271,2 +276,5 @@ class KOMonthView: public KOEventView
271 QPtrVector<KOWeekButton> mWeekLabels; 276 QPtrVector<KOWeekButton> mWeekLabels;
277 QPtrVector<MonthViewCell> mCellsW;
278 QPtrVector<QLabel> mDayLabelsW;
279 QPtrVector<KOWeekButton> mWeekLabelsW;
272 280