summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show 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.cpp4
-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, 84 insertions, 81 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 720ad78..7c7466b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -169,15 +169,15 @@ MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Inciden
QString tempText = "<a ";
bool ok;
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 )
tempText += inc->summary();
else
@@ -972,14 +972,14 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
//qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
//full = true; //debug only
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 ) {
//qDebug("equal ");
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
@@ -1098,9 +1098,9 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t
if ( lastSync.count() == 0 ) {
//qDebug(" lastSync.count() == 0");
return;
}
- if ( toDelete->type() == "Journal" )
+ if ( toDelete->typeID() == journalID )
return;
Event* eve = lastSync.first();
@@ -1108,9 +1108,9 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t
QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
if ( !id.isEmpty() ) {
QString des = eve->description();
QString pref = "e";
- if ( toDelete->type() == "Todo" )
+ if ( toDelete->typeID() == todoID )
pref = "t";
des += pref+ id + ",";
eve->setReadOnly( false );
eve->setDescription( des );
@@ -1285,9 +1285,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
if ( !filterIN || filterIN->filterCalendarItem( inR ) ){
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
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
inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
//remote->deleteIncidence( inR );
@@ -1342,9 +1342,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
uid = inL->uid();
bool skipIncidence = false;
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 ) {
inR = remote->incidence( uid );
if ( ! inR ) {
@@ -1398,16 +1398,16 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
QDateTime dt;
QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
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() )
dt = t->dtDue();
else
dt = cur.addSecs( 62 );
}
- else if (inR->type() == "Event" ) {
+ else if (inR->typeID() == eventID ) {
bool ok;
dt = inR->getNextOccurence( cur, &ok );
if ( !ok )
dt = cur.addSecs( -62 );
@@ -2476,9 +2476,9 @@ void CalendarView::edit_cut()
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
}
}
@@ -2497,9 +2497,9 @@ void CalendarView::edit_copy()
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
}
}
@@ -2549,9 +2549,9 @@ void CalendarView::slotSelectPickerDate( QDate d)
mDateFrame->hide();
if ( mDatePickerMode == 1 ) {
mNavigator->slotDaySelect( d );
} else if ( mDatePickerMode == 2 ) {
- if ( mMoveIncidence->type() == "Todo" ) {
+ if ( mMoveIncidence->typeID() == todoID ) {
Todo * to = (Todo *) mMoveIncidence;
QTime tim;
int len = 0;
if ( to->hasStartDate() && to->hasDueDate() )
@@ -2580,9 +2580,9 @@ void CalendarView::slotSelectPickerDate( QDate d)
#if 0
// PENDING implement this
Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
mCalendar()->addIncidence( newInc );
- if ( mMoveIncidence->type() == "Todo" )
+ if ( mMoveIncidence->typeID() == todoID )
emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
else
emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
mMoveIncidence = newInc;
@@ -2766,9 +2766,9 @@ void CalendarView::moveIncidence(Incidence * inc )
showDatePickerPopup();
mDatePickerMode = 2;
mMoveIncidence = inc ;
QDate da;
- if ( mMoveIncidence->type() == "Todo" ) {
+ if ( mMoveIncidence->typeID() == todoID ) {
Todo * to = (Todo *) mMoveIncidence;
if ( to->hasDueDate() )
da = to->dtDue().date();
else
@@ -2899,9 +2899,9 @@ void CalendarView::cloneIncidence(Incidence * orgInc )
{
Incidence * newInc = orgInc->clone();
newInc->recreate();
- if ( newInc->type() == "Todo" ) {
+ if ( newInc->typeID() == todoID ) {
Todo* t = (Todo*) newInc;
bool cloneSub = false;
if ( orgInc->relations().count() ) {
int result = KMessageBox::warningYesNoCancel(this,
@@ -3163,9 +3163,9 @@ void CalendarView::appointment_show()
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
}
}
@@ -3183,9 +3183,9 @@ void CalendarView::appointment_edit()
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
}
}
@@ -3203,9 +3203,9 @@ void CalendarView::appointment_delete()
Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
if (mViewManager->currentView()->isEventView()) {
- if ( incidence && incidence->type() == "Event" ) {
+ if ( incidence && incidence->typeID() == eventID ) {
anEvent = static_cast<Event *>(incidence);
}
}
@@ -3404,9 +3404,9 @@ void CalendarView::action_mail()
CalendarLocal cal_tmp;
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);
cal_tmp.addEvent(ev);
}
@@ -3449,12 +3449,12 @@ void CalendarView::schedule_publish(Incidence *incidence)
if (incidence == 0) {
incidence = mTodoList->selectedIncidences().first();
}
}
- 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);
}
}
@@ -3564,12 +3564,12 @@ void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
if (incidence == 0) {
incidence = mTodoList->selectedIncidences().first();
}
}
- 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);
}
if (!event && !todo) {
@@ -3771,9 +3771,9 @@ void CalendarView::processIncidenceSelection( Incidence *incidence )
mSelectedIncidence = 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() ) {
emit organizerEventsSelected( true );
} else {
@@ -3786,9 +3786,9 @@ void CalendarView::processIncidenceSelection( Incidence *incidence )
emit groupEventsSelected(false);
}
return;
} else {
- if ( incidence && incidence->type() == "Todo" ) {
+ if ( incidence && incidence->typeID() == todoID ) {
emit todoSelected( true );
Todo *event = static_cast<Todo *>( incidence );
if ( event->organizer() == KOPrefs::instance()->email() ) {
emit organizerEventsSelected( true );
@@ -3809,9 +3809,9 @@ void CalendarView::processIncidenceSelection( Incidence *incidence )
}
return;
}
- /* if ( incidence && incidence->type() == "Todo" ) {
+ /* if ( incidence && incidence->typeID() == todoID ) {
emit todoSelected( true );
} else {
emit todoSelected( false );
}*/
@@ -4064,14 +4064,14 @@ void CalendarView::calendarModified( bool modified, Calendar * )
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 );
}
return 0;
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 2a2acb1..fc213d8 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -752,9 +752,9 @@ void KOAgenda::startItemAction(QPoint viewportPos)
setCursor(sizeAllCursor);
}
} 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 &&
!mActionItem->firstMultiItem()) {
mActionType = RESIZETOP;
@@ -911,9 +911,9 @@ void KOAgenda::endItemAction()
//emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */);
QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
KOAgendaItem *item;
- if ( placeItem->incidence()->type() == "Todo" ) {
+ if ( placeItem->incidence()->typeID() == todoID ) {
mSelectedItem = 0;
//qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth());
modifiedItem->mLastMoveXPos = mCurrentCellX;
emit itemModified( modifiedItem, mActionType );
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index df2e478..5a3c4d2 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -105,9 +105,9 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
mNextMultiItem = 0;
mLastMultiItem = 0;
computeText();
- if ( (incidence->type() == "Todo") &&
+ if ( (incidence->typeID() == todoID ) &&
( !((static_cast<Todo*>(incidence))->isCompleted()) &&
((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
@@ -117,15 +117,15 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
else {
QStringList categories = mIncidence->categories();
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
mBackgroundColor =KOPrefs::instance()->mEventColor;
} 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;
}
}
@@ -358,9 +358,9 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
}
paint->fillRect ( x, yy, w, h, mBackgroundColor );
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 );
int yyy = yy+3;
if ( tempTodo->isCompleted() )
@@ -539,9 +539,9 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
}
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() )
mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
else if ( !(mIncidence->doesFloat()))
@@ -571,9 +571,9 @@ void KOAgendaItem::computeText()
}
#ifdef DESKTOP_VERSION
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();
tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
}
@@ -581,15 +581,15 @@ void KOAgendaItem::computeText()
tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
}
}
- else if ( mIncidence->type() == "Todo" ) {
+ else if ( mIncidence->typeID() == todoID ) {
if (mIncidence->hasStartDate())
tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
if (((Todo*)mIncidence)->hasDueDate())
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();
if (((Todo*)mIncidence)->hasDueDate())
tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 7022e02..be51694 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -399,10 +399,10 @@ void KOListView::setAlarm()
QListViewItem *qitem = mListView->firstChild ();
while ( qitem ) {
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));
} else
sel.append(((KOListViewItem *)qitem));
@@ -487,9 +487,9 @@ void KOListView::setCategories( bool removeOld )
item = sel.first();
if( item ) {
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 ) ),
i18n("Todo has subtodos"),
i18n("Yes"),
@@ -610,9 +610,9 @@ void KOListView::saveDescriptionToFile()
KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
Incidence *incidence = delSel.first();
icount = 0;
while ( incidence ) {
- if ( incidence->type() == "Journal" ) {
+ if ( incidence->typeID() == journalID ) {
text += "\n************************************\n";
text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
@@ -620,9 +620,9 @@ void KOListView::saveDescriptionToFile()
} else {
if ( !incidence->description().isEmpty() ) {
text += "\n************************************\n";
- if ( incidence->type() == "Todo" )
+ if ( incidence->typeID() == todoID )
text += i18n("To-Do: ");
text += incidence->summary();
if ( incidence->hasStartDate() )
text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
@@ -668,9 +668,9 @@ void KOListView::writeToFile( bool iCal )
bool journal = iCal; // warn only for vCal
while ( item ) {
if ( item->isSelected() ) {
if ( !journal )
- if ( ((KOListViewItem *)item)->data()->type() == "Journal")
+ if ( ((KOListViewItem *)item)->data()->typeID() == journalID )
journal = true;
delSel.append(((KOListViewItem *)item)->data());
++icount;
}
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 5aaf360..2602487 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -701,9 +701,9 @@ void KOTodoView::updateView()
bool next = true;
// qDebug("todo %s ", todo->summary().latin1());
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 ) ) )) {
//qDebug("related not found ");
todoList.remove( );
@@ -843,9 +843,9 @@ QMap<Todo *,KOTodoViewItem *>::ConstIterator
// TODO: Check, if dynmaic cast is necessary
pendingSubtodo = 0;
Incidence *incidence = todo->relatedTo();
- if (incidence && incidence->type() == "Todo") {
+ if (incidence && incidence->typeID() == todoID ) {
Todo *relatedTodo = static_cast<Todo *>(incidence);
// kdDebug() << " has Related" << endl;
QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 62d7ede..e8574a0 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -488,16 +488,16 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
}
bool ok = true;
if ( reply ) {
noc = ev->getNextOccurence( cdt, &ok );
- if (! ok && ev->type() == "Event")
+ if (! ok && ev->typeID() == eventID)
return false;
}
bool bDay = false;
if ( ev->isBirthday() || ev->isAnniversary() )
bDay = true;
tempText += "<tr><td><b>";
- if (ev->type()=="Event") {
+ if (ev->typeID() == eventID ) {
if (reply) {
if (!ev->doesFloat())
tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
else
@@ -619,10 +619,10 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
}
if ( ev->cancelled() )
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 )
tempText += ev->summary();
else
@@ -630,9 +630,9 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
if ( bDay ) {
noc = ev->getNextOccurence( cdt.addDays(-1), &ok );
if ( ok ) {
int years = 0;
- if ( ev->type() =="Todo" ) {
+ if ( ev->typeID() == todoID ) {
years = noc.date().year() -((Todo*)ev)->dtDue().date().year();
} else
years = noc.date().year() - ev->dtStart().date().year();
tempText += i18n(" (%1 y.)"). arg( years );
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 53b65b2..481eab4 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1331,13 +1331,13 @@ void MainWindow::exportToPhone( int mode )
Incidence *incidence = delSel.first();
QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
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() )
dt = t->dtDue();
else
@@ -1595,9 +1595,9 @@ 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() ) {
startString += ": "+incidence->dtStartDateStr( true );
startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
@@ -1633,15 +1633,15 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
setCaption( incidence->summary()+startString);
enableIncidenceActions( true );
- if ( incidence->type() == "Event" ) {
+ if ( incidence->typeID() == eventID ) {
mShowAction->setText( i18n("Show Event...") );
mEditAction->setText( i18n("Edit Event...") );
mDeleteAction->setText( i18n("Delete Event...") );
mNewSubTodoAction->setEnabled( false );
- } else if ( incidence->type() == "Todo" ) {
+ } else if ( incidence->typeID() == todoID ) {
mShowAction->setText( i18n("Show Todo...") );
mEditAction->setText( i18n("Edit Todo...") );
mDeleteAction->setText( i18n("Delete Todo...") );
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index ed39ddb..7e8e2c5 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -352,13 +352,13 @@ bool Calendar::addIncidence(Incidence *i)
return i->accept(v);
}
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 );
}
Incidence* Calendar::incidence( const QString& uid )
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index bc76c0b..fe74052 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -457,10 +457,8 @@ 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;
Event *e;
@@ -487,10 +485,8 @@ void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence,
// kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text()
// << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl;
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
@@ -77,13 +77,13 @@ void CalFilter::apply(QPtrList<Todo> *eventlist)
// kdDebug(5800) << "CalFilter::apply() done" << endl;
}
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;
}
bool CalFilter::filterEvent(Event *event)
diff --git a/libkcal/event.h b/libkcal/event.h
index 8729956..287d403 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -39,8 +39,9 @@ class Event : public Incidence
Event(const Event &);
~Event();
QCString type() const { return "Event"; }
+ IncTypeID typeID() const { return eventID; }
Incidence *clone();
QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
diff --git a/libkcal/freebusy.h b/libkcal/freebusy.h
index 054feda..d741c72 100644
--- a/libkcal/freebusy.h
+++ b/libkcal/freebusy.h
@@ -47,8 +47,9 @@ class FreeBusy : public IncidenceBase
~FreeBusy();
QCString type() const { return "FreeBusy"; }
+ IncTypeID typeID() const { return freebusyID; }
virtual QDateTime dtEnd() const;
bool setDtEnd( const QDateTime &end );
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp
index 3a2aac6..d9fe40b 100644
--- a/libkcal/icalformat.cpp
+++ b/libkcal/icalformat.cpp
@@ -383,14 +383,14 @@ ScheduleMessage *ICalFormat::parseScheduleMessage( Calendar *cal,
Incidence *existingIncidence = cal->event(incidence->uid());
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,
mImpl->writeEvent(event));
}
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index 2405682..3e28714 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -2154,17 +2154,17 @@ icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence,
icalcomponent_add_property(message,icalproperty_new_method(icalmethod));
// 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
@@ -235,9 +235,9 @@ Incidence* Incidence::recreateCloneException( QDate d )
newInc->recreate();
if ( doesRecur() ) {
addExDate( d );
newInc->recurrence()->unsetRecurs();
- if ( type() == "Event") {
+ if ( typeID() == eventID ) {
int len = dtStart().secsTo( ((Event*)this)->dtEnd());
QTime tim = dtStart().time();
newInc->setDtStart( QDateTime(d, tim) );
((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
@@ -723,9 +723,9 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
} else {
if ( hasStartDate () ) {
incidenceStart = dtStart();
}
- if ( type() =="Todo" ) {
+ if ( typeID() == todoID ) {
if ( ((Todo*)this)->hasDueDate() )
incidenceStart = ((Todo*)this)->dtDue();
}
}
@@ -735,9 +735,9 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
}
QDateTime Incidence::dtStart() const
{
if ( doesRecur() ) {
- if ( type() == "Todo" ) {
+ if ( typeID() == todoID ) {
((Todo*)this)->checkSetCompletedFalse();
}
}
return mDtStart;
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index 8624786..05209e0 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -33,8 +33,9 @@
namespace KCal {
typedef QValueList<QDate> DateList;
+ enum IncTypeID { eventID,todoID,journalID,freebusyID };
/**
This class provides the base class common to all calendar components.
*/
@@ -50,8 +51,9 @@ class IncidenceBase : public CustomProperties
IncidenceBase(const IncidenceBase &);
virtual ~IncidenceBase();
virtual QCString type() const = 0;
+ virtual IncTypeID typeID() const = 0;
/** Set the unique id for the event */
void setUid(const QString &);
/** Return 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
@@ -36,8 +36,9 @@ class Journal : public Incidence
Journal();
~Journal();
QCString type() const { return "Journal"; }
+ IncTypeID typeID() const { return journalID; }
Incidence *clone();
QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
private:
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 7d61b7f..d1ace4f 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -20,11 +20,11 @@ QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bo
mDetails = details;
mCreated = created ;
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
@@ -129,9 +129,9 @@ void Todo::saveParents()
{
if (!relatedTo() )
return;
Incidence * inc = relatedTo();
- if ( inc->type() != "Todo" )
+ if ( inc->typeID() != todoID )
return;
Todo* to = (Todo*)inc;
bool saveTodo = false;
QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics";
@@ -563,10 +563,11 @@ 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()");
//qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
if ( mPercentComplete == 100 ) {
diff --git a/libkcal/todo.h b/libkcal/todo.h
index ab8fdf1..501c2ba 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -40,8 +40,9 @@ namespace KCal {
Todo(const Todo &);
~Todo();
typedef ListBase<Todo> List;
QCString type() const { return "Todo"; }
+ IncTypeID typeID() const { return todoID; }
/** Return an exact copy of this todo. */
Incidence *clone();
QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const;