summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp44
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()
657void CalendarView::setCalReadOnly( int id, bool readO ) 657void 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}
664void CalendarView::setScrollBarStep(int val ) 664void 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}
670void CalendarView::scrollBarValue(int val ) 670void 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 int count = mNavigator->selectedDates().count(); 677 int count = mNavigator->selectedDates().count();
678 int day = mNavigator->selectedDates().first().dayOfYear(); 678 int day = mNavigator->selectedDates().first().dayOfYear();
679 int stepdays = val; 679 int stepdays = val;
680 if ( mDateScrollBar->lineStep () <= count ) { 680 if ( mDateScrollBar->lineStep () <= count ) {
681 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 681 //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
682 //qDebug("VAL %d ",val ); 682 //qDebug("VAL %d ",val );
683 stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 683 stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
684 stepdays = day-1+stepdays; 684 stepdays = day+stepdays;
685 if ( stepdays < 0 ) stepdays = 0; 685 if ( stepdays < 0 ) stepdays = 0;
686 } 686 }
687 if ( stepdays == day -1 ) { 687 if ( stepdays == day ) {
688 block = false; 688 block = false;
689 return; 689 return;
690 } 690 }
691 int year = mNavigator->selectedDates().first().year(); 691 int year = mNavigator->selectedDates().first().year();
692 QDate d ( year,1,1 ); 692 QDate d ( year,1,1 );
693 mNavigator->selectDates( d.addDays( stepdays) , count ); 693 mNavigator->selectDates( d.addDays( stepdays-1) , count );
694 block = false; 694 block = false;
695#endif 695#endif
696 696
697} 697}
698void CalendarView::updateView(const QDate &start, const QDate &end)
699{
700#ifdef DESKTOP_VERSION
701 if ( ! mDateScrollBar->draggingSlider () ) {
702 int dof = start.dayOfYear();
703 //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() );
704 if ( dof != mDateScrollBar->value() ) {
705 mDateScrollBar->blockSignals( true );
706 mDateScrollBar->setValue( start.dayOfYear());
707 mDateScrollBar->blockSignals( false );
708 }
709 }
710#endif
711 mTodoList->updateView();
712 mViewManager->updateView(start, end);
713 //mDateNavigator->updateView();
714}
715
716
717
698void CalendarView::checkFiles() 718void CalendarView::checkFiles()
699{ 719{
700 QString message; 720 QString message;
701 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 721 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
702 KopiCalendarFile * cal = calendars.first(); 722 KopiCalendarFile * cal = calendars.first();
703 while ( cal ) { 723 while ( cal ) {
704 if ( cal->mErrorOnLoad ) { 724 if ( cal->mErrorOnLoad ) {
705 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; 725 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
706 } 726 }
707 cal = calendars.next(); 727 cal = calendars.next();
708 } 728 }
709 if ( !message.isEmpty() ) { 729 if ( !message.isEmpty() ) {
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); 730 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);
711 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); 731 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed"));
712 } 732 }
713 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); 733 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() ));
714} 734}
715void CalendarView::checkAlarms() 735void CalendarView::checkAlarms()
716{ 736{
717 737
718 738
719 KConfig *config = KOGlobals::config(); 739 KConfig *config = KOGlobals::config();
720 config->setGroup( "AppRun" ); 740 config->setGroup( "AppRun" );
721 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 741 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
@@ -2612,64 +2632,48 @@ void CalendarView::changeEventDisplay(Event *which, int action)
2612 mDateNavigator->updateView(); 2632 mDateNavigator->updateView();
2613 //mDialogManager->updateSearchDialog(); 2633 //mDialogManager->updateSearchDialog();
2614 2634
2615 if (which) { 2635 if (which) {
2616 // If there is an event view visible update the display 2636 // If there is an event view visible update the display
2617 mViewManager->currentView()->changeEventDisplay(which,action); 2637 mViewManager->currentView()->changeEventDisplay(which,action);
2618 // TODO: check, if update needed 2638 // TODO: check, if update needed
2619 // if (which->getTodoStatus()) { 2639 // if (which->getTodoStatus()) {
2620 mTodoList->updateView(); 2640 mTodoList->updateView();
2621 // } 2641 // }
2622 } else { 2642 } else {
2623 mViewManager->currentView()->updateView(); 2643 mViewManager->currentView()->updateView();
2624 } 2644 }
2625} 2645}
2626 2646
2627 2647
2628void CalendarView::updateTodoViews() 2648void CalendarView::updateTodoViews()
2629{ 2649{
2630 mTodoList->updateView(); 2650 mTodoList->updateView();
2631 mViewManager->currentView()->updateView(); 2651 mViewManager->currentView()->updateView();
2632 2652
2633} 2653}
2634 2654
2635 2655
2636void CalendarView::updateView(const QDate &start, const QDate &end)
2637{
2638#ifdef DESKTOP_VERSION
2639 if ( ! mDateScrollBar->draggingSlider () ) {
2640 int dof = start.dayOfYear()-1;
2641 if ( dof != mDateScrollBar->value() ) {
2642 mDateScrollBar->blockSignals( true );
2643 mDateScrollBar->setValue( start.dayOfYear()-1);
2644 mDateScrollBar->blockSignals( false );
2645 }
2646 }
2647#endif
2648 mTodoList->updateView();
2649 mViewManager->updateView(start, end);
2650 //mDateNavigator->updateView();
2651}
2652 2656
2653void CalendarView::clearAllViews() 2657void CalendarView::clearAllViews()
2654{ 2658{
2655 mTodoList->clearList(); 2659 mTodoList->clearList();
2656 mViewManager->clearAllViews(); 2660 mViewManager->clearAllViews();
2657 SearchDialog * sd = mDialogManager->getSearchDialog(); 2661 SearchDialog * sd = mDialogManager->getSearchDialog();
2658 if ( sd ) { 2662 if ( sd ) {
2659 KOListView* kol = sd->listview(); 2663 KOListView* kol = sd->listview();
2660 if ( kol ) 2664 if ( kol )
2661 kol->clearList(); 2665 kol->clearList();
2662 } 2666 }
2663} 2667}
2664void CalendarView::updateView() 2668void CalendarView::updateView()
2665{ 2669{
2666 DateList tmpList = mNavigator->selectedDates(); 2670 DateList tmpList = mNavigator->selectedDates();
2667 2671
2668 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2672 if ( KOPrefs::instance()->mHideNonStartedTodos )
2669 mTodoList->updateView(); 2673 mTodoList->updateView();
2670 // We assume that the navigator only selects consecutive days. 2674 // We assume that the navigator only selects consecutive days.
2671 updateView( tmpList.first(), tmpList.last() ); 2675 updateView( tmpList.first(), tmpList.last() );
2672} 2676}
2673 2677
2674void CalendarView::updateUnmanagedViews() 2678void CalendarView::updateUnmanagedViews()
2675{ 2679{