author | zautrix <zautrix> | 2005-03-21 16:28:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-21 16:28:05 (UTC) |
commit | 070055b60f76ffd6907e44a4ffc2d752578f3211 (patch) (side-by-side diff) | |
tree | 727346a900b4712f36842c460bfa0fef1ba6382b | |
parent | 86c420a68008e4430bd769ebdecdfa430ba552f5 (diff) | |
download | kdepimpi-070055b60f76ffd6907e44a4ffc2d752578f3211.zip kdepimpi-070055b60f76ffd6907e44a4ffc2d752578f3211.tar.gz kdepimpi-070055b60f76ffd6907e44a4ffc2d752578f3211.tar.bz2 |
fix
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 7 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 9 |
2 files changed, 14 insertions, 2 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index 9506768..b147427 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp @@ -110,49 +110,54 @@ void DateNavigatorContainer::updateView() { mNavigatorView->updateView(); KDateNavigator *n; for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { n->updateView(); } } void DateNavigatorContainer::updateConfig() { mNavigatorView->updateConfig(); KDateNavigator *n; for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { n->updateConfig(); } } void DateNavigatorContainer::selectDates( const DateList &dateList ) { mNavigatorView->selectDates( dateList ); setBaseDates(); if ( mExtraViews.count() ) { KDateNavigator *view = mExtraViews.at( 0 ); view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); - view->dayMatrix()->repaint( false ); + view->dayMatrix()->repaint( false ); + if ( mExtraViews.count() > 1 ) { + KDateNavigator *view = mExtraViews.at( 1 ); + view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); + view->dayMatrix()->repaint( false ); + } } } void DateNavigatorContainer::setBaseDates() { KCal::DateList dateList = mNavigatorView->selectedDates(); if ( dateList.isEmpty() ) { kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; } QDate baseDate = dateList.first(); KDateNavigator *n; bool doRepaint = false; // skip first repaint for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { baseDate = baseDate.addDays( baseDate.daysInMonth () - baseDate.day() +1 ); n->setBaseDate( baseDate, doRepaint ); doRepaint = true; } } void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) { #if 0 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; kdDebug(5850) << " CURRENT SIZE: " << size() << endl; diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index a776cb6..d7a4112 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -269,48 +269,49 @@ void KODayMatrix::addSelectedDaysTo(DateList& selDays) //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) if (mSelEnd > NUMDAYS-1) { for (int i = i0; i <= NUMDAYS-1; i++) { selDays.append(days[i]); } for (int i = NUMDAYS; i < mSelEnd; i++) { selDays.append(days[0].addDays(i)); } // apply normal routine to selection being entirely within matrix limits } else { for (int i = i0; i <= mSelEnd; i++) { selDays.append(days[i]); } } } void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) { mSelStart = startdate.daysTo(start); if ( mSelStart < 0 ) mSelStart = 0; mSelEnd = startdate.daysTo(end); + //qDebug("SELECTION %d %d ", mSelStart ,mSelEnd ); if ( mSelEnd < 0 ) clearSelection(); } void KODayMatrix::clearSelection() { mSelEnd = mSelStart = NOSELECTION; } void KODayMatrix::recalculateToday() { today = -1; for (int i=0; i<NUMDAYS; i++) { events[i] = 0; days[i] = startdate.addDays(i); daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); // if today is in the currently displayed month, hilight today if (days[i].year() == QDate::currentDate().year() && days[i].month() == QDate::currentDate().month() && days[i].day() == QDate::currentDate().day()) { today = i; } } @@ -670,49 +671,55 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) int row,col; int selw, selh; int xyOff = frameWidth(); int colModulo = sz.width() % 7; int rowModulo = sz.height() % 6; //qDebug("col %d row %d ",colModulo,rowModulo ); bool isRTL = KOGlobals::self()->reverseLayout(); // draw background and topleft frame p.fillRect(pevent->rect(), mDefaultBackColor); p.setPen(mDefaultTextColor); p.drawRect(0, 0, sz.width()+1, sz.height()+1); int mSelStartT = mSelStart; int mSelEndT = mSelEnd; if ( mSelEndT >= NUMDAYS ) mSelEndT = NUMDAYS-1; // draw selected days with highlighted background color if (mSelStart != NOSELECTION) { bool skip = false; if ( ! mouseDown ) { int mo = days[20].month(); //qDebug("-- %d %d ", mSelStartT, mSelEndT); //qDebug("%d %d %d - d %d", mo, days[mSelStartT].month() , days[mSelEndT].month(), days[mSelEndT].day() ); - if ( days[mSelStartT].month() > mo || days[mSelEndT].month() < mo ) { + int startMo = days[mSelStartT].month(); + int endMo = days[mSelEndT].month(); + if ( startMo == 12 && mo == 1 && endMo == 1 ) + startMo = 1; + if ( endMo == 1 && mo == 12 ) + endMo = 12; + if ( (startMo > mo || endMo < mo) ) { skip = true; } else { if ( days[mSelStartT].month() != mo ) { int add = days[mSelStartT].daysInMonth ()-days[mSelStartT].day(); mSelStartT += add +1; } if ( days[mSelEndT].month() != mo ) { int sub = days[mSelEndT].day(); mSelEndT -= sub ; } } } if ( ! skip ) { row = mSelStartT/7; col = mSelStartT -row*7; QColor selcol = KOPrefs::instance()->mHighlightColor; int addCol = 0; int addRow = 0; int addRow2 = 0; int addCol2 = 0; if (row == mSelEndT/7) { if ( rowModulo ) { if ( row >= 6 - rowModulo ) addRow = row - 5 + rowModulo; |