From bd0f0feb2e1af8a346dc724c81f31214c52128e4 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 17 Aug 2005 22:44:12 +0000 Subject: conflict settings --- (limited to 'korganizer/calendarview.cpp') diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 26323b1..898da6c 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -3036,7 +3036,16 @@ void CalendarView::changeEventDisplay(Event *which, int action) #ifdef DESKTOP_VERSION time = 500; #endif - QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); + bool checkC = false; + if ( mConflictingEvent->doesFloat() ) { + checkC = KOPrefs::instance()->mCheckConflictsAllDayAllDay + || KOPrefs::instance()->mCheckConflictsAllDayNonAD; + } else { + checkC = KOPrefs::instance()->mCheckConflictsNonADAllDay + || KOPrefs::instance()->mCheckConflictsNonADNonAD; + } + if ( checkC ) + QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); } // } } else { @@ -3055,32 +3064,62 @@ void CalendarView::checkConflictForEvent() if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { return; } + CalFilter *filterIN = 0; + CalFilter *filterALL = 0; + CalFilter *filter = mFilters.first(); + while(filter) { + if ( filter->name() == KOPrefs::instance()->mFilterConflictEditItem) + filterIN = filter; + if ( filter->name() == KOPrefs::instance()->mFilterConflictAllItem ) + filterALL = filter; + filter = mFilters.next(); + } + if ( filterIN ) { + if ( !filterIN->filterCalendarItem( conflictingEvent ) ) { + return; + } + } QPtrList testlist = mCalendar->events(); Event * test = testlist.first(); QDateTime conflict; QDateTime retVal; bool found = false; Event * cE = 0; + bool chAD = KOPrefs::instance()->mCheckConflictsAllDayAllDay; + bool chNad = KOPrefs::instance()->mCheckConflictsAllDayNonAD; + if ( !conflictingEvent->doesFloat() ) { + chAD = KOPrefs::instance()->mCheckConflictsNonADAllDay; + chNad = KOPrefs::instance()->mCheckConflictsNonADNonAD; + } topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); while ( test ) { qApp->processEvents(); - bool skip = false; - if ( found ) - skip = !test->matchTime( ¤t, &conflict ); - else - skip = !test->matchTime( ¤t, 0 ); - if ( !skip && !test->doesFloat() ) { - if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { - if ( ! found ) { - conflict = retVal; - cE = test; - } else { - if ( retVal < conflict ) { - conflict = retVal; - cE = test; + bool skip = ( test->doesFloat() && !chAD ) || ( !test->doesFloat() && !chNad ); + if ( !skip ) { + if ( filterALL ) { + if ( !filterALL->filterCalendarItem( test ) ) { + skip = true; + } + } + if ( !skip ) { + if ( found ) + skip = !test->matchTime( ¤t, &conflict ); + else + skip = !test->matchTime( ¤t, 0 ); + if ( !skip ) { + if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { + if ( ! found ) { + conflict = retVal; + cE = test; + } else { + if ( retVal < conflict ) { + conflict = retVal; + cE = test; + } + } + found = true; } } - found = true; } } test = testlist.next(); @@ -3090,7 +3129,7 @@ void CalendarView::checkConflictForEvent() 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()) ) ; qApp->processEvents(); int km = KMessageBox::warningContinueCancel(this,mess, - i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); + i18n("KO/Pi Conflict detected"),i18n("Show date"),i18n("No problem!")); if ( km != KMessageBox::Continue ) { return; } -- cgit v0.9.0.2