-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 @@ -653,59 +653,65 @@ CalendarView::~CalendarView() delete mDateFrame ; delete mEventViewerDialog; //kdDebug() << "~CalendarView() done" << endl; } void CalendarView::setCalReadOnly( int id, bool readO ) { if ( readO ) { emit save(); } mCalendar->setReadOnly( id, readO ); } 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"; } cal = calendars.next(); } if ( !message.isEmpty() ) { message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); } QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); } void CalendarView::checkAlarms() { |