From 345c70e057e730850493689185b5c358607566f9 Mon Sep 17 00:00:00 2001 From: zautrix Date: Tue, 22 Mar 2005 12:05:42 +0000 Subject: more layout fixes --- (limited to 'korganizer/kodaymatrix.cpp') diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index a2e0ae0..3ee1fa7 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -284,15 +284,22 @@ 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); if ( mSelStart < 0 ) mSelStart = 0; 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; } void KODayMatrix::clearSelection() { @@ -699,6 +706,8 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) startMo = 1; if ( endMo == 1 && mo == 12 ) endMo = 12; + if ( mo == 12 && startMo == 1 ) + startMo = 13; if ( (startMo > mo || endMo < mo) ) { skip = true; } else { @@ -712,6 +721,7 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) } } } + //qDebug("SKIP %d ", skip); if ( ! skip ) { row = mSelStartT/7; col = mSelStartT -row*7; -- cgit v0.9.0.2