-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 @@ -657,65 +657,85 @@ CalendarView::~CalendarView() 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; 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() ) { 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() { KConfig *config = KOGlobals::config(); config->setGroup( "AppRun" ); QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); @@ -2612,64 +2632,48 @@ void CalendarView::changeEventDisplay(Event *which, int action) mDateNavigator->updateView(); //mDialogManager->updateSearchDialog(); if (which) { // If there is an event view visible update the display mViewManager->currentView()->changeEventDisplay(which,action); // TODO: check, if update needed // if (which->getTodoStatus()) { mTodoList->updateView(); // } } else { mViewManager->currentView()->updateView(); } } 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(); } } void CalendarView::updateView() { DateList tmpList = mNavigator->selectedDates(); if ( KOPrefs::instance()->mHideNonStartedTodos ) mTodoList->updateView(); // We assume that the navigator only selects consecutive days. updateView( tmpList.first(), tmpList.last() ); } void CalendarView::updateUnmanagedViews() { |