summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 28b17a5..31e103d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -361,16 +361,21 @@ CalendarView::CalendarView( Calendar *calendar,
361 361
362 mEventEditor = 0; 362 mEventEditor = 0;
363 mTodoEditor = 0; 363 mTodoEditor = 0;
364 init(); 364 init();
365} 365}
366 366
367void CalendarView::init() 367void CalendarView::init()
368{ 368{
369 flag_blockConflict = false;
370 flag_blockScrollBar = false;
371 flag_checkFileFirsttime = true;
372 flag_clearallviewsEventDisplay = false;
373 flag_clearallviewsupdateView = false;
369 mNextAlarmDateTime = QDateTime::currentDateTime(); 374 mNextAlarmDateTime = QDateTime::currentDateTime();
370 setFocusPolicy (NoFocus ); 375 setFocusPolicy (NoFocus );
371 mViewerCallerIsSearchDialog = false; 376 mViewerCallerIsSearchDialog = false;
372 mBlockShowDates = false; 377 mBlockShowDates = false;
373 mConflictingEvent = 0; 378 mConflictingEvent = 0;
374 mDatePickerMode = 0; 379 mDatePickerMode = 0;
375 mCurrentSyncDevice = ""; 380 mCurrentSyncDevice = "";
376 mViewManager = new KOViewManager( this ); 381 mViewManager = new KOViewManager( this );
@@ -656,19 +661,18 @@ CalendarView::~CalendarView()
656 delete mDateFrame ; 661 delete mDateFrame ;
657 delete mEventViewerDialog; 662 delete mEventViewerDialog;
658 //kdDebug() << "~CalendarView() done" << endl; 663 //kdDebug() << "~CalendarView() done" << endl;
659} 664}
660 665
661 666
662void CalendarView::nextConflict( bool all, bool allday ) 667void CalendarView::nextConflict( bool all, bool allday )
663{ 668{
664 static bool block = false; 669 if ( flag_blockConflict ) return;
665 if ( block ) return; 670 flag_blockConflict = true;
666 block = true;
667 QPtrList<Event> testlist = mCalendar->events(); 671 QPtrList<Event> testlist = mCalendar->events();
668 Event * test = testlist.first(); 672 Event * test = testlist.first();
669 while ( test ) { 673 while ( test ) {
670 test->setTagged( false ); 674 test->setTagged( false );
671 test = testlist.next(); 675 test = testlist.next();
672 } 676 }
673 QTime st ( 0,0,0); 677 QTime st ( 0,0,0);
674 if ( mViewManager->currentView() == mViewManager->agendaView() ) 678 if ( mViewManager->currentView() == mViewManager->agendaView() )
@@ -735,23 +739,23 @@ void CalendarView::nextConflict( bool all, bool allday )
735 //qDebug("Search time : %d", tm.elapsed()); 739 //qDebug("Search time : %d", tm.elapsed());
736 if ( found ) { 740 if ( found ) {
737 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 741 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
738 mViewManager->showDayView(); 742 mViewManager->showDayView();
739 mNavigator->slotDaySelect( conflict.date() ); 743 mNavigator->slotDaySelect( conflict.date() );
740 int hour = conflict.time().hour(); 744 int hour = conflict.time().hour();
741 mViewManager->agendaView()->setStartHour( hour ); 745 mViewManager->agendaView()->setStartHour( hour );
742 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); 746 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) );
743 block = false; 747 flag_blockConflict = false;
744 return; 748 return;
745 } 749 }
746 750
747 topLevelWidget()->setCaption( i18n("No conflict found") ); 751 topLevelWidget()->setCaption( i18n("No conflict found") );
748 //qDebug("No conflict found "); 752 //qDebug("No conflict found ");
749 block = false; 753 flag_blockConflict = false;
750 return; 754 return;
751} 755}
752 756
753void CalendarView::conflictAll() 757void CalendarView::conflictAll()
754{ 758{
755 nextConflict ( true, true ); 759 nextConflict ( true, true );
756} 760}
757void CalendarView::conflictAllday() 761void CalendarView::conflictAllday()
@@ -775,37 +779,36 @@ void CalendarView::setScrollBarStep(int val )
775#ifdef DESKTOP_VERSION 779#ifdef DESKTOP_VERSION
776 mDateScrollBar->setLineStep ( val ); 780 mDateScrollBar->setLineStep ( val );
777#endif 781#endif
778} 782}
779void CalendarView::scrollBarValue(int val ) 783void CalendarView::scrollBarValue(int val )
780{ 784{
781#ifdef DESKTOP_VERSION 785#ifdef DESKTOP_VERSION
782 if ( QApplication::desktop()->width() < 800 ) return; 786 if ( QApplication::desktop()->width() < 800 ) return;
783 static bool block = false; 787 if ( flag_blockScrollBar ) return;
784 if ( block ) return; 788 flag_blockScrollBar = true;
785 block = true;
786 int count = mNavigator->selectedDates().count(); 789 int count = mNavigator->selectedDates().count();
787 int day = mNavigator->selectedDates().first().dayOfYear(); 790 int day = mNavigator->selectedDates().first().dayOfYear();
788 int stepdays = val; 791 int stepdays = val;
789 if ( mDateScrollBar->lineStep () <= count ) { 792 if ( mDateScrollBar->lineStep () <= count ) {
790 //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 793 //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
791 //qDebug("VAL %d ",val ); 794 //qDebug("VAL %d ",val );
792 stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 795 stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
793 stepdays = day+stepdays; 796 stepdays = day+stepdays;
794 if ( stepdays < 0 ) stepdays = 0; 797 if ( stepdays < 0 ) stepdays = 0;
795 } 798 }
796 if ( stepdays == day ) { 799 if ( stepdays == day ) {
797 block = false; 800 flag_blockScrollBar = false;
798 return; 801 return;
799 } 802 }
800 int year = mNavigator->selectedDates().first().year(); 803 int year = mNavigator->selectedDates().first().year();
801 QDate d ( year,1,1 ); 804 QDate d ( year,1,1 );
802 mNavigator->selectDates( d.addDays( stepdays-1) , count ); 805 mNavigator->selectDates( d.addDays( stepdays-1) , count );
803 block = false; 806 flag_blockScrollBar = false;
804#endif 807#endif
805 808
806} 809}
807void CalendarView::updateView(const QDate &start, const QDate &end) 810void CalendarView::updateView(const QDate &start, const QDate &end)
808{ 811{
809#ifdef DESKTOP_VERSION 812#ifdef DESKTOP_VERSION
810 if ( ! mDateScrollBar->draggingSlider () ) { 813 if ( ! mDateScrollBar->draggingSlider () ) {
811 int dof = start.dayOfYear(); 814 int dof = start.dayOfYear();
@@ -834,19 +837,18 @@ void CalendarView::checkFiles()
834 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; 837 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
835 } 838 }
836 cal = calendars.next(); 839 cal = calendars.next();
837 } 840 }
838 if ( !message.isEmpty() ) { 841 if ( !message.isEmpty() ) {
839 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); 842 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);
840 KMessageBox::error(this,message, i18n("Loading of calendar(s) failed")); 843 KMessageBox::error(this,message, i18n("Loading of calendar(s) failed"));
841 } 844 }
842 static bool firstTime = true; 845 if ( flag_checkFileFirsttime ) {
843 if ( firstTime ) { 846 flag_checkFileFirsttime = false;
844 firstTime = false;
845 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); 847 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() ));
846 } 848 }
847} 849}
848void CalendarView::checkAlarms() 850void CalendarView::checkAlarms()
849{ 851{
850 KConfig *config = KOGlobals::config(); 852 KConfig *config = KOGlobals::config();
851 config->setGroup( "AppRun" ); 853 config->setGroup( "AppRun" );
852 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 854 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
@@ -3011,25 +3013,24 @@ void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
3011} 3013}
3012 3014
3013// most of the changeEventDisplays() right now just call the view's 3015// most of the changeEventDisplays() right now just call the view's
3014// total update mode, but they SHOULD be recoded to be more refresh-efficient. 3016// total update mode, but they SHOULD be recoded to be more refresh-efficient.
3015void CalendarView::changeEventDisplay(Event *which, int action) 3017void CalendarView::changeEventDisplay(Event *which, int action)
3016{ 3018{
3017 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 3019 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
3018 changeIncidenceDisplay((Incidence *)which, action); 3020 changeIncidenceDisplay((Incidence *)which, action);
3019 static bool clearallviews = false;
3020 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { 3021 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) {
3021 if ( clearallviews ) { 3022 if ( flag_clearallviewsEventDisplay ) {
3022 clearAllViews(); 3023 clearAllViews();
3023 clearallviews = false; 3024 flag_clearallviewsEventDisplay = false;
3024 } 3025 }
3025 return; 3026 return;
3026 } 3027 }
3027 clearallviews = true; 3028 flag_clearallviewsEventDisplay = true;
3028 mDateNavigator->updateView(); 3029 mDateNavigator->updateView();
3029 //mDialogManager->updateSearchDialog(); 3030 //mDialogManager->updateSearchDialog();
3030 if (which) { 3031 if (which) {
3031 // If there is an event view visible update the display 3032 // If there is an event view visible update the display
3032 mViewManager->currentView()->changeEventDisplay(which,action); 3033 mViewManager->currentView()->changeEventDisplay(which,action);
3033 // TODO: check, if update needed 3034 // TODO: check, if update needed
3034 // if (which->getTodoStatus()) { 3035 // if (which->getTodoStatus()) {
3035 mTodoList->updateView(); 3036 mTodoList->updateView();
@@ -3172,25 +3173,24 @@ void CalendarView::clearAllViews()
3172 if ( sd ) { 3173 if ( sd ) {
3173 KOListView* kol = sd->listview(); 3174 KOListView* kol = sd->listview();
3174 if ( kol ) 3175 if ( kol )
3175 kol->clearList(); 3176 kol->clearList();
3176 } 3177 }
3177} 3178}
3178void CalendarView::updateView() 3179void CalendarView::updateView()
3179{ 3180{
3180 static bool clearallviews = false;
3181 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { 3181 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) {
3182 if ( clearallviews ) { 3182 if ( flag_clearallviewsupdateView ) {
3183 clearAllViews(); 3183 clearAllViews();
3184 clearallviews = false; 3184 flag_clearallviewsupdateView = false;
3185 } 3185 }
3186 return; 3186 return;
3187 } 3187 }
3188 clearallviews = true; 3188 flag_clearallviewsupdateView = true;
3189 DateList tmpList = mNavigator->selectedDates(); 3189 DateList tmpList = mNavigator->selectedDates();
3190 3190
3191 if ( KOPrefs::instance()->mHideNonStartedTodos ) 3191 if ( KOPrefs::instance()->mHideNonStartedTodos )
3192 mTodoList->updateView(); 3192 mTodoList->updateView();
3193 // We assume that the navigator only selects consecutive days. 3193 // We assume that the navigator only selects consecutive days.
3194 updateView( tmpList.first(), tmpList.last() ); 3194 updateView( tmpList.first(), tmpList.last() );
3195} 3195}
3196 3196