-rw-r--r-- | korganizer/calendarview.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 9928b48..14094bb 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2999,147 +2999,154 @@ void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | |||
2999 | updateUnmanagedViews(); | 2999 | updateUnmanagedViews(); |
3000 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 3000 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
3001 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 3001 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
3002 | mCalendar->checkAlarmForIncidence( 0, true ); | 3002 | mCalendar->checkAlarmForIncidence( 0, true ); |
3003 | if ( mEventViewerDialog ) | 3003 | if ( mEventViewerDialog ) |
3004 | mEventViewerDialog->hide(); | 3004 | mEventViewerDialog->hide(); |
3005 | } | 3005 | } |
3006 | else | 3006 | else |
3007 | mCalendar->checkAlarmForIncidence( which , false ); | 3007 | mCalendar->checkAlarmForIncidence( which , false ); |
3008 | } | 3008 | } |
3009 | 3009 | ||
3010 | // most of the changeEventDisplays() right now just call the view's | 3010 | // most of the changeEventDisplays() right now just call the view's |
3011 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 3011 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
3012 | void CalendarView::changeEventDisplay(Event *which, int action) | 3012 | void CalendarView::changeEventDisplay(Event *which, int action) |
3013 | { | 3013 | { |
3014 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 3014 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
3015 | changeIncidenceDisplay((Incidence *)which, action); | 3015 | changeIncidenceDisplay((Incidence *)which, action); |
3016 | static bool clearallviews = false; | 3016 | static bool clearallviews = false; |
3017 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 3017 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
3018 | if ( clearallviews ) { | 3018 | if ( clearallviews ) { |
3019 | clearAllViews(); | 3019 | clearAllViews(); |
3020 | clearallviews = false; | 3020 | clearallviews = false; |
3021 | } | 3021 | } |
3022 | return; | 3022 | return; |
3023 | } | 3023 | } |
3024 | clearallviews = true; | 3024 | clearallviews = true; |
3025 | mDateNavigator->updateView(); | 3025 | mDateNavigator->updateView(); |
3026 | //mDialogManager->updateSearchDialog(); | 3026 | //mDialogManager->updateSearchDialog(); |
3027 | if (which) { | 3027 | if (which) { |
3028 | // If there is an event view visible update the display | 3028 | // If there is an event view visible update the display |
3029 | mViewManager->currentView()->changeEventDisplay(which,action); | 3029 | mViewManager->currentView()->changeEventDisplay(which,action); |
3030 | // TODO: check, if update needed | 3030 | // TODO: check, if update needed |
3031 | // if (which->getTodoStatus()) { | 3031 | // if (which->getTodoStatus()) { |
3032 | mTodoList->updateView(); | 3032 | mTodoList->updateView(); |
3033 | if ( action != KOGlobals::EVENTDELETED && KOPrefs::instance()->mDetectConflicts ) { | 3033 | if ( action != KOGlobals::EVENTDELETED && KOPrefs::instance()->mDetectConflicts ) { |
3034 | mConflictingEvent = which ; | 3034 | mConflictingEvent = which ; |
3035 | int time = 1000; | 3035 | int time = 1000; |
3036 | #ifdef DESKTOP_VERSION | 3036 | #ifdef DESKTOP_VERSION |
3037 | time = 500; | 3037 | time = 500; |
3038 | #endif | 3038 | #endif |
3039 | bool checkC = false; | 3039 | bool checkC = false; |
3040 | if ( mConflictingEvent->doesFloat() ) { | 3040 | if ( mConflictingEvent->doesFloat() ) { |
3041 | checkC = KOPrefs::instance()->mCheckConflictsAllDayAllDay | 3041 | checkC = KOPrefs::instance()->mCheckConflictsAllDayAllDay |
3042 | || KOPrefs::instance()->mCheckConflictsAllDayNonAD; | 3042 | || KOPrefs::instance()->mCheckConflictsAllDayNonAD; |
3043 | } else { | 3043 | } else { |
3044 | checkC = KOPrefs::instance()->mCheckConflictsNonADAllDay | 3044 | checkC = KOPrefs::instance()->mCheckConflictsNonADAllDay |
3045 | || KOPrefs::instance()->mCheckConflictsNonADNonAD; | 3045 | || KOPrefs::instance()->mCheckConflictsNonADNonAD; |
3046 | } | 3046 | } |
3047 | if ( !KOPrefs::instance()->mIncludeFree && mConflictingEvent->transparency() == KCal::Event::Transparent ) | ||
3048 | checkC = false; | ||
3047 | if ( checkC ) | 3049 | if ( checkC ) |
3048 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); | 3050 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); |
3049 | } | 3051 | } |
3050 | // } | 3052 | // } |
3051 | } else { | 3053 | } else { |
3052 | mViewManager->currentView()->updateView(); | 3054 | mViewManager->currentView()->updateView(); |
3053 | } | 3055 | } |
3054 | } | 3056 | } |
3055 | void CalendarView::checkConflictForEvent() | 3057 | void CalendarView::checkConflictForEvent() |
3056 | { | 3058 | { |
3057 | 3059 | ||
3058 | if (!KOPrefs::instance()->mConfirm) | 3060 | if (!KOPrefs::instance()->mConfirm) |
3059 | return; | 3061 | return; |
3060 | if ( ! mConflictingEvent ) return; | 3062 | if ( ! mConflictingEvent ) return; |
3061 | Event * conflictingEvent = mConflictingEvent; | 3063 | Event * conflictingEvent = mConflictingEvent; |
3062 | mConflictingEvent = 0; | 3064 | mConflictingEvent = 0; |
3063 | QDateTime current = QDateTime::currentDateTime(); | 3065 | QDateTime current = QDateTime::currentDateTime(); |
3064 | if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { | 3066 | if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { |
3065 | return; | 3067 | return; |
3066 | } | 3068 | } |
3067 | CalFilter *filterIN = 0; | 3069 | CalFilter *filterIN = 0; |
3068 | CalFilter *filterALL = 0; | 3070 | CalFilter *filterALL = 0; |
3069 | CalFilter *filter = mFilters.first(); | 3071 | CalFilter *filter = mFilters.first(); |
3070 | while(filter) { | 3072 | while(filter) { |
3071 | if ( filter->name() == KOPrefs::instance()->mFilterConflictEditItem) | 3073 | if ( filter->name() == KOPrefs::instance()->mFilterConflictEditItem) |
3072 | filterIN = filter; | 3074 | filterIN = filter; |
3073 | if ( filter->name() == KOPrefs::instance()->mFilterConflictAllItem ) | 3075 | if ( filter->name() == KOPrefs::instance()->mFilterConflictAllItem ) |
3074 | filterALL = filter; | 3076 | filterALL = filter; |
3075 | filter = mFilters.next(); | 3077 | filter = mFilters.next(); |
3076 | } | 3078 | } |
3077 | if ( filterIN ) { | 3079 | if ( filterIN ) { |
3078 | if ( !filterIN->filterCalendarItem( conflictingEvent ) ) { | 3080 | if ( !filterIN->filterCalendarItem( conflictingEvent ) ) { |
3079 | return; | 3081 | return; |
3080 | } | 3082 | } |
3081 | } | 3083 | } |
3082 | QPtrList<Event> testlist = mCalendar->events(); | 3084 | QPtrList<Event> testlist = mCalendar->events(); |
3083 | Event * test = testlist.first(); | 3085 | Event * test = testlist.first(); |
3084 | QDateTime conflict; | 3086 | QDateTime conflict; |
3085 | QDateTime retVal; | 3087 | QDateTime retVal; |
3086 | bool found = false; | 3088 | bool found = false; |
3087 | Event * cE = 0; | 3089 | Event * cE = 0; |
3088 | bool chAD = KOPrefs::instance()->mCheckConflictsAllDayAllDay; | 3090 | bool chAD = KOPrefs::instance()->mCheckConflictsAllDayAllDay; |
3089 | bool chNad = KOPrefs::instance()->mCheckConflictsAllDayNonAD; | 3091 | bool chNad = KOPrefs::instance()->mCheckConflictsAllDayNonAD; |
3090 | if ( !conflictingEvent->doesFloat() ) { | 3092 | if ( !conflictingEvent->doesFloat() ) { |
3091 | chAD = KOPrefs::instance()->mCheckConflictsNonADAllDay; | 3093 | chAD = KOPrefs::instance()->mCheckConflictsNonADAllDay; |
3092 | chNad = KOPrefs::instance()->mCheckConflictsNonADNonAD; | 3094 | chNad = KOPrefs::instance()->mCheckConflictsNonADNonAD; |
3093 | } | 3095 | } |
3094 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 3096 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
3095 | while ( test ) { | 3097 | while ( test ) { |
3096 | qApp->processEvents(); | 3098 | qApp->processEvents(); |
3097 | bool skip = ( test->doesFloat() && !chAD ) || ( !test->doesFloat() && !chNad ); | 3099 | bool skip = ( test->doesFloat() && !chAD ) || ( !test->doesFloat() && !chNad ); |
3100 | |||
3101 | if ( !skip ) { | ||
3102 | if ( !KOPrefs::instance()->mIncludeFree && test->transparency() == KCal::Event::Transparent ) | ||
3103 | skip = true; | ||
3104 | } | ||
3098 | if ( !skip ) { | 3105 | if ( !skip ) { |
3099 | if ( filterALL ) { | 3106 | if ( filterALL ) { |
3100 | if ( !filterALL->filterCalendarItem( test ) ) { | 3107 | if ( !filterALL->filterCalendarItem( test ) ) { |
3101 | skip = true; | 3108 | skip = true; |
3102 | } | 3109 | } |
3103 | } | 3110 | } |
3104 | if ( !skip ) { | 3111 | if ( !skip ) { |
3105 | if ( found ) | 3112 | if ( found ) |
3106 | skip = !test->matchTime( ¤t, &conflict ); | 3113 | skip = !test->matchTime( ¤t, &conflict ); |
3107 | else | 3114 | else |
3108 | skip = !test->matchTime( ¤t, 0 ); | 3115 | skip = !test->matchTime( ¤t, 0 ); |
3109 | if ( !skip ) { | 3116 | if ( !skip ) { |
3110 | if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { | 3117 | if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { |
3111 | if ( ! found ) { | 3118 | if ( ! found ) { |
3112 | conflict = retVal; | 3119 | conflict = retVal; |
3113 | cE = test; | 3120 | cE = test; |
3114 | } else { | 3121 | } else { |
3115 | if ( retVal < conflict ) { | 3122 | if ( retVal < conflict ) { |
3116 | conflict = retVal; | 3123 | conflict = retVal; |
3117 | cE = test; | 3124 | cE = test; |
3118 | } | 3125 | } |
3119 | } | 3126 | } |
3120 | found = true; | 3127 | found = true; |
3121 | } | 3128 | } |
3122 | } | 3129 | } |
3123 | } | 3130 | } |
3124 | } | 3131 | } |
3125 | test = testlist.next(); | 3132 | test = testlist.next(); |
3126 | } | 3133 | } |
3127 | topLevelWidget()->setCaption( i18n("KO/Pi") ); | 3134 | topLevelWidget()->setCaption( i18n("KO/Pi") ); |
3128 | if ( found ) { | 3135 | if ( found ) { |
3129 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( conflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; | 3136 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( conflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; |
3130 | qApp->processEvents(); | 3137 | qApp->processEvents(); |
3131 | int km = KMessageBox::warningContinueCancel(this,mess, | 3138 | int km = KMessageBox::warningContinueCancel(this,mess, |
3132 | i18n("KO/Pi Conflict detected"),i18n("Show date"),i18n("No problem!")); | 3139 | i18n("KO/Pi Conflict detected"),i18n("Show date"),i18n("No problem!")); |
3133 | if ( km != KMessageBox::Continue ) { | 3140 | if ( km != KMessageBox::Continue ) { |
3134 | return; | 3141 | return; |
3135 | } | 3142 | } |
3136 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 3143 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
3137 | mViewManager->showDayView(); | 3144 | mViewManager->showDayView(); |
3138 | mNavigator->slotDaySelect( conflict.date() ); | 3145 | mNavigator->slotDaySelect( conflict.date() ); |
3139 | int hour = conflict.time().hour(); | 3146 | int hour = conflict.time().hour(); |
3140 | mViewManager->agendaView()->setStartHour( hour ); | 3147 | mViewManager->agendaView()->setStartHour( hour ); |
3141 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); | 3148 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); |
3142 | } else | 3149 | } else |
3143 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 3150 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
3144 | return; | 3151 | return; |
3145 | 3152 | ||