summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-08 10:34:22 (UTC)
committer zautrix <zautrix>2005-06-08 10:34:22 (UTC)
commit793d117812b4da36c9c11d90cccba347cbc6e208 (patch) (side-by-side diff)
tree5bc77e2b7a32a541c2a3b3c3d6d50f873216deef
parent39d84e2fc3099bd5d7596e8be5dc6783826cec01 (diff)
downloadkdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.zip
kdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.tar.gz
kdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.tar.bz2
changed incidence type to a faster access method
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp62
-rw-r--r--korganizer/koagenda.cpp4
-rw-r--r--korganizer/koagendaitem.cpp16
-rw-r--r--korganizer/kolistview.cpp12
-rw-r--r--korganizer/kotodoview.cpp4
-rw-r--r--korganizer/kowhatsnextview.cpp10
-rw-r--r--korganizer/mainwindow.cpp10
-rw-r--r--libkcal/calendar.cpp6
-rw-r--r--libkcal/calendarlocal.cpp6
-rw-r--r--libkcal/calfilter.cpp6
-rw-r--r--libkcal/event.h1
-rw-r--r--libkcal/freebusy.h1
-rw-r--r--libkcal/icalformat.cpp4
-rw-r--r--libkcal/icalformatimpl.cpp6
-rw-r--r--libkcal/incidence.cpp6
-rw-r--r--libkcal/incidencebase.h2
-rw-r--r--libkcal/journal.h1
-rw-r--r--libkcal/kincidenceformatter.cpp4
-rw-r--r--libkcal/todo.cpp5
-rw-r--r--libkcal/todo.h1
20 files changed, 85 insertions, 82 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 720ad78..7c7466b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -172,5 +172,5 @@ MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Inciden
if ( !ok ) continue;
- if ( inc->type() == "Event" ) {
+ if ( inc->typeID() == eventID ) {
tempText += "href=\"event:";
- } else if ( inc->type() == "Todo" ) {
+ } else if ( inc->typeID() == todoID ) {
tempText += "href=\"todo:";
@@ -178,3 +178,3 @@ MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Inciden
tempText += inc->uid() + "\">";
- if ( inc->type() == "Todo" )
+ if ( inc->typeID() == todoID )
tempText += i18n("Todo: ");
@@ -975,8 +975,8 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
bool equ = false;
- if ( local->type() == "Event" ) {
+ if ( local->typeID() == eventID ) {
equ = (*((Event*) local) == *((Event*) remote));
}
- else if ( local->type() =="Todo" )
+ else if ( local->typeID() == todoID )
equ = (*((Todo*) local) == (*(Todo*) remote));
- else if ( local->type() =="Journal" )
+ else if ( local->typeID() == journalID )
equ = (*((Journal*) local) == *((Journal*) remote));
@@ -1101,3 +1101,3 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t
}
- if ( toDelete->type() == "Journal" )
+ if ( toDelete->typeID() == journalID )
return;
@@ -1111,3 +1111,3 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t
QString pref = "e";
- if ( toDelete->type() == "Todo" )
+ if ( toDelete->typeID() == todoID )
pref = "t";
@@ -1288,3 +1288,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
QString pref = "e";
- if ( inR->type() == "Todo" )
+ if ( inR->typeID() == todoID )
pref = "t";
@@ -1345,3 +1345,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
skipIncidence = true;
- if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID )
skipIncidence = true;
@@ -1401,3 +1401,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
while ( inR ) {
- if ( inR->type() == "Todo" ) {
+ if ( inR->typeID() == todoID ) {
Todo * t = (Todo*)inR;
@@ -1408,3 +1408,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
}
- else if (inR->type() == "Event" ) {
+ else if (inR->typeID() == eventID ) {
bool ok;
@@ -2479,3 +2479,3 @@ void CalendarView::edit_cut()
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
@@ -2500,3 +2500,3 @@ void CalendarView::edit_copy()
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
@@ -2552,3 +2552,3 @@ void CalendarView::slotSelectPickerDate( QDate d)
} else if ( mDatePickerMode == 2 ) {
- if ( mMoveIncidence->type() == "Todo" ) {
+ if ( mMoveIncidence->typeID() == todoID ) {
Todo * to = (Todo *) mMoveIncidence;
@@ -2583,3 +2583,3 @@ void CalendarView::slotSelectPickerDate( QDate d)
mCalendar()->addIncidence( newInc );
- if ( mMoveIncidence->type() == "Todo" )
+ if ( mMoveIncidence->typeID() == todoID )
emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
@@ -2769,3 +2769,3 @@ void CalendarView::moveIncidence(Incidence * inc )
QDate da;
- if ( mMoveIncidence->type() == "Todo" ) {
+ if ( mMoveIncidence->typeID() == todoID ) {
Todo * to = (Todo *) mMoveIncidence;
@@ -2902,3 +2902,3 @@ void CalendarView::cloneIncidence(Incidence * orgInc )
- if ( newInc->type() == "Todo" ) {
+ if ( newInc->typeID() == todoID ) {
Todo* t = (Todo*) newInc;
@@ -3166,3 +3166,3 @@ void CalendarView::appointment_show()
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
@@ -3186,3 +3186,3 @@ void CalendarView::appointment_edit()
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
@@ -3206,3 +3206,3 @@ void CalendarView::appointment_delete()
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
@@ -3407,3 +3407,3 @@ void CalendarView::action_mail()
Event *ev = 0;
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
event = static_cast<Event *>(incidence);
@@ -3452,6 +3452,6 @@ void CalendarView::schedule_publish(Incidence *incidence)
}
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
event = static_cast<Event *>(incidence);
} else {
- if ( incidence && incidence->type() == "Todo" ) {
+ if ( incidence && incidence->typeID() == todoID ) {
todo = static_cast<Todo *>(incidence);
@@ -3567,6 +3567,6 @@ void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
}
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
event = static_cast<Event *>(incidence);
}
- if ( incidence && incidence->type() == "Todo" ) {
+ if ( incidence && incidence->typeID() == todoID ) {
todo = static_cast<Todo *>(incidence);
@@ -3774,3 +3774,3 @@ void CalendarView::processIncidenceSelection( Incidence *incidence )
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
Event *event = static_cast<Event *>( incidence );
@@ -3789,3 +3789,3 @@ void CalendarView::processIncidenceSelection( Incidence *incidence )
} else {
- if ( incidence && incidence->type() == "Todo" ) {
+ if ( incidence && incidence->typeID() == todoID ) {
emit todoSelected( true );
@@ -3812,3 +3812,3 @@ void CalendarView::processIncidenceSelection( Incidence *incidence )
- /* if ( incidence && incidence->type() == "Todo" ) {
+ /* if ( incidence && incidence->typeID() == todoID ) {
emit todoSelected( true );
@@ -4067,3 +4067,3 @@ Todo *CalendarView::selectedTodo()
Incidence *incidence = currentSelection();
- if ( incidence && incidence->type() == "Todo" ) {
+ if ( incidence && incidence->typeID() == todoID ) {
return static_cast<Todo *>( incidence );
@@ -4072,3 +4072,3 @@ Todo *CalendarView::selectedTodo()
incidence = mTodoList->selectedIncidences().first();
- if ( incidence && incidence->type() == "Todo" ) {
+ if ( incidence && incidence->typeID() == todoID ) {
return static_cast<Todo *>( incidence );
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 2a2acb1..fc213d8 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -755,3 +755,3 @@ void KOAgenda::startItemAction(QPoint viewportPos)
int gridDistanceY = (y - gy * mGridSpacingY);
- bool allowResize = ( mActionItem->incidence()->type() != "Todo" );
+ bool allowResize = ( mActionItem->incidence()->typeID() != todoID );
if (allowResize && gridDistanceY < mResizeBorderWidth &&
@@ -914,3 +914,3 @@ void KOAgenda::endItemAction()
- if ( placeItem->incidence()->type() == "Todo" ) {
+ if ( placeItem->incidence()->typeID() == todoID ) {
mSelectedItem = 0;
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index df2e478..5a3c4d2 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -108,3 +108,3 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
- if ( (incidence->type() == "Todo") &&
+ if ( (incidence->typeID() == todoID ) &&
( !((static_cast<Todo*>(incidence))->isCompleted()) &&
@@ -120,3 +120,3 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
if (cat.isEmpty()) {
- if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) )
+ if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) )
mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
@@ -126,3 +126,3 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
- if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
+ if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
@@ -361,3 +361,3 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
static const QPixmap overduePxmp = SmallIcon("redcross16");
- if ( mIncidence->type() == "Todo" ) {
+ if ( mIncidence->typeID() == todoID ) {
Todo* tempTodo = static_cast<Todo*>(mIncidence);
@@ -542,3 +542,3 @@ void KOAgendaItem::computeText()
mDisplayedText = mIncidence->summary();
- if ( (mIncidence->type() == "Todo") ) {
+ if ( (mIncidence->typeID() == todoID ) ) {
if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
@@ -574,3 +574,3 @@ void KOAgendaItem::computeText()
if ( !mIncidence->doesFloat() ) {
- if ( mIncidence->type() == "Event" ) {
+ if ( mIncidence->typeID() == eventID ) {
if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
@@ -584,3 +584,3 @@ void KOAgendaItem::computeText()
}
- else if ( mIncidence->type() == "Todo" ) {
+ else if ( mIncidence->typeID() == todoID ) {
if (mIncidence->hasStartDate())
@@ -590,3 +590,3 @@ void KOAgendaItem::computeText()
}
- } else if ( mIncidence->type() == "Todo" ) {
+ } else if ( mIncidence->typeID() == todoID ) {
if (mIncidence->hasStartDate())
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 7022e02..be51694 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -402,4 +402,4 @@ void KOListView::setAlarm()
Incidence* inc = ((KOListViewItem *) qitem)->data();
- if ( inc->type() != "Journal" ) {
- if ( inc->type() == "Todo" ) {
+ if ( inc->typeID() != journalID ) {
+ if ( inc->typeID() == todoID ) {
if ( ((Todo*)inc)->hasDueDate() )
@@ -490,3 +490,3 @@ void KOListView::setCategories( bool removeOld )
bool setSub = false;
- if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) {
+ if( inc->typeID() == todoID && sel.count() == 1 && inc->relations().count() > 0 ) {
int result = KMessageBox::warningYesNoCancel(this,
@@ -613,3 +613,3 @@ void KOListView::saveDescriptionToFile()
while ( incidence ) {
- if ( incidence->type() == "Journal" ) {
+ if ( incidence->typeID() == journalID ) {
text += "\n************************************\n";
@@ -623,3 +623,3 @@ void KOListView::saveDescriptionToFile()
text += "\n************************************\n";
- if ( incidence->type() == "Todo" )
+ if ( incidence->typeID() == todoID )
text += i18n("To-Do: ");
@@ -671,3 +671,3 @@ void KOListView::writeToFile( bool iCal )
if ( !journal )
- if ( ((KOListViewItem *)item)->data()->type() == "Journal")
+ if ( ((KOListViewItem *)item)->data()->typeID() == journalID )
journal = true;
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 5aaf360..2602487 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -704,3 +704,3 @@ void KOTodoView::updateView()
while ( incidence ) {
- if ( incidence->type() == "Todo") {
+ if ( incidence->typeID() == todoID ) {
//qDebug("related %s ",incidence->summary().latin1() );
@@ -846,3 +846,3 @@ QMap<Todo *,KOTodoViewItem *>::ConstIterator
Incidence *incidence = todo->relatedTo();
- if (incidence && incidence->type() == "Todo") {
+ if (incidence && incidence->typeID() == todoID ) {
Todo *relatedTodo = static_cast<Todo *>(incidence);
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 62d7ede..e8574a0 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -491,3 +491,3 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
noc = ev->getNextOccurence( cdt, &ok );
- if (! ok && ev->type() == "Event")
+ if (! ok && ev->typeID() == eventID)
return false;
@@ -498,3 +498,3 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
tempText += "<tr><td><b>";
- if (ev->type()=="Event") {
+ if (ev->typeID() == eventID ) {
if (reply) {
@@ -622,4 +622,4 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
tempText += "<a ";
- if (ev->type()=="Event") tempText += "href=\"event:";
- if (ev->type()=="Todo") tempText += "href=\"todo:";
+ if (ev->typeID() == eventID ) tempText += "href=\"event:";
+ if (ev->typeID() == todoID ) tempText += "href=\"todo:";
tempText += ev->uid() + "\">";
@@ -633,3 +633,3 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
int years = 0;
- if ( ev->type() =="Todo" ) {
+ if ( ev->typeID() == todoID ) {
years = noc.date().year() -((Todo*)ev)->dtDue().date().year();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 53b65b2..481eab4 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1334,3 +1334,3 @@ void MainWindow::exportToPhone( int mode )
while ( incidence ) {
- if ( incidence->type() != "Journal" ) {
+ if ( incidence->typeID() != journalID ) {
bool add = true;
@@ -1338,3 +1338,3 @@ void MainWindow::exportToPhone( int mode )
QDateTime dt;
- if ( incidence->type() == "Todo" ) {
+ if ( incidence->typeID() == todoID ) {
Todo * t = (Todo*)incidence;
@@ -1598,3 +1598,3 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
QString startString = "";
- if ( incidence->type() != "Todo" ) {
+ if ( incidence->typeID() != todoID ) {
if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
@@ -1636,3 +1636,3 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
- if ( incidence->type() == "Event" ) {
+ if ( incidence->typeID() == eventID ) {
mShowAction->setText( i18n("Show Event...") );
@@ -1642,3 +1642,3 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
mNewSubTodoAction->setEnabled( false );
- } else if ( incidence->type() == "Todo" ) {
+ } else if ( incidence->typeID() == todoID ) {
mShowAction->setText( i18n("Show Todo...") );
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index ed39ddb..7e8e2c5 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -355,7 +355,7 @@ void Calendar::deleteIncidence(Incidence *in)
{
- if ( in->type() == "Event" )
+ if ( in->typeID() == eventID )
deleteEvent( (Event*) in );
- else if ( in->type() =="Todo" )
+ else if ( in->typeID() == todoID )
deleteTodo( (Todo*) in);
- else if ( in->type() =="Journal" )
+ else if ( in->typeID() == journalID )
deleteJournal( (Journal*) in );
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index bc76c0b..fe74052 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -460,5 +460,3 @@ Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to )
{
- kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - "
- << to.toString() << ")\n";
-
+
Alarm::List alarms;
@@ -490,4 +488,2 @@ void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence,
if ( alarm->time() >= from && alarm->time() <= to ) {
- kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary()
- << "': " << alarm->time().toString() << endl;
alarms.append( alarm );
diff --git a/libkcal/calfilter.cpp b/libkcal/calfilter.cpp
index c425dfc..20078a7 100644
--- a/libkcal/calfilter.cpp
+++ b/libkcal/calfilter.cpp
@@ -80,7 +80,7 @@ bool CalFilter::filterCalendarItem(Incidence *in)
{
- if ( in->type() == "Event" )
+ if ( in->typeID() == eventID )
return filterEvent( (Event*) in );
- else if ( in->type() =="Todo" )
+ else if ( in->typeID() == todoID )
return filterTodo( (Todo*) in);
- else if ( in->type() =="Journal" )
+ else if ( in->typeID () == journalID )
return filterJournal( (Journal*) in );
diff --git a/libkcal/event.h b/libkcal/event.h
index 8729956..287d403 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -42,2 +42,3 @@ class Event : public Incidence
QCString type() const { return "Event"; }
+ IncTypeID typeID() const { return eventID; }
diff --git a/libkcal/freebusy.h b/libkcal/freebusy.h
index 054feda..d741c72 100644
--- a/libkcal/freebusy.h
+++ b/libkcal/freebusy.h
@@ -50,2 +50,3 @@ class FreeBusy : public IncidenceBase
QCString type() const { return "FreeBusy"; }
+ IncTypeID typeID() const { return freebusyID; }
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp
index 3a2aac6..d9fe40b 100644
--- a/libkcal/icalformat.cpp
+++ b/libkcal/icalformat.cpp
@@ -386,3 +386,3 @@ ScheduleMessage *ICalFormat::parseScheduleMessage( Calendar *cal,
// TODO: check, if cast is required, or if it can be done by virtual funcs.
- if (existingIncidence->type() == "Todo") {
+ if (existingIncidence->typeID() == todoID ) {
Todo *todo = static_cast<Todo *>(existingIncidence);
@@ -391,3 +391,3 @@ ScheduleMessage *ICalFormat::parseScheduleMessage( Calendar *cal,
}
- if (existingIncidence->type() == "Event") {
+ if (existingIncidence->typeID() == eventID ) {
Event *event = static_cast<Event *>(existingIncidence);
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index 2405682..3e28714 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -2157,3 +2157,3 @@ icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence,
// TODO: check, if dynamic cast is required
- if(incidence->type() == "Todo") {
+ if(incidence->typeID() == todoID ) {
Todo *todo = static_cast<Todo *>(incidence);
@@ -2161,3 +2161,3 @@ icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence,
}
- if(incidence->type() == "Event") {
+ if(incidence->typeID() == eventID ) {
Event *event = static_cast<Event *>(incidence);
@@ -2165,3 +2165,3 @@ icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence,
}
- if(incidence->type() == "FreeBusy") {
+ if(incidence->typeID() == freebusyID) {
FreeBusy *freebusy = static_cast<FreeBusy *>(incidence);
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 762103f..f446197 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -238,3 +238,3 @@ Incidence* Incidence::recreateCloneException( QDate d )
newInc->recurrence()->unsetRecurs();
- if ( type() == "Event") {
+ if ( typeID() == eventID ) {
int len = dtStart().secsTo( ((Event*)this)->dtEnd());
@@ -726,3 +726,3 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
}
- if ( type() =="Todo" ) {
+ if ( typeID() == todoID ) {
if ( ((Todo*)this)->hasDueDate() )
@@ -738,3 +738,3 @@ QDateTime Incidence::dtStart() const
if ( doesRecur() ) {
- if ( type() == "Todo" ) {
+ if ( typeID() == todoID ) {
((Todo*)this)->checkSetCompletedFalse();
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index 8624786..05209e0 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -36,2 +36,3 @@ namespace KCal {
typedef QValueList<QDate> DateList;
+ enum IncTypeID { eventID,todoID,journalID,freebusyID };
@@ -53,2 +54,3 @@ class IncidenceBase : public CustomProperties
virtual QCString type() const = 0;
+ virtual IncTypeID typeID() const = 0;
diff --git a/libkcal/journal.h b/libkcal/journal.h
index 2c1d7ea..1cd0a22 100644
--- a/libkcal/journal.h
+++ b/libkcal/journal.h
@@ -39,2 +39,3 @@ class Journal : public Incidence
QCString type() const { return "Journal"; }
+ IncTypeID typeID() const { return journalID; }
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 7d61b7f..d1ace4f 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -23,5 +23,5 @@ QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bo
mText = "";
- if ( inc->type() == "Event" )
+ if ( inc->typeID() == eventID )
setEvent((Event *) inc );
- else if ( inc->type() == "Todo" )
+ else if ( inc->typeID() == todoID )
setTodo((Todo *) inc );
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 38ba2c7..c97a61e 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -132,3 +132,3 @@ void Todo::saveParents()
Incidence * inc = relatedTo();
- if ( inc->type() != "Todo" )
+ if ( inc->typeID() != todoID )
return;
@@ -566,4 +566,5 @@ void Todo::checkSetCompletedFalse()
{
- if ( !hasRecurrenceID() ) {
+ if ( !mHasRecurrenceID ) {
qDebug("ERROR 1 in Todo::checkSetCompletedFalse");
+ return;
}
diff --git a/libkcal/todo.h b/libkcal/todo.h
index ab8fdf1..501c2ba 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -43,2 +43,3 @@ namespace KCal {
QCString type() const { return "Todo"; }
+ IncTypeID typeID() const { return todoID; }