author | zautrix <zautrix> | 2005-03-22 16:21:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-22 16:21:03 (UTC) |
commit | ab8db23d665b276caa28471bb4db37e6b0de44ef (patch) (unidiff) | |
tree | 4697da2d9426f155237614368f993328560d0b21 | |
parent | f36f0308a955f869f18c88ab359f9d605e838f1c (diff) | |
download | kdepimpi-ab8db23d665b276caa28471bb4db37e6b0de44ef.zip kdepimpi-ab8db23d665b276caa28471bb4db37e6b0de44ef.tar.gz kdepimpi-ab8db23d665b276caa28471bb4db37e6b0de44ef.tar.bz2 |
fix
-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 | |||
@@ -48,4 +48,7 @@ DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, | |||
48 | //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 48 | //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
49 | mLastDisplayedDN = 0; | 49 | mLastDisplayedDN = 0; |
50 | mUpdateTimer; | ||
51 | mUpdateTimer = new QTimer( this ); | ||
52 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); | ||
50 | } | 53 | } |
51 | 54 | ||
@@ -136,7 +139,22 @@ void DateNavigatorContainer::setCalendar( Calendar *cal ) | |||
136 | } | 139 | } |
137 | } | 140 | } |
141 | void DateNavigatorContainer::checkUpdateDayMatrixDates() | ||
142 | { | ||
143 | QDate last = lastAvailableDate(); | ||
144 | QDate first = firstAvailableDate(); | ||
145 | |||
146 | QDate selFirst = mFirstSelectedDate; | ||
147 | QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); | ||
148 | if ( selFirst >= first && selLast <= last ) { | ||
149 | updateDayMatrixDates(); | ||
150 | } | ||
151 | else { | ||
152 | updateDayMatrixDates(); | ||
153 | emit monthSelected( mFirstSelectedDate.month() ); | ||
154 | } | ||
155 | } | ||
138 | void DateNavigatorContainer::updateDayMatrixDates() | 156 | void DateNavigatorContainer::updateDayMatrixDates() |
139 | { | 157 | { |
140 | 158 | mUpdateTimer->stop(); | |
141 | QDate fDate = mFirstSelectedDate; | 159 | QDate fDate = mFirstSelectedDate; |
142 | QDate lDate = fDate.addDays( mSelectedDateCount - 1 ); | 160 | QDate lDate = fDate.addDays( mSelectedDateCount - 1 ); |
@@ -219,18 +237,4 @@ void DateNavigatorContainer::selectDates( const DateList &dateList ) | |||
219 | QDate fDate = dateList.first(); | 237 | QDate fDate = dateList.first(); |
220 | QDate lDate = dateList.last(); | 238 | QDate lDate = dateList.last(); |
221 | if ( mLastDisplayedDN <= 2 ) { | ||
222 | mNavigatorView->selectDates( dateList ); | ||
223 | KDateNavigator *view = mExtraViews.at( 0 ); | ||
224 | QDate bDate = fDate.addDays( fDate.daysInMonth () - fDate.day() +1 ); | ||
225 | view->setBaseDate( bDate, false ); | ||
226 | view->dayMatrix()->setSelectedDaysFrom(fDate , lDate); | ||
227 | if ( mLastDisplayedDN == 2 ) { | ||
228 | view = mExtraViews.at( 1 ); | ||
229 | bDate = bDate.addDays( bDate.daysInMonth () - bDate.day() +1 ); | ||
230 | view->setBaseDate( bDate, false ); | ||
231 | view->dayMatrix()->setSelectedDaysFrom(fDate , lDate); | ||
232 | } | ||
233 | return; | ||
234 | } | ||
235 | //qDebug("%s %s ", lastAvailableDate().toString().latin1(), firstAvailableDate().toString().latin1() ); | 239 | //qDebug("%s %s ", lastAvailableDate().toString().latin1(), firstAvailableDate().toString().latin1() ); |
236 | //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() ); | 240 | //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() ); |
@@ -373,4 +377,5 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) | |||
373 | y * height, width, height ); | 377 | y * height, width, height ); |
374 | } | 378 | } |
379 | mUpdateTimer->start( 250 ); | ||
375 | //updateDayMatrixDates(); | 380 | //updateDayMatrixDates(); |
376 | } | 381 | } |
diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h index d5e5adf..df8efae 100644 --- a/korganizer/datenavigatorcontainer.h +++ b/korganizer/datenavigatorcontainer.h | |||
@@ -56,4 +56,5 @@ class DateNavigatorContainer: public QWidget | |||
56 | void updateDayMatrix(); | 56 | void updateDayMatrix(); |
57 | void updateDayMatrixDates(); | 57 | void updateDayMatrixDates(); |
58 | void checkUpdateDayMatrixDates(); | ||
58 | void updateToday(); | 59 | void updateToday(); |
59 | void slotMonthSelected( int month ); | 60 | void slotMonthSelected( int month ); |
@@ -82,4 +83,5 @@ class DateNavigatorContainer: public QWidget | |||
82 | 83 | ||
83 | private: | 84 | private: |
85 | QTimer* mUpdateTimer; | ||
84 | int mLastDisplayedDN; | 86 | int mLastDisplayedDN; |
85 | QDate mFirstSelectedDate; | 87 | QDate mFirstSelectedDate; |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 366e8b8..59618bf 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -661,6 +661,6 @@ void KODayMatrix::dropEvent(QDropEvent *e) | |||
661 | void KODayMatrix::paintEvent(QPaintEvent * pevent) | 661 | void KODayMatrix::paintEvent(QPaintEvent * pevent) |
662 | { | 662 | { |
663 | QRect sz = frameRect(); | 663 | |
664 | if ( sz.width() <= 0 || sz.height() <= 0 ) | 664 | if ( width() <= 0 || height() <= 0 ) |
665 | return; | 665 | return; |
666 | if ( mPendingUpdateBeforeRepaint ) { | 666 | if ( mPendingUpdateBeforeRepaint ) { |
@@ -668,6 +668,6 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
668 | mPendingUpdateBeforeRepaint = false; | 668 | mPendingUpdateBeforeRepaint = false; |
669 | } | 669 | } |
670 | if ( myPix.width() != sz.width() || myPix.height()!=sz.height() ) { | 670 | if ( myPix.width() != width() || myPix.height()!=height() ) { |
671 | myPix.resize(sz.size() ); | 671 | myPix.resize(size() ); |
672 | } | 672 | } |
673 | QPainter p(&myPix); | 673 | QPainter p(&myPix); |
@@ -680,6 +680,6 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
680 | int selw, selh; | 680 | int selw, selh; |
681 | int xyOff = frameWidth(); | 681 | int xyOff = frameWidth(); |
682 | int colModulo = sz.width() % 7; | 682 | int colModulo = (width()-2) % 7; |
683 | int rowModulo = sz.height() % 6; | 683 | int rowModulo = (height()-2) % 6; |
684 | //qDebug("col %d row %d ",colModulo,rowModulo ); | 684 | //qDebug("col %d row %d ",colModulo,rowModulo ); |
685 | 685 | ||
@@ -687,7 +687,7 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
687 | 687 | ||
688 | // draw background and topleft frame | 688 | // draw background and topleft frame |
689 | p.fillRect(pevent->rect(), mDefaultBackColor); | 689 | p.fillRect(0,0,width(),height(), mDefaultBackColor); |
690 | p.setPen(mDefaultTextColor); | 690 | p.setPen(mDefaultTextColor); |
691 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); | 691 | p.drawRect(0, 0, width(), height()); |
692 | int mSelStartT = mSelStart; | 692 | int mSelStartT = mSelStart; |
693 | int mSelEndT = mSelEnd; | 693 | int mSelEndT = mSelEnd; |
@@ -764,5 +764,6 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
764 | if ( row == 0) | 764 | if ( row == 0) |
765 | addRow = 1; | 765 | addRow = 1; |
766 | p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, (7-col)*dwidth+colModulo, | 766 | int drawWid = width()-(col*dwidth+1+addCol2)-1; |
767 | p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, drawWid, | ||
767 | dheight+1, selcol); | 768 | dheight+1, selcol); |
768 | // draw full block till last line | 769 | // draw full block till last line |
@@ -915,5 +916,5 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
915 | } | 916 | } |
916 | } | 917 | } |
917 | int off = xyOff; | 918 | int off = 0;//xyOff; |
918 | bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP); | 919 | bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP); |
919 | //qDebug("ffffffffff %d ", off); | 920 | //qDebug("ffffffffff %d ", off); |