-rw-r--r-- | korganizer/calendarview.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1785b8a..7566c6f 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -669,41 +669,61 @@ void CalendarView::setScrollBarStep(int val ) } void CalendarView::scrollBarValue(int val ) { #ifdef DESKTOP_VERSION if ( QApplication::desktop()->width() < 800 ) return; static bool block = false; if ( block ) return; block = true; int count = mNavigator->selectedDates().count(); int day = mNavigator->selectedDates().first().dayOfYear(); int stepdays = val; if ( mDateScrollBar->lineStep () <= count ) { - val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); + //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); //qDebug("VAL %d ",val ); stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); - stepdays = day-1+stepdays; + stepdays = day+stepdays; if ( stepdays < 0 ) stepdays = 0; } - if ( stepdays == day -1 ) { + if ( stepdays == day ) { block = false; return; } int year = mNavigator->selectedDates().first().year(); QDate d ( year,1,1 ); - mNavigator->selectDates( d.addDays( stepdays) , count ); + mNavigator->selectDates( d.addDays( stepdays-1) , count ); block = false; #endif } +void CalendarView::updateView(const QDate &start, const QDate &end) +{ +#ifdef DESKTOP_VERSION + if ( ! mDateScrollBar->draggingSlider () ) { + int dof = start.dayOfYear(); + //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); + if ( dof != mDateScrollBar->value() ) { + mDateScrollBar->blockSignals( true ); + mDateScrollBar->setValue( start.dayOfYear()); + mDateScrollBar->blockSignals( false ); + } + } +#endif + mTodoList->updateView(); + mViewManager->updateView(start, end); + //mDateNavigator->updateView(); +} + + + 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() ) { @@ -2624,40 +2644,24 @@ void CalendarView::changeEventDisplay(Event *which, int action) } } void CalendarView::updateTodoViews() { mTodoList->updateView(); mViewManager->currentView()->updateView(); } -void CalendarView::updateView(const QDate &start, const QDate &end) -{ -#ifdef DESKTOP_VERSION - if ( ! mDateScrollBar->draggingSlider () ) { - int dof = start.dayOfYear()-1; - if ( dof != mDateScrollBar->value() ) { - mDateScrollBar->blockSignals( true ); - mDateScrollBar->setValue( start.dayOfYear()-1); - mDateScrollBar->blockSignals( false ); - } - } -#endif - mTodoList->updateView(); - mViewManager->updateView(start, end); - //mDateNavigator->updateView(); -} void CalendarView::clearAllViews() { mTodoList->clearList(); mViewManager->clearAllViews(); SearchDialog * sd = mDialogManager->getSearchDialog(); if ( sd ) { KOListView* kol = sd->listview(); if ( kol ) kol->clearList(); } } |