-rw-r--r-- | korganizer/kodaymatrix.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index a2e0ae0..3ee1fa7 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -286,4 +286,5 @@ void KODayMatrix::addSelectedDaysTo(DateList& selDays) -void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) +bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) { + bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); mSelStart = startdate.daysTo(start); @@ -292,5 +293,11 @@ void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) mSelEnd = startdate.daysTo(end); - //qDebug("SELECTION %d %d ", mSelStart ,mSelEnd ); - if ( mSelEnd < 0 ) + if ( mSelEnd > NUMDAYS-1 ) + mSelEnd = NUMDAYS-1; + if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { clearSelection(); + if ( noSel ) + return false; + } + + return true; } @@ -701,2 +708,4 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) endMo = 12; + if ( mo == 12 && startMo == 1 ) + startMo = 13; if ( (startMo > mo || endMo < mo) ) { @@ -714,2 +723,3 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) } + //qDebug("SKIP %d ", skip); if ( ! skip ) { |