-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 @@ -126,17 +126,22 @@ void DateNavigatorContainer::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; diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index a776cb6..d7a4112 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -285,16 +285,17 @@ void KODayMatrix::addSelectedDaysTo(DateList& selDays) } 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; } @@ -686,17 +687,23 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) 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(); |