-rw-r--r-- | korganizer/calendarview.cpp | 73 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 10 | ||||
-rw-r--r-- | korganizer/koprefs.h | 9 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 52 | ||||
-rw-r--r-- | korganizer/koprefsdialog.h | 2 |
5 files changed, 128 insertions, 18 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 26323b1..898da6c 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3038,3 +3038,12 @@ void CalendarView::changeEventDisplay(Event *which, int action) | |||
3038 | #endif | 3038 | #endif |
3039 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); | 3039 | bool checkC = false; |
3040 | if ( mConflictingEvent->doesFloat() ) { | ||
3041 | checkC = KOPrefs::instance()->mCheckConflictsAllDayAllDay | ||
3042 | || KOPrefs::instance()->mCheckConflictsAllDayNonAD; | ||
3043 | } else { | ||
3044 | checkC = KOPrefs::instance()->mCheckConflictsNonADAllDay | ||
3045 | || KOPrefs::instance()->mCheckConflictsNonADNonAD; | ||
3046 | } | ||
3047 | if ( checkC ) | ||
3048 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); | ||
3040 | } | 3049 | } |
@@ -3057,2 +3066,17 @@ void CalendarView::checkConflictForEvent() | |||
3057 | } | 3066 | } |
3067 | CalFilter *filterIN = 0; | ||
3068 | CalFilter *filterALL = 0; | ||
3069 | CalFilter *filter = mFilters.first(); | ||
3070 | while(filter) { | ||
3071 | if ( filter->name() == KOPrefs::instance()->mFilterConflictEditItem) | ||
3072 | filterIN = filter; | ||
3073 | if ( filter->name() == KOPrefs::instance()->mFilterConflictAllItem ) | ||
3074 | filterALL = filter; | ||
3075 | filter = mFilters.next(); | ||
3076 | } | ||
3077 | if ( filterIN ) { | ||
3078 | if ( !filterIN->filterCalendarItem( conflictingEvent ) ) { | ||
3079 | return; | ||
3080 | } | ||
3081 | } | ||
3058 | QPtrList<Event> testlist = mCalendar->events(); | 3082 | QPtrList<Event> testlist = mCalendar->events(); |
@@ -3063,2 +3087,8 @@ void CalendarView::checkConflictForEvent() | |||
3063 | Event * cE = 0; | 3087 | Event * cE = 0; |
3088 | bool chAD = KOPrefs::instance()->mCheckConflictsAllDayAllDay; | ||
3089 | bool chNad = KOPrefs::instance()->mCheckConflictsAllDayNonAD; | ||
3090 | if ( !conflictingEvent->doesFloat() ) { | ||
3091 | chAD = KOPrefs::instance()->mCheckConflictsNonADAllDay; | ||
3092 | chNad = KOPrefs::instance()->mCheckConflictsNonADNonAD; | ||
3093 | } | ||
3064 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 3094 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
@@ -3066,19 +3096,28 @@ void CalendarView::checkConflictForEvent() | |||
3066 | qApp->processEvents(); | 3096 | qApp->processEvents(); |
3067 | bool skip = false; | 3097 | bool skip = ( test->doesFloat() && !chAD ) || ( !test->doesFloat() && !chNad ); |
3068 | if ( found ) | 3098 | if ( !skip ) { |
3069 | skip = !test->matchTime( ¤t, &conflict ); | 3099 | if ( filterALL ) { |
3070 | else | 3100 | if ( !filterALL->filterCalendarItem( test ) ) { |
3071 | skip = !test->matchTime( ¤t, 0 ); | 3101 | skip = true; |
3072 | if ( !skip && !test->doesFloat() ) { | 3102 | } |
3073 | if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { | 3103 | } |
3074 | if ( ! found ) { | 3104 | if ( !skip ) { |
3075 | conflict = retVal; | 3105 | if ( found ) |
3076 | cE = test; | 3106 | skip = !test->matchTime( ¤t, &conflict ); |
3077 | } else { | 3107 | else |
3078 | if ( retVal < conflict ) { | 3108 | skip = !test->matchTime( ¤t, 0 ); |
3079 | conflict = retVal; | 3109 | if ( !skip ) { |
3080 | cE = test; | 3110 | if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { |
3111 | if ( ! found ) { | ||
3112 | conflict = retVal; | ||
3113 | cE = test; | ||
3114 | } else { | ||
3115 | if ( retVal < conflict ) { | ||
3116 | conflict = retVal; | ||
3117 | cE = test; | ||
3118 | } | ||
3119 | } | ||
3120 | found = true; | ||
3081 | } | 3121 | } |
3082 | } | 3122 | } |
3083 | found = true; | ||
3084 | } | 3123 | } |
@@ -3092,3 +3131,3 @@ void CalendarView::checkConflictForEvent() | |||
3092 | int km = KMessageBox::warningContinueCancel(this,mess, | 3131 | int km = KMessageBox::warningContinueCancel(this,mess, |
3093 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); | 3132 | i18n("KO/Pi Conflict detected"),i18n("Show date"),i18n("No problem!")); |
3094 | if ( km != KMessageBox::Continue ) { | 3133 | if ( km != KMessageBox::Continue ) { |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 77f572c..571ca11 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -232,3 +232,11 @@ KOPrefs::KOPrefs() : | |||
232 | 232 | ||
233 | 233 | KPrefs::setCurrentGroup("Conflicts"); | |
234 | addItemBool("EnableAutoDetect",&mDetectConflicts,true); | ||
235 | addItemBool("CheckConflictsAllDayAllDay",&mCheckConflictsAllDayAllDay,false); | ||
236 | addItemBool("CheckConflictsAllDayNonAD",&mCheckConflictsAllDayNonAD,false); | ||
237 | addItemBool("CheckConflictsNonADAllDay",&mCheckConflictsNonADAllDay,false); | ||
238 | addItemBool("CheckConflictsNonADNonAD",&mCheckConflictsNonADNonAD,true); | ||
239 | addItemString("FilterConflictEditItem", &mFilterConflictEditItem ,"nofilter" ); | ||
240 | addItemString("FilterConflictAllItem", &mFilterConflictAllItem ,"nofilter" ); | ||
241 | |||
234 | KPrefs::setCurrentGroup("Views"); | 242 | KPrefs::setCurrentGroup("Views"); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 9749ba3..576edf9 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -351,2 +351,11 @@ class KOPrefs : public KPimPrefs | |||
351 | 351 | ||
352 | |||
353 | bool mDetectConflicts; | ||
354 | bool mCheckConflictsAllDayAllDay; | ||
355 | bool mCheckConflictsAllDayNonAD; | ||
356 | bool mCheckConflictsNonADAllDay; | ||
357 | bool mCheckConflictsNonADNonAD; | ||
358 | QString mFilterConflictEditItem; | ||
359 | QString mFilterConflictAllItem; | ||
360 | |||
352 | private: | 361 | private: |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index 9e2378a..bbdf508 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -924,2 +924,37 @@ dummy = | |||
924 | 924 | ||
925 | topFrame = addPage(i18n("Conflict detection"),0,0); | ||
926 | |||
927 | topLayout = new QGridLayout(topFrame,2,1); | ||
928 | topLayout->setSpacing(mSpacingHint); | ||
929 | topLayout->setMargin(mMarginHint); | ||
930 | ii = 0; | ||
931 | dummy = addWidBool(i18n("Enable conflict detection"), | ||
932 | &(KOPrefs::instance()->mDetectConflicts),topFrame); | ||
933 | topLayout->addWidget(dummy->checkBox(), ii++,0); | ||
934 | topFrame = new QFrame( topFrame ); | ||
935 | topLayout->addWidget(topFrame ,ii++,0); | ||
936 | topLayout = new QGridLayout(topFrame,4,1); | ||
937 | connect ( dummy->checkBox(), SIGNAL( toggled( bool ) ), topFrame, SLOT ( setEnabled( bool ) ) ); | ||
938 | topLayout->addWidget( new QLabel ( i18n("Conflict detection checks an <b>edited event</b> with other <b>existing events</b> for overlapping. You can define which events are checked:"), topFrame ) , ii++,0); | ||
939 | topLayout->addWidget( new QLabel ( i18n("Filter for the edited event"), topFrame ) , ii++,0); | ||
940 | mFilterEditItem = new QComboBox( topFrame ); | ||
941 | topLayout->addWidget(mFilterEditItem,ii++,0); | ||
942 | topLayout->addWidget( new QLabel ( i18n("Filter for other existing events"), topFrame ) , ii++,0); | ||
943 | mFilterAllItem = new QComboBox( topFrame ); | ||
944 | topLayout->addWidget(mFilterAllItem,ii++,0); | ||
945 | dummy = addWidBool(i18n("Check Allday with Allday"), | ||
946 | &(KOPrefs::instance()->mCheckConflictsAllDayAllDay),topFrame); | ||
947 | topLayout->addWidget(dummy->checkBox(), ii++,0); | ||
948 | dummy = addWidBool(i18n("Check Allday with NonAllday"), | ||
949 | &(KOPrefs::instance()->mCheckConflictsAllDayNonAD),topFrame); | ||
950 | topLayout->addWidget(dummy->checkBox(), ii++,0); | ||
951 | dummy = addWidBool(i18n("Check NonAllday with Allday"), | ||
952 | &(KOPrefs::instance()->mCheckConflictsNonADAllDay),topFrame); | ||
953 | topLayout->addWidget(dummy->checkBox(), ii++,0); | ||
954 | dummy = addWidBool(i18n("Check NonAllday with NonAllday"), | ||
955 | &(KOPrefs::instance()->mCheckConflictsNonADNonAD),topFrame); | ||
956 | topLayout->addWidget(dummy->checkBox(), ii++,0); | ||
957 | |||
958 | |||
959 | |||
925 | 960 | ||
@@ -1437,2 +1472,16 @@ void KOPrefsDialog::usrReadConfig() | |||
1437 | mCatDefaultColor = KOPrefs::instance()->mEventColor; | 1472 | mCatDefaultColor = KOPrefs::instance()->mEventColor; |
1473 | |||
1474 | |||
1475 | KConfig cfgko(locateLocal("config","korganizerrc")); | ||
1476 | cfgko.setGroup("General"); | ||
1477 | QStringList temp = cfgko.readListEntry("CalendarFilters"); | ||
1478 | temp.prepend(i18n("No Filter") ); | ||
1479 | mFilterEditItem->insertStringList( temp ); | ||
1480 | mFilterAllItem->insertStringList( temp ); | ||
1481 | int index = temp.findIndex( KOPrefs::instance()->mFilterConflictEditItem ); | ||
1482 | if ( index >= 0 ) | ||
1483 | mFilterEditItem->setCurrentItem( index ); | ||
1484 | index = temp.findIndex( KOPrefs::instance()->mFilterConflictAllItem ); | ||
1485 | if ( index >= 0 ) | ||
1486 | mFilterAllItem->setCurrentItem( index ); | ||
1438 | } | 1487 | } |
@@ -1481,2 +1530,5 @@ void KOPrefsDialog::usrWriteConfig() | |||
1481 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; | 1530 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; |
1531 | |||
1532 | KOPrefs::instance()->mFilterConflictEditItem = mFilterEditItem->currentText(); | ||
1533 | KOPrefs::instance()->mFilterConflictAllItem = mFilterAllItem->currentText(); | ||
1482 | } | 1534 | } |
diff --git a/korganizer/koprefsdialog.h b/korganizer/koprefsdialog.h index baa6cf9..ee7a7aa 100644 --- a/korganizer/koprefsdialog.h +++ b/korganizer/koprefsdialog.h | |||
@@ -149,2 +149,4 @@ class KOPrefsDialog : public KPrefsDialog | |||
149 | 149 | ||
150 | QComboBox * mFilterEditItem, *mFilterAllItem; | ||
151 | |||
150 | QLineEdit * mDefaultAlarmFile; | 152 | QLineEdit * mDefaultAlarmFile; |