summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 427d71b..9674921 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2715,129 +2715,133 @@ void CalendarView::eventAdded(Event *event)
2715{ 2715{
2716 changeEventDisplay(event,KOGlobals::EVENTADDED); 2716 changeEventDisplay(event,KOGlobals::EVENTADDED);
2717} 2717}
2718 2718
2719void CalendarView::eventToBeDeleted(Event *) 2719void CalendarView::eventToBeDeleted(Event *)
2720{ 2720{
2721 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2721 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2722} 2722}
2723 2723
2724void CalendarView::eventDeleted() 2724void CalendarView::eventDeleted()
2725{ 2725{
2726 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2726 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2727} 2727}
2728void CalendarView::changeTodoDisplay(Todo *which, int action) 2728void CalendarView::changeTodoDisplay(Todo *which, int action)
2729{ 2729{
2730 changeIncidenceDisplay((Incidence *)which, action); 2730 changeIncidenceDisplay((Incidence *)which, action);
2731 mDateNavigator->updateView(); //LR 2731 mDateNavigator->updateView(); //LR
2732 //mDialogManager->updateSearchDialog(); 2732 //mDialogManager->updateSearchDialog();
2733 2733
2734 if (which) { 2734 if (which) {
2735 mViewManager->updateWNview(); 2735 mViewManager->updateWNview();
2736 //mTodoList->updateView(); 2736 //mTodoList->updateView();
2737 } 2737 }
2738 2738
2739} 2739}
2740 2740
2741void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2741void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2742{ 2742{
2743 updateUnmanagedViews(); 2743 updateUnmanagedViews();
2744 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2744 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2745 if ( action == KOGlobals::EVENTDELETED ) { //delete 2745 if ( action == KOGlobals::EVENTDELETED ) { //delete
2746 mCalendar->checkAlarmForIncidence( 0, true ); 2746 mCalendar->checkAlarmForIncidence( 0, true );
2747 if ( mEventViewerDialog ) 2747 if ( mEventViewerDialog )
2748 mEventViewerDialog->hide(); 2748 mEventViewerDialog->hide();
2749 } 2749 }
2750 else 2750 else
2751 mCalendar->checkAlarmForIncidence( which , false ); 2751 mCalendar->checkAlarmForIncidence( which , false );
2752} 2752}
2753 2753
2754// most of the changeEventDisplays() right now just call the view's 2754// most of the changeEventDisplays() right now just call the view's
2755// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2755// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2756void CalendarView::changeEventDisplay(Event *which, int action) 2756void CalendarView::changeEventDisplay(Event *which, int action)
2757{ 2757{
2758 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2758 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2759 changeIncidenceDisplay((Incidence *)which, action); 2759 changeIncidenceDisplay((Incidence *)which, action);
2760 static bool clearallviews = false; 2760 static bool clearallviews = false;
2761 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { 2761 if ( KOPrefs::instance()->mGlobalUpdateDisabled ) {
2762 if ( clearallviews ) { 2762 if ( clearallviews ) {
2763 clearAllViews(); 2763 clearAllViews();
2764 clearallviews = false; 2764 clearallviews = false;
2765 } 2765 }
2766 return; 2766 return;
2767 } 2767 }
2768 clearallviews = true; 2768 clearallviews = true;
2769 mDateNavigator->updateView(); 2769 mDateNavigator->updateView();
2770 //mDialogManager->updateSearchDialog(); 2770 //mDialogManager->updateSearchDialog();
2771 if (which) { 2771 if (which) {
2772 // If there is an event view visible update the display 2772 // If there is an event view visible update the display
2773 mViewManager->currentView()->changeEventDisplay(which,action); 2773 mViewManager->currentView()->changeEventDisplay(which,action);
2774 // TODO: check, if update needed 2774 // TODO: check, if update needed
2775 // if (which->getTodoStatus()) { 2775 // if (which->getTodoStatus()) {
2776 mTodoList->updateView(); 2776 mTodoList->updateView();
2777 if ( action != KOGlobals::EVENTDELETED ) { 2777 if ( action != KOGlobals::EVENTDELETED ) {
2778 mConflictingEvent = which ; 2778 mConflictingEvent = which ;
2779 QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); 2779 int time = 1000;
2780#ifdef DESKTOP_VERSION
2781 time = 500;
2782#endif
2783 QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) );
2780 } 2784 }
2781 // } 2785 // }
2782 } else { 2786 } else {
2783 mViewManager->currentView()->updateView(); 2787 mViewManager->currentView()->updateView();
2784 } 2788 }
2785} 2789}
2786void CalendarView::checkConflictForEvent() 2790void CalendarView::checkConflictForEvent()
2787{ 2791{
2788 2792
2789 if (!KOPrefs::instance()->mConfirm) 2793 if (!KOPrefs::instance()->mConfirm)
2790 return; 2794 return;
2791 if ( ! mConflictingEvent ) return; 2795 if ( ! mConflictingEvent ) return;
2792 QDateTime current = QDateTime::currentDateTime(); 2796 QDateTime current = QDateTime::currentDateTime();
2793 if ( ! mConflictingEvent->matchTime( &current, 0 ) ) { 2797 if ( ! mConflictingEvent->matchTime( &current, 0 ) ) {
2794 mConflictingEvent = 0; 2798 mConflictingEvent = 0;
2795 return; 2799 return;
2796 } 2800 }
2797 QPtrList<Event> testlist = mCalendar->events(); 2801 QPtrList<Event> testlist = mCalendar->events();
2798 Event * test = testlist.first(); 2802 Event * test = testlist.first();
2799 QDateTime conflict; 2803 QDateTime conflict;
2800 QDateTime retVal; 2804 QDateTime retVal;
2801 bool found = false; 2805 bool found = false;
2802 Event * cE = 0; 2806 Event * cE = 0;
2803 topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); 2807 topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") );
2804 while ( test ) { 2808 while ( test ) {
2805 qApp->processEvents(); 2809 qApp->processEvents();
2806 bool skip = false; 2810 bool skip = false;
2807 if ( found ) 2811 if ( found )
2808 skip = !test->matchTime( &current, &conflict ); 2812 skip = !test->matchTime( &current, &conflict );
2809 else 2813 else
2810 skip = !test->matchTime( &current, 0 ); 2814 skip = !test->matchTime( &current, 0 );
2811 if ( !skip && !test->doesFloat() ) { 2815 if ( !skip && !test->doesFloat() ) {
2812 if ( mConflictingEvent->isOverlapping ( test, &retVal, &current ) ) { 2816 if ( mConflictingEvent->isOverlapping ( test, &retVal, &current ) ) {
2813 if ( ! found ) { 2817 if ( ! found ) {
2814 conflict = retVal; 2818 conflict = retVal;
2815 cE = test; 2819 cE = test;
2816 } else { 2820 } else {
2817 if ( retVal < conflict ) { 2821 if ( retVal < conflict ) {
2818 conflict = retVal; 2822 conflict = retVal;
2819 cE = test; 2823 cE = test;
2820 } 2824 }
2821 } 2825 }
2822 found = true; 2826 found = true;
2823 } 2827 }
2824 } 2828 }
2825 test = testlist.next(); 2829 test = testlist.next();
2826 } 2830 }
2827 if ( found ) { 2831 if ( found ) {
2828 QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; 2832 QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ;
2829 qApp->processEvents(); 2833 qApp->processEvents();
2830 int km = KMessageBox::warningContinueCancel(this,mess, 2834 int km = KMessageBox::warningContinueCancel(this,mess,
2831 i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); 2835 i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!"));
2832 if ( km != KMessageBox::Continue ) 2836 if ( km != KMessageBox::Continue )
2833 return; 2837 return;
2834 2838
2835 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 2839 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
2836 mViewManager->showDayView(); 2840 mViewManager->showDayView();
2837 mNavigator->slotDaySelect( conflict.date() ); 2841 mNavigator->slotDaySelect( conflict.date() );
2838 int hour = conflict.time().hour(); 2842 int hour = conflict.time().hour();
2839 mViewManager->agendaView()->setStartHour( hour ); 2843 mViewManager->agendaView()->setStartHour( hour );
2840 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); 2844 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) );
2841 } else 2845 } else
2842 topLevelWidget()->setCaption( i18n("No conflict found") ); 2846 topLevelWidget()->setCaption( i18n("No conflict found") );
2843 mConflictingEvent = 0; 2847 mConflictingEvent = 0;