-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 35 | ||||
-rw-r--r-- | korganizer/datenavigatorcontainer.h | 2 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 21 |
3 files changed, 33 insertions, 25 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index 9720146..ba97fa6 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp @@ -49,2 +49,5 @@ DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, mLastDisplayedDN = 0; + mUpdateTimer; + mUpdateTimer = new QTimer( this ); + connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); } @@ -137,5 +140,20 @@ void DateNavigatorContainer::setCalendar( Calendar *cal ) } +void DateNavigatorContainer::checkUpdateDayMatrixDates() +{ + QDate last = lastAvailableDate(); + QDate first = firstAvailableDate(); + + QDate selFirst = mFirstSelectedDate; + QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); + if ( selFirst >= first && selLast <= last ) { + updateDayMatrixDates(); + } + else { + updateDayMatrixDates(); + emit monthSelected( mFirstSelectedDate.month() ); + } +} void DateNavigatorContainer::updateDayMatrixDates() { - + mUpdateTimer->stop(); QDate fDate = mFirstSelectedDate; @@ -220,16 +238,2 @@ void DateNavigatorContainer::selectDates( const DateList &dateList ) QDate lDate = dateList.last(); - if ( mLastDisplayedDN <= 2 ) { - mNavigatorView->selectDates( dateList ); - KDateNavigator *view = mExtraViews.at( 0 ); - QDate bDate = fDate.addDays( fDate.daysInMonth () - fDate.day() +1 ); - view->setBaseDate( bDate, false ); - view->dayMatrix()->setSelectedDaysFrom(fDate , lDate); - if ( mLastDisplayedDN == 2 ) { - view = mExtraViews.at( 1 ); - bDate = bDate.addDays( bDate.daysInMonth () - bDate.day() +1 ); - view->setBaseDate( bDate, false ); - view->dayMatrix()->setSelectedDaysFrom(fDate , lDate); - } - return; - } //qDebug("%s %s ", lastAvailableDate().toString().latin1(), firstAvailableDate().toString().latin1() ); @@ -374,2 +378,3 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) } + mUpdateTimer->start( 250 ); //updateDayMatrixDates(); diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h index d5e5adf..df8efae 100644 --- a/korganizer/datenavigatorcontainer.h +++ b/korganizer/datenavigatorcontainer.h @@ -57,2 +57,3 @@ class DateNavigatorContainer: public QWidget void updateDayMatrixDates(); + void checkUpdateDayMatrixDates(); void updateToday(); @@ -83,2 +84,3 @@ class DateNavigatorContainer: public QWidget private: + QTimer* mUpdateTimer; int mLastDisplayedDN; diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 366e8b8..59618bf 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -662,4 +662,4 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) { - QRect sz = frameRect(); - if ( sz.width() <= 0 || sz.height() <= 0 ) + + if ( width() <= 0 || height() <= 0 ) return; @@ -669,4 +669,4 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) } - if ( myPix.width() != sz.width() || myPix.height()!=sz.height() ) { - myPix.resize(sz.size() ); + if ( myPix.width() != width() || myPix.height()!=height() ) { + myPix.resize(size() ); } @@ -681,4 +681,4 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) int xyOff = frameWidth(); - int colModulo = sz.width() % 7; - int rowModulo = sz.height() % 6; + int colModulo = (width()-2) % 7; + int rowModulo = (height()-2) % 6; //qDebug("col %d row %d ",colModulo,rowModulo ); @@ -688,5 +688,5 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) // draw background and topleft frame - p.fillRect(pevent->rect(), mDefaultBackColor); + p.fillRect(0,0,width(),height(), mDefaultBackColor); p.setPen(mDefaultTextColor); - p.drawRect(0, 0, sz.width()+1, sz.height()+1); + p.drawRect(0, 0, width(), height()); int mSelStartT = mSelStart; @@ -765,3 +765,4 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) addRow = 1; - p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, (7-col)*dwidth+colModulo, + int drawWid = width()-(col*dwidth+1+addCol2)-1; + p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid, dheight+1, selcol); @@ -916,3 +917,3 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) } - int off = xyOff; + int off = 0;//xyOff; bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP); |