-rw-r--r-- | korganizer/calendarview.cpp | 62 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 4 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 16 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 12 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 4 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 10 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 10 | ||||
-rw-r--r-- | libkcal/calendar.cpp | 6 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 6 | ||||
-rw-r--r-- | libkcal/calfilter.cpp | 6 | ||||
-rw-r--r-- | libkcal/event.h | 1 | ||||
-rw-r--r-- | libkcal/freebusy.h | 1 | ||||
-rw-r--r-- | libkcal/icalformat.cpp | 4 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 6 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 6 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 2 | ||||
-rw-r--r-- | libkcal/journal.h | 1 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 4 | ||||
-rw-r--r-- | libkcal/todo.cpp | 5 | ||||
-rw-r--r-- | libkcal/todo.h | 1 |
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 @@ -171,11 +171,11 @@ MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Inciden dt = inc->getNextOccurence( start, &ok ); 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:"; } tempText += inc->uid() + "\">"; - if ( inc->type() == "Todo" ) + if ( inc->typeID() == todoID ) tempText += i18n("Todo: "); if ( inc->summary().length() > 0 ) @@ -974,10 +974,10 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b if ( full ) { 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)); if ( equ ) { @@ -1100,5 +1100,5 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t return; } - if ( toDelete->type() == "Journal" ) + if ( toDelete->typeID() == journalID ) return; @@ -1110,5 +1110,5 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t QString des = eve->description(); QString pref = "e"; - if ( toDelete->type() == "Todo" ) + if ( toDelete->typeID() == todoID ) pref = "t"; des += pref+ id + ","; @@ -1287,5 +1287,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int QString des = eventLSync->description(); QString pref = "e"; - if ( inR->type() == "Todo" ) + if ( inR->typeID() == todoID ) pref = "t"; if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it @@ -1344,5 +1344,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( uid.left(15) == QString("last-syncEvent-") ) skipIncidence = true; - if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) skipIncidence = true; if ( !skipIncidence ) { @@ -1400,5 +1400,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); while ( inR ) { - if ( inR->type() == "Todo" ) { + if ( inR->typeID() == todoID ) { Todo * t = (Todo*)inR; if ( t->hasDueDate() ) @@ -1407,5 +1407,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int dt = cur.addSecs( 62 ); } - else if (inR->type() == "Event" ) { + else if (inR->typeID() == eventID ) { bool ok; dt = inR->getNextOccurence( cur, &ok ); @@ -2478,5 +2478,5 @@ void CalendarView::edit_cut() if (mViewManager->currentView()->isEventView()) { - if ( incidence && incidence->type() == "Event" ) { + if ( incidence && incidence->typeID() == eventID ) { anEvent = static_cast<Event *>(incidence); } @@ -2499,5 +2499,5 @@ void CalendarView::edit_copy() if (mViewManager->currentView()->isEventView()) { - if ( incidence && incidence->type() == "Event" ) { + if ( incidence && incidence->typeID() == eventID ) { anEvent = static_cast<Event *>(incidence); } @@ -2551,5 +2551,5 @@ void CalendarView::slotSelectPickerDate( QDate d) mNavigator->slotDaySelect( d ); } else if ( mDatePickerMode == 2 ) { - if ( mMoveIncidence->type() == "Todo" ) { + if ( mMoveIncidence->typeID() == todoID ) { Todo * to = (Todo *) mMoveIncidence; QTime tim; @@ -2582,5 +2582,5 @@ void CalendarView::slotSelectPickerDate( QDate d) Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); mCalendar()->addIncidence( newInc ); - if ( mMoveIncidence->type() == "Todo" ) + if ( mMoveIncidence->typeID() == todoID ) emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); else @@ -2768,5 +2768,5 @@ void CalendarView::moveIncidence(Incidence * inc ) mMoveIncidence = inc ; QDate da; - if ( mMoveIncidence->type() == "Todo" ) { + if ( mMoveIncidence->typeID() == todoID ) { Todo * to = (Todo *) mMoveIncidence; if ( to->hasDueDate() ) @@ -2901,5 +2901,5 @@ void CalendarView::cloneIncidence(Incidence * orgInc ) newInc->recreate(); - if ( newInc->type() == "Todo" ) { + if ( newInc->typeID() == todoID ) { Todo* t = (Todo*) newInc; bool cloneSub = false; @@ -3165,5 +3165,5 @@ void CalendarView::appointment_show() if (mViewManager->currentView()->isEventView()) { - if ( incidence && incidence->type() == "Event" ) { + if ( incidence && incidence->typeID() == eventID ) { anEvent = static_cast<Event *>(incidence); } @@ -3185,5 +3185,5 @@ void CalendarView::appointment_edit() if (mViewManager->currentView()->isEventView()) { - if ( incidence && incidence->type() == "Event" ) { + if ( incidence && incidence->typeID() == eventID ) { anEvent = static_cast<Event *>(incidence); } @@ -3205,5 +3205,5 @@ void CalendarView::appointment_delete() if (mViewManager->currentView()->isEventView()) { - if ( incidence && incidence->type() == "Event" ) { + if ( incidence && incidence->typeID() == eventID ) { anEvent = static_cast<Event *>(incidence); } @@ -3406,5 +3406,5 @@ void CalendarView::action_mail() Event *event = 0; Event *ev = 0; - if ( incidence && incidence->type() == "Event" ) { + if ( incidence && incidence->typeID() == eventID ) { event = static_cast<Event *>(incidence); ev = new Event(*event); @@ -3451,8 +3451,8 @@ 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); } @@ -3566,8 +3566,8 @@ 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); } @@ -3773,5 +3773,5 @@ void CalendarView::processIncidenceSelection( Incidence *incidence ) emit incidenceSelected( mSelectedIncidence ); - if ( incidence && incidence->type() == "Event" ) { + if ( incidence && incidence->typeID() == eventID ) { Event *event = static_cast<Event *>( incidence ); if ( event->organizer() == KOPrefs::instance()->email() ) { @@ -3788,5 +3788,5 @@ void CalendarView::processIncidenceSelection( Incidence *incidence ) return; } else { - if ( incidence && incidence->type() == "Todo" ) { + if ( incidence && incidence->typeID() == todoID ) { emit todoSelected( true ); Todo *event = static_cast<Todo *>( incidence ); @@ -3811,5 +3811,5 @@ void CalendarView::processIncidenceSelection( Incidence *incidence ) } - /* if ( incidence && incidence->type() == "Todo" ) { + /* if ( incidence && incidence->typeID() == todoID ) { emit todoSelected( true ); } else { @@ -4066,10 +4066,10 @@ Todo *CalendarView::selectedTodo() { Incidence *incidence = currentSelection(); - if ( incidence && incidence->type() == "Todo" ) { + if ( incidence && incidence->typeID() == todoID ) { return static_cast<Todo *>( incidence ); } 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 @@ -754,5 +754,5 @@ void KOAgenda::startItemAction(QPoint viewportPos) } else { int gridDistanceY = (y - gy * mGridSpacingY); - bool allowResize = ( mActionItem->incidence()->type() != "Todo" ); + bool allowResize = ( mActionItem->incidence()->typeID() != todoID ); if (allowResize && gridDistanceY < mResizeBorderWidth && mActionItem->cellYTop() == mCurrentCellY && @@ -913,5 +913,5 @@ void KOAgenda::endItemAction() KOAgendaItem *item; - if ( placeItem->incidence()->type() == "Todo" ) { + if ( placeItem->incidence()->typeID() == todoID ) { mSelectedItem = 0; //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index df2e478..5a3c4d2 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -107,5 +107,5 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) computeText(); - if ( (incidence->type() == "Todo") && + if ( (incidence->typeID() == todoID ) && ( !((static_cast<Todo*>(incidence))->isCompleted()) && ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { @@ -119,5 +119,5 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) QString cat = categories.first(); 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; else @@ -125,5 +125,5 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) } else { 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 ) mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; @@ -360,5 +360,5 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) static const QPixmap completedPxmp = SmallIcon("greenhook16"); static const QPixmap overduePxmp = SmallIcon("redcross16"); - if ( mIncidence->type() == "Todo" ) { + if ( mIncidence->typeID() == todoID ) { Todo* tempTodo = static_cast<Todo*>(mIncidence); int xx = pos().x()+(width()-completedPxmp.width()-3 ); @@ -541,5 +541,5 @@ void KOAgendaItem::computeText() { mDisplayedText = mIncidence->summary(); - if ( (mIncidence->type() == "Todo") ) { + if ( (mIncidence->typeID() == todoID ) ) { if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) @@ -573,5 +573,5 @@ void KOAgendaItem::computeText() QString tipText = mIncidence->summary(); if ( !mIncidence->doesFloat() ) { - if ( mIncidence->type() == "Event" ) { + if ( mIncidence->typeID() == eventID ) { if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); @@ -583,5 +583,5 @@ void KOAgendaItem::computeText() } } - else if ( mIncidence->type() == "Todo" ) { + else if ( mIncidence->typeID() == todoID ) { if (mIncidence->hasStartDate()) tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); @@ -589,5 +589,5 @@ void KOAgendaItem::computeText() tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); } - } else if ( mIncidence->type() == "Todo" ) { + } else if ( mIncidence->typeID() == todoID ) { if (mIncidence->hasStartDate()) tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 7022e02..be51694 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -401,6 +401,6 @@ void KOListView::setAlarm() if ( qitem->isSelected() ) { 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() ) sel.append(((KOListViewItem *)qitem)); @@ -489,5 +489,5 @@ void KOListView::setCategories( bool removeOld ) Incidence* inc = item->data() ; 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, i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), @@ -612,5 +612,5 @@ void KOListView::saveDescriptionToFile() icount = 0; while ( incidence ) { - if ( incidence->type() == "Journal" ) { + if ( incidence->typeID() == journalID ) { text += "\n************************************\n"; text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); @@ -622,5 +622,5 @@ void KOListView::saveDescriptionToFile() if ( !incidence->description().isEmpty() ) { text += "\n************************************\n"; - if ( incidence->type() == "Todo" ) + if ( incidence->typeID() == todoID ) text += i18n("To-Do: "); text += incidence->summary(); @@ -670,5 +670,5 @@ void KOListView::writeToFile( bool iCal ) if ( item->isSelected() ) { if ( !journal ) - if ( ((KOListViewItem *)item)->data()->type() == "Journal") + if ( ((KOListViewItem *)item)->data()->typeID() == journalID ) journal = true; delSel.append(((KOListViewItem *)item)->data()); diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 5aaf360..2602487 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -703,5 +703,5 @@ void KOTodoView::updateView() Incidence *incidence = todo->relatedTo(); while ( incidence ) { - if ( incidence->type() == "Todo") { + if ( incidence->typeID() == todoID ) { //qDebug("related %s ",incidence->summary().latin1() ); if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { @@ -845,5 +845,5 @@ QMap<Todo *,KOTodoViewItem *>::ConstIterator pendingSubtodo = 0; 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 @@ -490,5 +490,5 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a if ( reply ) { noc = ev->getNextOccurence( cdt, &ok ); - if (! ok && ev->type() == "Event") + if (! ok && ev->typeID() == eventID) return false; } @@ -497,5 +497,5 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a bDay = true; tempText += "<tr><td><b>"; - if (ev->type()=="Event") { + if (ev->typeID() == eventID ) { if (reply) { if (!ev->doesFloat()) @@ -621,6 +621,6 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a tempText += "</font>"; 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() + "\">"; if ( ev->summary().length() > 0 ) @@ -632,5 +632,5 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a if ( ok ) { int years = 0; - if ( ev->type() =="Todo" ) { + if ( ev->typeID() == todoID ) { years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); } else diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 53b65b2..481eab4 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1333,9 +1333,9 @@ void MainWindow::exportToPhone( int mode ) QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); while ( incidence ) { - if ( incidence->type() != "Journal" ) { + if ( incidence->typeID() != journalID ) { bool add = true; if ( inFuture ) { QDateTime dt; - if ( incidence->type() == "Todo" ) { + if ( incidence->typeID() == todoID ) { Todo * t = (Todo*)incidence; if ( t->hasDueDate() ) @@ -1597,5 +1597,5 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) //KGlobal::locale()->formatDateTime(nextA, true); QString startString = ""; - if ( incidence->type() != "Todo" ) { + if ( incidence->typeID() != todoID ) { if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { if ( incidence->doesFloat() ) { @@ -1635,5 +1635,5 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) enableIncidenceActions( true ); - if ( incidence->type() == "Event" ) { + if ( incidence->typeID() == eventID ) { mShowAction->setText( i18n("Show Event...") ); mEditAction->setText( i18n("Edit Event...") ); @@ -1641,5 +1641,5 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) mNewSubTodoAction->setEnabled( false ); - } else if ( incidence->type() == "Todo" ) { + } else if ( incidence->typeID() == todoID ) { mShowAction->setText( i18n("Show Todo...") ); mEditAction->setText( i18n("Edit Todo...") ); diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index ed39ddb..7e8e2c5 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp @@ -354,9 +354,9 @@ bool Calendar::addIncidence(Incidence *i) 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 @@ -459,7 +459,5 @@ Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) { - kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - " - << to.toString() << ")\n"; - + Alarm::List alarms; @@ -489,6 +487,4 @@ void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, if ( alarm->enabled() ) { 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 @@ -79,9 +79,9 @@ void CalFilter::apply(QPtrList<Todo> *eventlist) 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 ); return false; diff --git a/libkcal/event.h b/libkcal/event.h index 8729956..287d403 100644 --- a/libkcal/event.h +++ b/libkcal/event.h @@ -41,4 +41,5 @@ class Event : public Incidence QCString type() const { return "Event"; } + IncTypeID typeID() const { return eventID; } Incidence *clone(); diff --git a/libkcal/freebusy.h b/libkcal/freebusy.h index 054feda..d741c72 100644 --- a/libkcal/freebusy.h +++ b/libkcal/freebusy.h @@ -49,4 +49,5 @@ class FreeBusy : public IncidenceBase QCString type() const { return "FreeBusy"; } + IncTypeID typeID() const { return freebusyID; } virtual QDateTime dtEnd() const; diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp index 3a2aac6..d9fe40b 100644 --- a/libkcal/icalformat.cpp +++ b/libkcal/icalformat.cpp @@ -385,10 +385,10 @@ ScheduleMessage *ICalFormat::parseScheduleMessage( Calendar *cal, if (existingIncidence) { // 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); icalcomponent_add_component(calendarComponent, mImpl->writeTodo(todo)); } - if (existingIncidence->type() == "Event") { + if (existingIncidence->typeID() == eventID ) { Event *event = static_cast<Event *>(existingIncidence); icalcomponent_add_component(calendarComponent, diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 2405682..3e28714 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp @@ -2156,13 +2156,13 @@ 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); icalcomponent_add_component(message,writeTodo(todo)); } - if(incidence->type() == "Event") { + if(incidence->typeID() == eventID ) { Event *event = static_cast<Event *>(incidence); icalcomponent_add_component(message,writeEvent(event)); } - if(incidence->type() == "FreeBusy") { + if(incidence->typeID() == freebusyID) { FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); icalcomponent_add_component(message,writeFreeBusy(freebusy, method)); diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 762103f..f446197 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -237,5 +237,5 @@ Incidence* Incidence::recreateCloneException( QDate d ) addExDate( d ); newInc->recurrence()->unsetRecurs(); - if ( type() == "Event") { + if ( typeID() == eventID ) { int len = dtStart().secsTo( ((Event*)this)->dtEnd()); QTime tim = dtStart().time(); @@ -725,5 +725,5 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const incidenceStart = dtStart(); } - if ( type() =="Todo" ) { + if ( typeID() == todoID ) { if ( ((Todo*)this)->hasDueDate() ) incidenceStart = ((Todo*)this)->dtDue(); @@ -737,5 +737,5 @@ 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 @@ -35,4 +35,5 @@ namespace KCal { typedef QValueList<QDate> DateList; + enum IncTypeID { eventID,todoID,journalID,freebusyID }; /** @@ -52,4 +53,5 @@ class IncidenceBase : public CustomProperties virtual QCString type() const = 0; + virtual IncTypeID typeID() const = 0; /** Set the unique id for the event */ diff --git a/libkcal/journal.h b/libkcal/journal.h index 2c1d7ea..1cd0a22 100644 --- a/libkcal/journal.h +++ b/libkcal/journal.h @@ -38,4 +38,5 @@ class Journal : public Incidence QCString type() const { return "Journal"; } + IncTypeID typeID() const { return journalID; } Incidence *clone(); diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 7d61b7f..d1ace4f 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp @@ -22,7 +22,7 @@ QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bo mModified = modified; 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 ); return mText; diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 38ba2c7..c97a61e 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -131,5 +131,5 @@ void Todo::saveParents() return; Incidence * inc = relatedTo(); - if ( inc->type() != "Todo" ) + if ( inc->typeID() != todoID ) return; Todo* to = (Todo*)inc; @@ -565,6 +565,7 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_d void Todo::checkSetCompletedFalse() { - if ( !hasRecurrenceID() ) { + if ( !mHasRecurrenceID ) { qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); + return; } // qDebug("Todo::checkSetCompletedFalse()"); diff --git a/libkcal/todo.h b/libkcal/todo.h index ab8fdf1..501c2ba 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h @@ -42,4 +42,5 @@ namespace KCal { typedef ListBase<Todo> List; QCString type() const { return "Todo"; } + IncTypeID typeID() const { return todoID; } /** Return an exact copy of this todo. */ |