summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
authorzautrix <zautrix>2005-08-17 22:44:12 (UTC)
committer zautrix <zautrix>2005-08-17 22:44:12 (UTC)
commitbd0f0feb2e1af8a346dc724c81f31214c52128e4 (patch) (side-by-side diff)
tree7234e97f485901026e37a2deab734e9d431002f2 /korganizer/calendarview.cpp
parent671857b232224314ad7720ad4bc037758a90fa4b (diff)
downloadkdepimpi-bd0f0feb2e1af8a346dc724c81f31214c52128e4.zip
kdepimpi-bd0f0feb2e1af8a346dc724c81f31214c52128e4.tar.gz
kdepimpi-bd0f0feb2e1af8a346dc724c81f31214c52128e4.tar.bz2
conflict settings
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp73
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
@@ -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( &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;
- if ( found )
- skip = !test->matchTime( &current, &conflict );
- else
- skip = !test->matchTime( &current, 0 );
- if ( !skip && !test->doesFloat() ) {
- if ( conflictingEvent->isOverlapping ( test, &retVal, &current ) ) {
- 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( &current, &conflict );
+ else
+ skip = !test->matchTime( &current, 0 );
+ if ( !skip ) {
+ if ( conflictingEvent->isOverlapping ( test, &retVal, &current ) ) {
+ 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;
}