-rw-r--r-- | korganizer/calendarview.cpp | 45 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 8 | ||||
-rw-r--r-- | korganizer/koprefs.h | 9 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 52 | ||||
-rw-r--r-- | korganizer/koprefsdialog.h | 2 |
5 files changed, 113 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 | |||
@@ -3036,6 +3036,15 @@ void CalendarView::changeEventDisplay(Event *which, int action) | |||
3036 | #ifdef DESKTOP_VERSION | 3036 | #ifdef DESKTOP_VERSION |
3037 | time = 500; | 3037 | time = 500; |
3038 | #endif | 3038 | #endif |
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 ) | ||
3039 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); | 3048 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); |
3040 | } | 3049 | } |
3041 | // } | 3050 | // } |
@@ -3055,21 +3064,49 @@ void CalendarView::checkConflictForEvent() | |||
3055 | if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { | 3064 | if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { |
3056 | return; | 3065 | return; |
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(); |
3059 | Event * test = testlist.first(); | 3083 | Event * test = testlist.first(); |
3060 | QDateTime conflict; | 3084 | QDateTime conflict; |
3061 | QDateTime retVal; | 3085 | QDateTime retVal; |
3062 | bool found = false; | 3086 | bool found = false; |
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") ); |
3065 | while ( test ) { | 3095 | while ( test ) { |
3066 | qApp->processEvents(); | 3096 | qApp->processEvents(); |
3067 | bool skip = false; | 3097 | bool skip = ( test->doesFloat() && !chAD ) || ( !test->doesFloat() && !chNad ); |
3098 | if ( !skip ) { | ||
3099 | if ( filterALL ) { | ||
3100 | if ( !filterALL->filterCalendarItem( test ) ) { | ||
3101 | skip = true; | ||
3102 | } | ||
3103 | } | ||
3104 | if ( !skip ) { | ||
3068 | if ( found ) | 3105 | if ( found ) |
3069 | skip = !test->matchTime( ¤t, &conflict ); | 3106 | skip = !test->matchTime( ¤t, &conflict ); |
3070 | else | 3107 | else |
3071 | skip = !test->matchTime( ¤t, 0 ); | 3108 | skip = !test->matchTime( ¤t, 0 ); |
3072 | if ( !skip && !test->doesFloat() ) { | 3109 | if ( !skip ) { |
3073 | if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { | 3110 | if ( conflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { |
3074 | if ( ! found ) { | 3111 | if ( ! found ) { |
3075 | conflict = retVal; | 3112 | conflict = retVal; |
@@ -3083,6 +3120,8 @@ void CalendarView::checkConflictForEvent() | |||
3083 | found = true; | 3120 | found = true; |
3084 | } | 3121 | } |
3085 | } | 3122 | } |
3123 | } | ||
3124 | } | ||
3086 | test = testlist.next(); | 3125 | test = testlist.next(); |
3087 | } | 3126 | } |
3088 | topLevelWidget()->setCaption( i18n("KO/Pi") ); | 3127 | topLevelWidget()->setCaption( i18n("KO/Pi") ); |
@@ -3090,7 +3129,7 @@ void CalendarView::checkConflictForEvent() | |||
3090 | 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()) ) ; | 3129 | 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()) ) ; |
3091 | qApp->processEvents(); | 3130 | qApp->processEvents(); |
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 ) { |
3095 | return; | 3134 | return; |
3096 | } | 3135 | } |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 77f572c..571ca11 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -230,6 +230,14 @@ KOPrefs::KOPrefs() : | |||
230 | addItemBool("UseAppColors",&mUseAppColors,false); | 230 | addItemBool("UseAppColors",&mUseAppColors,false); |
231 | 231 | ||
232 | 232 | ||
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" ); | ||
233 | 241 | ||
234 | KPrefs::setCurrentGroup("Views"); | 242 | KPrefs::setCurrentGroup("Views"); |
235 | addItemBool("Block Popup Menu",&mBlockPopupMenu,false); | 243 | addItemBool("Block Popup Menu",&mBlockPopupMenu,false); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 9749ba3..576edf9 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -349,6 +349,15 @@ class KOPrefs : public KPimPrefs | |||
349 | int mNextAvailableCalendar; | 349 | int mNextAvailableCalendar; |
350 | bool mGlobalUpdateDisabled; | 350 | bool mGlobalUpdateDisabled; |
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: |
353 | QDict<QColor> mCategoryColors; | 362 | QDict<QColor> mCategoryColors; |
354 | QArray<KopiCalendarFile*> mDefCalColors; | 363 | QArray<KopiCalendarFile*> mDefCalColors; |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index 9e2378a..bbdf508 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -922,6 +922,41 @@ dummy = | |||
922 | &(KOPrefs::instance()->mWTshowChanged),topFrame); | 922 | &(KOPrefs::instance()->mWTshowChanged),topFrame); |
923 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 923 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
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 | ||
926 | topFrame = addPage(i18n("Alarm"),0,0); | 961 | topFrame = addPage(i18n("Alarm"),0,0); |
927 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 962 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
@@ -1435,6 +1470,20 @@ void KOPrefsDialog::usrReadConfig() | |||
1435 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); | 1470 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); |
1436 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); | 1471 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); |
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 | } |
1439 | 1488 | ||
1440 | 1489 | ||
@@ -1479,6 +1528,9 @@ void KOPrefsDialog::usrWriteConfig() | |||
1479 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; | 1528 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; |
1480 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; | 1529 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; |
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 | } |
1483 | 1535 | ||
1484 | void KOPrefsDialog::updateCategories() | 1536 | void KOPrefsDialog::updateCategories() |
diff --git a/korganizer/koprefsdialog.h b/korganizer/koprefsdialog.h index baa6cf9..ee7a7aa 100644 --- a/korganizer/koprefsdialog.h +++ b/korganizer/koprefsdialog.h | |||
@@ -147,6 +147,8 @@ class KOPrefsDialog : public KPrefsDialog | |||
147 | QSpinBox * mAlarmSuspendCount; | 147 | QSpinBox * mAlarmSuspendCount; |
148 | QSpinBox * mAlarmBeepInterval; | 148 | QSpinBox * mAlarmBeepInterval; |
149 | 149 | ||
150 | QComboBox * mFilterEditItem, *mFilterAllItem; | ||
151 | |||
150 | QLineEdit * mDefaultAlarmFile; | 152 | QLineEdit * mDefaultAlarmFile; |
151 | int mSpacingHint; | 153 | int mSpacingHint; |
152 | int mMarginHint; | 154 | int mMarginHint; |