-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() | |||
653 | delete mDateFrame ; | 653 | delete mDateFrame ; |
654 | delete mEventViewerDialog; | 654 | delete mEventViewerDialog; |
655 | //kdDebug() << "~CalendarView() done" << endl; | 655 | //kdDebug() << "~CalendarView() done" << endl; |
656 | } | 656 | } |
657 | void CalendarView::setCalReadOnly( int id, bool readO ) | 657 | void CalendarView::setCalReadOnly( int id, bool readO ) |
658 | { | 658 | { |
659 | if ( readO ) { | 659 | if ( readO ) { |
660 | emit save(); | 660 | emit save(); |
661 | } | 661 | } |
662 | mCalendar->setReadOnly( id, readO ); | 662 | mCalendar->setReadOnly( id, readO ); |
663 | } | 663 | } |
664 | void CalendarView::setScrollBarStep(int val ) | 664 | void CalendarView::setScrollBarStep(int val ) |
665 | { | 665 | { |
666 | #ifdef DESKTOP_VERSION | 666 | #ifdef DESKTOP_VERSION |
667 | mDateScrollBar->setLineStep ( val ); | 667 | mDateScrollBar->setLineStep ( val ); |
668 | #endif | 668 | #endif |
669 | } | 669 | } |
670 | void CalendarView::scrollBarValue(int val ) | 670 | void CalendarView::scrollBarValue(int val ) |
671 | { | 671 | { |
672 | #ifdef DESKTOP_VERSION | 672 | #ifdef DESKTOP_VERSION |
673 | if ( QApplication::desktop()->width() < 800 ) return; | 673 | if ( QApplication::desktop()->width() < 800 ) return; |
674 | static bool block = false; | 674 | static bool block = false; |
675 | if ( block ) return; | 675 | if ( block ) return; |
676 | block = true; | 676 | block = true; |
677 | val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | ||
678 | //qDebug("VAL %d ",val ); | ||
679 | int count = mNavigator->selectedDates().count(); | 677 | int count = mNavigator->selectedDates().count(); |
680 | int year = mNavigator->selectedDates().first().year(); | ||
681 | int day = mNavigator->selectedDates().first().dayOfYear(); | 678 | int day = mNavigator->selectedDates().first().dayOfYear(); |
682 | if ( val == day -1 ) { | 679 | int stepdays = val; |
680 | if ( mDateScrollBar->lineStep () <= count ) { | ||
681 | val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | ||
682 | //qDebug("VAL %d ",val ); | ||
683 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | ||
684 | stepdays = day-1+stepdays; | ||
685 | if ( stepdays < 0 ) stepdays = 0; | ||
686 | } | ||
687 | if ( stepdays == day -1 ) { | ||
683 | block = false; | 688 | block = false; |
684 | return; | 689 | return; |
685 | } | 690 | } |
691 | int year = mNavigator->selectedDates().first().year(); | ||
686 | QDate d ( year,1,1 ); | 692 | QDate d ( year,1,1 ); |
687 | mNavigator->selectDates( d.addDays( val ), count ); | 693 | mNavigator->selectDates( d.addDays( stepdays) , count ); |
688 | block = false; | 694 | block = false; |
689 | #endif | 695 | #endif |
690 | 696 | ||
691 | } | 697 | } |
692 | void CalendarView::checkFiles() | 698 | void CalendarView::checkFiles() |
693 | { | 699 | { |
694 | QString message; | 700 | QString message; |
695 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 701 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
696 | KopiCalendarFile * cal = calendars.first(); | 702 | KopiCalendarFile * cal = calendars.first(); |
697 | while ( cal ) { | 703 | while ( cal ) { |
698 | if ( cal->mErrorOnLoad ) { | 704 | if ( cal->mErrorOnLoad ) { |
699 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; | 705 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; |
700 | } | 706 | } |
701 | cal = calendars.next(); | 707 | cal = calendars.next(); |
702 | } | 708 | } |
703 | if ( !message.isEmpty() ) { | 709 | if ( !message.isEmpty() ) { |
704 | 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); | 710 | 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); |
705 | KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); | 711 | KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); |
706 | } | 712 | } |
707 | QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); | 713 | QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); |
708 | } | 714 | } |
709 | void CalendarView::checkAlarms() | 715 | void CalendarView::checkAlarms() |
710 | { | 716 | { |
711 | 717 | ||