summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp45
1 files changed, 42 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 26323b1..898da6c 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3033,12 +3033,21 @@ void CalendarView::changeEventDisplay(Event *which, int action)
if ( action != KOGlobals::EVENTDELETED ) {
mConflictingEvent = which ;
int time = 1000;
#ifdef DESKTOP_VERSION
time = 500;
#endif
+ 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();
}
@@ -3052,27 +3061,55 @@ void CalendarView::checkConflictForEvent()
Event * conflictingEvent = mConflictingEvent;
mConflictingEvent = 0;
QDateTime current = QDateTime::currentDateTime();
if ( ! conflictingEvent->matchTime( &current, 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;
+ 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( &current, &conflict );
else
skip = !test->matchTime( &current, 0 );
- if ( !skip && !test->doesFloat() ) {
+ if ( !skip ) {
if ( conflictingEvent->isOverlapping ( test, &retVal, &current ) ) {
if ( ! found ) {
conflict = retVal;
cE = test;
} else {
if ( retVal < conflict ) {
@@ -3080,20 +3117,22 @@ void CalendarView::checkConflictForEvent()
cE = test;
}
}
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() );