summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp16
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
@@ -674,17 +674,23 @@ void CalendarView::scrollBarValue(int val )
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