author | zautrix <zautrix> | 2005-08-17 22:44:12 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-17 22:44:12 (UTC) |
commit | bd0f0feb2e1af8a346dc724c81f31214c52128e4 (patch) (side-by-side diff) | |
tree | 7234e97f485901026e37a2deab734e9d431002f2 /korganizer/calendarview.cpp | |
parent | 671857b232224314ad7720ad4bc037758a90fa4b (diff) | |
download | kdepimpi-bd0f0feb2e1af8a346dc724c81f31214c52128e4.zip kdepimpi-bd0f0feb2e1af8a346dc724c81f31214c52128e4.tar.gz kdepimpi-bd0f0feb2e1af8a346dc724c81f31214c52128e4.tar.bz2 |
conflict settings
-rw-r--r-- | korganizer/calendarview.cpp | 73 |
1 files changed, 56 insertions, 17 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 26323b1..898da6c 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -3027,79 +3027,118 @@ void CalendarView::changeEventDisplay(Event *which, int action) if (which) { // If there is an event view visible update the display mViewManager->currentView()->changeEventDisplay(which,action); // TODO: check, if update needed // if (which->getTodoStatus()) { mTodoList->updateView(); if ( action != KOGlobals::EVENTDELETED ) { mConflictingEvent = which ; int time = 1000; #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 { mViewManager->currentView()->updateView(); } } void CalendarView::checkConflictForEvent() { if (!KOPrefs::instance()->mConfirm) return; if ( ! mConflictingEvent ) return; Event * conflictingEvent = mConflictingEvent; mConflictingEvent = 0; QDateTime current = QDateTime::currentDateTime(); 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<Event> 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(); } topLevelWidget()->setCaption( i18n("KO/Pi") ); if ( found ) { 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; } if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) mViewManager->showDayView(); mNavigator->slotDaySelect( conflict.date() ); int hour = conflict.time().hour(); mViewManager->agendaView()->setStartHour( hour ); topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); } else topLevelWidget()->setCaption( i18n("No conflict found") ); return; |