-rw-r--r-- | korganizer/calendarview.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a10e93c..72221fd 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -665,35 +665,41 @@ void CalendarView::setScrollBarStep(int val ) { #ifdef DESKTOP_VERSION mDateScrollBar->setLineStep ( val ); #endif } void CalendarView::scrollBarValue(int val ) { #ifdef DESKTOP_VERSION if ( QApplication::desktop()->width() < 800 ) return; static bool block = false; if ( block ) return; block = true; - val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); - //qDebug("VAL %d ",val ); int count = mNavigator->selectedDates().count(); - int year = mNavigator->selectedDates().first().year(); int day = mNavigator->selectedDates().first().dayOfYear(); - if ( val == day -1 ) { + int stepdays = val; + if ( mDateScrollBar->lineStep () <= count ) { + val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); + //qDebug("VAL %d ",val ); + stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); + stepdays = day-1+stepdays; + if ( stepdays < 0 ) stepdays = 0; + } + if ( stepdays == day -1 ) { block = false; return; } + int year = mNavigator->selectedDates().first().year(); QDate d ( year,1,1 ); - mNavigator->selectDates( d.addDays( val ), count ); + mNavigator->selectDates( d.addDays( stepdays) , count ); block = false; #endif } void CalendarView::checkFiles() { QString message; QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; KopiCalendarFile * cal = calendars.first(); while ( cal ) { if ( cal->mErrorOnLoad ) { message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; |