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 /korganizer/kodaymatrix.cpp | |
parent | 86c420a68008e4430bd769ebdecdfa430ba552f5 (diff) | |
download | kdepimpi-070055b60f76ffd6907e44a4ffc2d752578f3211.zip kdepimpi-070055b60f76ffd6907e44a4ffc2d752578f3211.tar.gz kdepimpi-070055b60f76ffd6907e44a4ffc2d752578f3211.tar.bz2 |
fix
-rw-r--r-- | korganizer/kodaymatrix.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index a776cb6..d7a4112 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -281,24 +281,25 @@ void KODayMatrix::addSelectedDaysTo(DateList& selDays) 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; @@ -682,25 +683,31 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) 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 ; } } } |