summaryrefslogtreecommitdiffabout
path: root/korganizer
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
parent671857b232224314ad7720ad4bc037758a90fa4b (diff)
downloadkdepimpi-bd0f0feb2e1af8a346dc724c81f31214c52128e4.zip
kdepimpi-bd0f0feb2e1af8a346dc724c81f31214c52128e4.tar.gz
kdepimpi-bd0f0feb2e1af8a346dc724c81f31214c52128e4.tar.bz2
conflict settings
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp73
-rw-r--r--korganizer/koprefs.cpp10
-rw-r--r--korganizer/koprefs.h9
-rw-r--r--korganizer/koprefsdialog.cpp52
-rw-r--r--korganizer/koprefsdialog.h2
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
@@ -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( &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();
}
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;
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 77f572c..571ca11 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -221,25 +221,33 @@ KOPrefs::KOPrefs() :
addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
addItemBool("MonthViewWeek",&mMonthViewWeek,false);
addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
addItemBool("UseAppColors",&mUseAppColors,false);
-
+ KPrefs::setCurrentGroup("Conflicts");
+ addItemBool("EnableAutoDetect",&mDetectConflicts,true);
+ addItemBool("CheckConflictsAllDayAllDay",&mCheckConflictsAllDayAllDay,false);
+ addItemBool("CheckConflictsAllDayNonAD",&mCheckConflictsAllDayNonAD,false);
+ addItemBool("CheckConflictsNonADAllDay",&mCheckConflictsNonADAllDay,false);
+ addItemBool("CheckConflictsNonADNonAD",&mCheckConflictsNonADNonAD,true);
+ addItemString("FilterConflictEditItem", &mFilterConflictEditItem ,"nofilter" );
+ addItemString("FilterConflictAllItem", &mFilterConflictAllItem ,"nofilter" );
+
KPrefs::setCurrentGroup("Views");
addItemBool("Block Popup Menu",&mBlockPopupMenu,false);
addItemBool("Show Date Navigator",&mShowDateNavigator,true);
addItemInt("Hour Size",&mHourSize,8);
addItemBool("Show Daily Recurrences",&mDailyRecur,true);
addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
addItemBool("ShowShortMonthName",&mMonthShowShort,false);
addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true);
#ifdef DESKTOP_VERION
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 9749ba3..576edf9 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -340,24 +340,33 @@ class KOPrefs : public KPimPrefs
bool mEVshowDetails;
bool mEVshowCreated;
bool mEVshowChanged;
bool mWTshowDetails;
bool mWTshowCreated;
bool mWTshowChanged;
int mCurrentDisplayedView;
QPtrList<KopiCalendarFile> mCalendars;
int mNextAvailableCalendar;
bool mGlobalUpdateDisabled;
+
+ bool mDetectConflicts;
+ bool mCheckConflictsAllDayAllDay;
+ bool mCheckConflictsAllDayNonAD;
+ bool mCheckConflictsNonADAllDay;
+ bool mCheckConflictsNonADNonAD;
+ QString mFilterConflictEditItem;
+ QString mFilterConflictAllItem;
+
private:
QDict<QColor> mCategoryColors;
QArray<KopiCalendarFile*> mDefCalColors;
QColor mDefaultCategoryColor;
QFont mDefaultTimeBarFont;
QFont mDefaultViewFont;
QFont mDefaultMonthViewFont;
QString mName;
QString mEmail;
};
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 9e2378a..bbdf508 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -913,24 +913,59 @@ dummy =
topLayout->addWidget(lab ,ii++,0);
dummy = addWidBool(i18n("Details"),
&(KOPrefs::instance()->mWTshowDetails),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy = addWidBool(i18n("Created time"),
&(KOPrefs::instance()->mWTshowCreated),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy = addWidBool(i18n("Last modified time"),
&(KOPrefs::instance()->mWTshowChanged),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
+ topFrame = addPage(i18n("Conflict detection"),0,0);
+
+ topLayout = new QGridLayout(topFrame,2,1);
+ topLayout->setSpacing(mSpacingHint);
+ topLayout->setMargin(mMarginHint);
+ ii = 0;
+ dummy = addWidBool(i18n("Enable conflict detection"),
+ &(KOPrefs::instance()->mDetectConflicts),topFrame);
+ topLayout->addWidget(dummy->checkBox(), ii++,0);
+ topFrame = new QFrame( topFrame );
+ topLayout->addWidget(topFrame ,ii++,0);
+ topLayout = new QGridLayout(topFrame,4,1);
+ connect ( dummy->checkBox(), SIGNAL( toggled( bool ) ), topFrame, SLOT ( setEnabled( bool ) ) );
+ 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);
+ topLayout->addWidget( new QLabel ( i18n("Filter for the edited event"), topFrame ) , ii++,0);
+ mFilterEditItem = new QComboBox( topFrame );
+ topLayout->addWidget(mFilterEditItem,ii++,0);
+ topLayout->addWidget( new QLabel ( i18n("Filter for other existing events"), topFrame ) , ii++,0);
+ mFilterAllItem = new QComboBox( topFrame );
+ topLayout->addWidget(mFilterAllItem,ii++,0);
+ dummy = addWidBool(i18n("Check Allday with Allday"),
+ &(KOPrefs::instance()->mCheckConflictsAllDayAllDay),topFrame);
+ topLayout->addWidget(dummy->checkBox(), ii++,0);
+ dummy = addWidBool(i18n("Check Allday with NonAllday"),
+ &(KOPrefs::instance()->mCheckConflictsAllDayNonAD),topFrame);
+ topLayout->addWidget(dummy->checkBox(), ii++,0);
+ dummy = addWidBool(i18n("Check NonAllday with Allday"),
+ &(KOPrefs::instance()->mCheckConflictsNonADAllDay),topFrame);
+ topLayout->addWidget(dummy->checkBox(), ii++,0);
+ dummy = addWidBool(i18n("Check NonAllday with NonAllday"),
+ &(KOPrefs::instance()->mCheckConflictsNonADNonAD),topFrame);
+ topLayout->addWidget(dummy->checkBox(), ii++,0);
+
+
+
topFrame = addPage(i18n("Alarm"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
topLayout = new QGridLayout(topFrame,2,1);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
int iii = 0;
dummy =
addWidBool(i18n("Use internal alarm notification"),
&(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
@@ -1426,24 +1461,38 @@ void KOPrefsDialog::usrReadConfig()
// item->setText(0,*it);
// mAMails->insertItem(item);
// }
//that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile);
mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile);
updateCategories();
mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps );
mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime );
mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount );
mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval );
mCatDefaultColor = KOPrefs::instance()->mEventColor;
+
+
+ KConfig cfgko(locateLocal("config","korganizerrc"));
+ cfgko.setGroup("General");
+ QStringList temp = cfgko.readListEntry("CalendarFilters");
+ temp.prepend(i18n("No Filter") );
+ mFilterEditItem->insertStringList( temp );
+ mFilterAllItem->insertStringList( temp );
+ int index = temp.findIndex( KOPrefs::instance()->mFilterConflictEditItem );
+ if ( index >= 0 )
+ mFilterEditItem->setCurrentItem( index );
+ index = temp.findIndex( KOPrefs::instance()->mFilterConflictAllItem );
+ if ( index >= 0 )
+ mFilterAllItem->setCurrentItem( index );
}
void KOPrefsDialog::usrWriteConfig()
{
KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
KOPrefs::instance()->setFullName(mNameEdit->text());
KOPrefs::instance()->setEmail(mEmailEdit->text());
KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
@@ -1470,24 +1519,27 @@ void KOPrefsDialog::usrWriteConfig()
KOPrefs::instance()->mAdditionalMails.clear();
// QListViewItem *item;
// item = mAMails->firstChild();
// while (item)
// {
// KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
// item = item->nextSibling();
// }
KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
+
+ KOPrefs::instance()->mFilterConflictEditItem = mFilterEditItem->currentText();
+ KOPrefs::instance()->mFilterConflictAllItem = mFilterAllItem->currentText();
}
void KOPrefsDialog::updateCategories()
{
mCategoryCombo->clear();
mCategoryDict.clear();
mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
updateCategoryColor();
}
void KOPrefsDialog::toggleEmailSettings(bool on)
{
diff --git a/korganizer/koprefsdialog.h b/korganizer/koprefsdialog.h
index baa6cf9..ee7a7aa 100644
--- a/korganizer/koprefsdialog.h
+++ b/korganizer/koprefsdialog.h
@@ -138,18 +138,20 @@ class KOPrefsDialog : public KPrefsDialog
QLineEdit * mUserDateFormatShort;
QSpinBox *mTimezoneOffsetSpin;
QSpinBox *mDaylightsavingStart;
QSpinBox *mDaylightsavingEnd;
KDateEdit* mStartDateSavingEdit;
KDateEdit* mEndDateSavingEdit;
QSpinBox * mAlarmPlayBeeps;
QSpinBox * mAlarmSuspendTime;
QSpinBox * mAlarmSuspendCount;
QSpinBox * mAlarmBeepInterval;
+ QComboBox * mFilterEditItem, *mFilterAllItem;
+
QLineEdit * mDefaultAlarmFile;
int mSpacingHint;
int mMarginHint;
};
#endif