summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-08 10:34:22 (UTC)
committer zautrix <zautrix>2005-06-08 10:34:22 (UTC)
commit793d117812b4da36c9c11d90cccba347cbc6e208 (patch) (unidiff)
tree5bc77e2b7a32a541c2a3b3c3d6d50f873216deef /korganizer
parent39d84e2fc3099bd5d7596e8be5dc6783826cec01 (diff)
downloadkdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.zip
kdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.tar.gz
kdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.tar.bz2
changed incidence type to a faster access method
Diffstat (limited to 'korganizer') (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
7 files changed, 59 insertions, 59 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 720ad78..7c7466b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -170,13 +170,13 @@ MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Inciden
170 bool ok; 170 bool ok;
171 dt = inc->getNextOccurence( start, &ok ); 171 dt = inc->getNextOccurence( start, &ok );
172 if ( !ok ) continue; 172 if ( !ok ) continue;
173 if ( inc->type() == "Event" ) { 173 if ( inc->typeID() == eventID ) {
174 tempText += "href=\"event:"; 174 tempText += "href=\"event:";
175 } else if ( inc->type() == "Todo" ) { 175 } else if ( inc->typeID() == todoID ) {
176 tempText += "href=\"todo:"; 176 tempText += "href=\"todo:";
177 } 177 }
178 tempText += inc->uid() + "\">"; 178 tempText += inc->uid() + "\">";
179 if ( inc->type() == "Todo" ) 179 if ( inc->typeID() == todoID )
180 tempText += i18n("Todo: "); 180 tempText += i18n("Todo: ");
181 if ( inc->summary().length() > 0 ) 181 if ( inc->summary().length() > 0 )
182 tempText += inc->summary(); 182 tempText += inc->summary();
@@ -973,12 +973,12 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
973 //full = true; //debug only 973 //full = true; //debug only
974 if ( full ) { 974 if ( full ) {
975 bool equ = false; 975 bool equ = false;
976 if ( local->type() == "Event" ) { 976 if ( local->typeID() == eventID ) {
977 equ = (*((Event*) local) == *((Event*) remote)); 977 equ = (*((Event*) local) == *((Event*) remote));
978 } 978 }
979 else if ( local->type() =="Todo" ) 979 else if ( local->typeID() == todoID )
980 equ = (*((Todo*) local) == (*(Todo*) remote)); 980 equ = (*((Todo*) local) == (*(Todo*) remote));
981 else if ( local->type() =="Journal" ) 981 else if ( local->typeID() == journalID )
982 equ = (*((Journal*) local) == *((Journal*) remote)); 982 equ = (*((Journal*) local) == *((Journal*) remote));
983 if ( equ ) { 983 if ( equ ) {
984 //qDebug("equal "); 984 //qDebug("equal ");
@@ -1099,7 +1099,7 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t
1099 //qDebug(" lastSync.count() == 0"); 1099 //qDebug(" lastSync.count() == 0");
1100 return; 1100 return;
1101 } 1101 }
1102 if ( toDelete->type() == "Journal" ) 1102 if ( toDelete->typeID() == journalID )
1103 return; 1103 return;
1104 1104
1105 Event* eve = lastSync.first(); 1105 Event* eve = lastSync.first();
@@ -1109,7 +1109,7 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t
1109 if ( !id.isEmpty() ) { 1109 if ( !id.isEmpty() ) {
1110 QString des = eve->description(); 1110 QString des = eve->description();
1111 QString pref = "e"; 1111 QString pref = "e";
1112 if ( toDelete->type() == "Todo" ) 1112 if ( toDelete->typeID() == todoID )
1113 pref = "t"; 1113 pref = "t";
1114 des += pref+ id + ","; 1114 des += pref+ id + ",";
1115 eve->setReadOnly( false ); 1115 eve->setReadOnly( false );
@@ -1286,7 +1286,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1286 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1286 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1287 QString des = eventLSync->description(); 1287 QString des = eventLSync->description();
1288 QString pref = "e"; 1288 QString pref = "e";
1289 if ( inR->type() == "Todo" ) 1289 if ( inR->typeID() == todoID )
1290 pref = "t"; 1290 pref = "t";
1291 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1291 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1292 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1292 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
@@ -1343,7 +1343,7 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1343 bool skipIncidence = false; 1343 bool skipIncidence = false;
1344 if ( uid.left(15) == QString("last-syncEvent-") ) 1344 if ( uid.left(15) == QString("last-syncEvent-") )
1345 skipIncidence = true; 1345 skipIncidence = true;
1346 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1346 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID )
1347 skipIncidence = true; 1347 skipIncidence = true;
1348 if ( !skipIncidence ) { 1348 if ( !skipIncidence ) {
1349 inR = remote->incidence( uid ); 1349 inR = remote->incidence( uid );
@@ -1399,14 +1399,14 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1399 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); 1399 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
1400 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); 1400 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
1401 while ( inR ) { 1401 while ( inR ) {
1402 if ( inR->type() == "Todo" ) { 1402 if ( inR->typeID() == todoID ) {
1403 Todo * t = (Todo*)inR; 1403 Todo * t = (Todo*)inR;
1404 if ( t->hasDueDate() ) 1404 if ( t->hasDueDate() )
1405 dt = t->dtDue(); 1405 dt = t->dtDue();
1406 else 1406 else
1407 dt = cur.addSecs( 62 ); 1407 dt = cur.addSecs( 62 );
1408 } 1408 }
1409 else if (inR->type() == "Event" ) { 1409 else if (inR->typeID() == eventID ) {
1410 bool ok; 1410 bool ok;
1411 dt = inR->getNextOccurence( cur, &ok ); 1411 dt = inR->getNextOccurence( cur, &ok );
1412 if ( !ok ) 1412 if ( !ok )
@@ -2477,7 +2477,7 @@ void CalendarView::edit_cut()
2477 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2477 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2478 2478
2479 if (mViewManager->currentView()->isEventView()) { 2479 if (mViewManager->currentView()->isEventView()) {
2480 if ( incidence && incidence->type() == "Event" ) { 2480 if ( incidence && incidence->typeID() == eventID ) {
2481 anEvent = static_cast<Event *>(incidence); 2481 anEvent = static_cast<Event *>(incidence);
2482 } 2482 }
2483 } 2483 }
@@ -2498,7 +2498,7 @@ void CalendarView::edit_copy()
2498 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2498 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2499 2499
2500 if (mViewManager->currentView()->isEventView()) { 2500 if (mViewManager->currentView()->isEventView()) {
2501 if ( incidence && incidence->type() == "Event" ) { 2501 if ( incidence && incidence->typeID() == eventID ) {
2502 anEvent = static_cast<Event *>(incidence); 2502 anEvent = static_cast<Event *>(incidence);
2503 } 2503 }
2504 } 2504 }
@@ -2550,7 +2550,7 @@ void CalendarView::slotSelectPickerDate( QDate d)
2550 if ( mDatePickerMode == 1 ) { 2550 if ( mDatePickerMode == 1 ) {
2551 mNavigator->slotDaySelect( d ); 2551 mNavigator->slotDaySelect( d );
2552 } else if ( mDatePickerMode == 2 ) { 2552 } else if ( mDatePickerMode == 2 ) {
2553 if ( mMoveIncidence->type() == "Todo" ) { 2553 if ( mMoveIncidence->typeID() == todoID ) {
2554 Todo * to = (Todo *) mMoveIncidence; 2554 Todo * to = (Todo *) mMoveIncidence;
2555 QTime tim; 2555 QTime tim;
2556 int len = 0; 2556 int len = 0;
@@ -2581,7 +2581,7 @@ void CalendarView::slotSelectPickerDate( QDate d)
2581 // PENDING implement this 2581 // PENDING implement this
2582 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2582 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2583 mCalendar()->addIncidence( newInc ); 2583 mCalendar()->addIncidence( newInc );
2584 if ( mMoveIncidence->type() == "Todo" ) 2584 if ( mMoveIncidence->typeID() == todoID )
2585 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2585 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2586 else 2586 else
2587 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2587 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
@@ -2767,7 +2767,7 @@ void CalendarView::moveIncidence(Incidence * inc )
2767 mDatePickerMode = 2; 2767 mDatePickerMode = 2;
2768 mMoveIncidence = inc ; 2768 mMoveIncidence = inc ;
2769 QDate da; 2769 QDate da;
2770 if ( mMoveIncidence->type() == "Todo" ) { 2770 if ( mMoveIncidence->typeID() == todoID ) {
2771 Todo * to = (Todo *) mMoveIncidence; 2771 Todo * to = (Todo *) mMoveIncidence;
2772 if ( to->hasDueDate() ) 2772 if ( to->hasDueDate() )
2773 da = to->dtDue().date(); 2773 da = to->dtDue().date();
@@ -2900,7 +2900,7 @@ void CalendarView::cloneIncidence(Incidence * orgInc )
2900 Incidence * newInc = orgInc->clone(); 2900 Incidence * newInc = orgInc->clone();
2901 newInc->recreate(); 2901 newInc->recreate();
2902 2902
2903 if ( newInc->type() == "Todo" ) { 2903 if ( newInc->typeID() == todoID ) {
2904 Todo* t = (Todo*) newInc; 2904 Todo* t = (Todo*) newInc;
2905 bool cloneSub = false; 2905 bool cloneSub = false;
2906 if ( orgInc->relations().count() ) { 2906 if ( orgInc->relations().count() ) {
@@ -3164,7 +3164,7 @@ void CalendarView::appointment_show()
3164 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3164 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3165 3165
3166 if (mViewManager->currentView()->isEventView()) { 3166 if (mViewManager->currentView()->isEventView()) {
3167 if ( incidence && incidence->type() == "Event" ) { 3167 if ( incidence && incidence->typeID() == eventID ) {
3168 anEvent = static_cast<Event *>(incidence); 3168 anEvent = static_cast<Event *>(incidence);
3169 } 3169 }
3170 } 3170 }
@@ -3184,7 +3184,7 @@ void CalendarView::appointment_edit()
3184 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3184 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3185 3185
3186 if (mViewManager->currentView()->isEventView()) { 3186 if (mViewManager->currentView()->isEventView()) {
3187 if ( incidence && incidence->type() == "Event" ) { 3187 if ( incidence && incidence->typeID() == eventID ) {
3188 anEvent = static_cast<Event *>(incidence); 3188 anEvent = static_cast<Event *>(incidence);
3189 } 3189 }
3190 } 3190 }
@@ -3204,7 +3204,7 @@ void CalendarView::appointment_delete()
3204 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 3204 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
3205 3205
3206 if (mViewManager->currentView()->isEventView()) { 3206 if (mViewManager->currentView()->isEventView()) {
3207 if ( incidence && incidence->type() == "Event" ) { 3207 if ( incidence && incidence->typeID() == eventID ) {
3208 anEvent = static_cast<Event *>(incidence); 3208 anEvent = static_cast<Event *>(incidence);
3209 } 3209 }
3210 } 3210 }
@@ -3405,7 +3405,7 @@ void CalendarView::action_mail()
3405 CalendarLocal cal_tmp; 3405 CalendarLocal cal_tmp;
3406 Event *event = 0; 3406 Event *event = 0;
3407 Event *ev = 0; 3407 Event *ev = 0;
3408 if ( incidence && incidence->type() == "Event" ) { 3408 if ( incidence && incidence->typeID() == eventID ) {
3409 event = static_cast<Event *>(incidence); 3409 event = static_cast<Event *>(incidence);
3410 ev = new Event(*event); 3410 ev = new Event(*event);
3411 cal_tmp.addEvent(ev); 3411 cal_tmp.addEvent(ev);
@@ -3450,10 +3450,10 @@ void CalendarView::schedule_publish(Incidence *incidence)
3450 incidence = mTodoList->selectedIncidences().first(); 3450 incidence = mTodoList->selectedIncidences().first();
3451 } 3451 }
3452 } 3452 }
3453 if ( incidence && incidence->type() == "Event" ) { 3453 if ( incidence && incidence->typeID() == eventID ) {
3454 event = static_cast<Event *>(incidence); 3454 event = static_cast<Event *>(incidence);
3455 } else { 3455 } else {
3456 if ( incidence && incidence->type() == "Todo" ) { 3456 if ( incidence && incidence->typeID() == todoID ) {
3457 todo = static_cast<Todo *>(incidence); 3457 todo = static_cast<Todo *>(incidence);
3458 } 3458 }
3459 } 3459 }
@@ -3565,10 +3565,10 @@ void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3565 incidence = mTodoList->selectedIncidences().first(); 3565 incidence = mTodoList->selectedIncidences().first();
3566 } 3566 }
3567 } 3567 }
3568 if ( incidence && incidence->type() == "Event" ) { 3568 if ( incidence && incidence->typeID() == eventID ) {
3569 event = static_cast<Event *>(incidence); 3569 event = static_cast<Event *>(incidence);
3570 } 3570 }
3571 if ( incidence && incidence->type() == "Todo" ) { 3571 if ( incidence && incidence->typeID() == todoID ) {
3572 todo = static_cast<Todo *>(incidence); 3572 todo = static_cast<Todo *>(incidence);
3573 } 3573 }
3574 3574
@@ -3772,7 +3772,7 @@ void CalendarView::processIncidenceSelection( Incidence *incidence )
3772 3772
3773 emit incidenceSelected( mSelectedIncidence ); 3773 emit incidenceSelected( mSelectedIncidence );
3774 3774
3775 if ( incidence && incidence->type() == "Event" ) { 3775 if ( incidence && incidence->typeID() == eventID ) {
3776 Event *event = static_cast<Event *>( incidence ); 3776 Event *event = static_cast<Event *>( incidence );
3777 if ( event->organizer() == KOPrefs::instance()->email() ) { 3777 if ( event->organizer() == KOPrefs::instance()->email() ) {
3778 emit organizerEventsSelected( true ); 3778 emit organizerEventsSelected( true );
@@ -3787,7 +3787,7 @@ void CalendarView::processIncidenceSelection( Incidence *incidence )
3787 } 3787 }
3788 return; 3788 return;
3789 } else { 3789 } else {
3790 if ( incidence && incidence->type() == "Todo" ) { 3790 if ( incidence && incidence->typeID() == todoID ) {
3791 emit todoSelected( true ); 3791 emit todoSelected( true );
3792 Todo *event = static_cast<Todo *>( incidence ); 3792 Todo *event = static_cast<Todo *>( incidence );
3793 if ( event->organizer() == KOPrefs::instance()->email() ) { 3793 if ( event->organizer() == KOPrefs::instance()->email() ) {
@@ -3810,7 +3810,7 @@ void CalendarView::processIncidenceSelection( Incidence *incidence )
3810 return; 3810 return;
3811 } 3811 }
3812 3812
3813 /* if ( incidence && incidence->type() == "Todo" ) { 3813 /* if ( incidence && incidence->typeID() == todoID ) {
3814 emit todoSelected( true ); 3814 emit todoSelected( true );
3815 } else { 3815 } else {
3816 emit todoSelected( false ); 3816 emit todoSelected( false );
@@ -4065,12 +4065,12 @@ void CalendarView::calendarModified( bool modified, Calendar * )
4065Todo *CalendarView::selectedTodo() 4065Todo *CalendarView::selectedTodo()
4066{ 4066{
4067 Incidence *incidence = currentSelection(); 4067 Incidence *incidence = currentSelection();
4068 if ( incidence && incidence->type() == "Todo" ) { 4068 if ( incidence && incidence->typeID() == todoID ) {
4069 return static_cast<Todo *>( incidence ); 4069 return static_cast<Todo *>( incidence );
4070 } 4070 }
4071 4071
4072 incidence = mTodoList->selectedIncidences().first(); 4072 incidence = mTodoList->selectedIncidences().first();
4073 if ( incidence && incidence->type() == "Todo" ) { 4073 if ( incidence && incidence->typeID() == todoID ) {
4074 return static_cast<Todo *>( incidence ); 4074 return static_cast<Todo *>( incidence );
4075 } 4075 }
4076 4076
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 2a2acb1..fc213d8 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -753,7 +753,7 @@ void KOAgenda::startItemAction(QPoint viewportPos)
753 } 753 }
754 } else { 754 } else {
755 int gridDistanceY = (y - gy * mGridSpacingY); 755 int gridDistanceY = (y - gy * mGridSpacingY);
756 bool allowResize = ( mActionItem->incidence()->type() != "Todo" ); 756 bool allowResize = ( mActionItem->incidence()->typeID() != todoID );
757 if (allowResize && gridDistanceY < mResizeBorderWidth && 757 if (allowResize && gridDistanceY < mResizeBorderWidth &&
758 mActionItem->cellYTop() == mCurrentCellY && 758 mActionItem->cellYTop() == mCurrentCellY &&
759 !mActionItem->firstMultiItem()) { 759 !mActionItem->firstMultiItem()) {
@@ -912,7 +912,7 @@ void KOAgenda::endItemAction()
912 QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); 912 QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
913 KOAgendaItem *item; 913 KOAgendaItem *item;
914 914
915 if ( placeItem->incidence()->type() == "Todo" ) { 915 if ( placeItem->incidence()->typeID() == todoID ) {
916 mSelectedItem = 0; 916 mSelectedItem = 0;
917 //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); 917 //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth());
918 modifiedItem->mLastMoveXPos = mCurrentCellX; 918 modifiedItem->mLastMoveXPos = mCurrentCellX;
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index df2e478..5a3c4d2 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -106,7 +106,7 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
106 mLastMultiItem = 0; 106 mLastMultiItem = 0;
107 computeText(); 107 computeText();
108 108
109 if ( (incidence->type() == "Todo") && 109 if ( (incidence->typeID() == todoID ) &&
110 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 110 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
@@ -118,13 +118,13 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
118 QStringList categories = mIncidence->categories(); 118 QStringList categories = mIncidence->categories();
119 QString cat = categories.first(); 119 QString cat = categories.first();
120 if (cat.isEmpty()) { 120 if (cat.isEmpty()) {
121 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) 121 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) )
122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
123 else 123 else
124 mBackgroundColor =KOPrefs::instance()->mEventColor; 124 mBackgroundColor =KOPrefs::instance()->mEventColor;
125 } else { 125 } else {
126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
127 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 127 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
129 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 129 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
130 } 130 }
@@ -359,7 +359,7 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
359 paint->fillRect ( x, yy, w, h, mBackgroundColor ); 359 paint->fillRect ( x, yy, w, h, mBackgroundColor );
360 static const QPixmap completedPxmp = SmallIcon("greenhook16"); 360 static const QPixmap completedPxmp = SmallIcon("greenhook16");
361 static const QPixmap overduePxmp = SmallIcon("redcross16"); 361 static const QPixmap overduePxmp = SmallIcon("redcross16");
362 if ( mIncidence->type() == "Todo" ) { 362 if ( mIncidence->typeID() == todoID ) {
363 Todo* tempTodo = static_cast<Todo*>(mIncidence); 363 Todo* tempTodo = static_cast<Todo*>(mIncidence);
364 int xx = pos().x()+(width()-completedPxmp.width()-3 ); 364 int xx = pos().x()+(width()-completedPxmp.width()-3 );
365 int yyy = yy+3; 365 int yyy = yy+3;
@@ -540,7 +540,7 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
540void KOAgendaItem::computeText() 540void KOAgendaItem::computeText()
541{ 541{
542 mDisplayedText = mIncidence->summary(); 542 mDisplayedText = mIncidence->summary();
543 if ( (mIncidence->type() == "Todo") ) { 543 if ( (mIncidence->typeID() == todoID ) ) {
544 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { 544 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
545 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 545 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
546 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 546 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
@@ -572,7 +572,7 @@ void KOAgendaItem::computeText()
572#ifdef DESKTOP_VERSION 572#ifdef DESKTOP_VERSION
573 QString tipText = mIncidence->summary(); 573 QString tipText = mIncidence->summary();
574 if ( !mIncidence->doesFloat() ) { 574 if ( !mIncidence->doesFloat() ) {
575 if ( mIncidence->type() == "Event" ) { 575 if ( mIncidence->typeID() == eventID ) {
576 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 576 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
577 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 577 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
578 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 578 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
@@ -582,13 +582,13 @@ void KOAgendaItem::computeText()
582 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 582 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
583 } 583 }
584 } 584 }
585 else if ( mIncidence->type() == "Todo" ) { 585 else if ( mIncidence->typeID() == todoID ) {
586 if (mIncidence->hasStartDate()) 586 if (mIncidence->hasStartDate())
587 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); 587 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
588 if (((Todo*)mIncidence)->hasDueDate()) 588 if (((Todo*)mIncidence)->hasDueDate())
589 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); 589 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
590 } 590 }
591 } else if ( mIncidence->type() == "Todo" ) { 591 } else if ( mIncidence->typeID() == todoID ) {
592 if (mIncidence->hasStartDate()) 592 if (mIncidence->hasStartDate())
593 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); 593 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
594 if (((Todo*)mIncidence)->hasDueDate()) 594 if (((Todo*)mIncidence)->hasDueDate())
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 7022e02..be51694 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -400,8 +400,8 @@ void KOListView::setAlarm()
400 while ( qitem ) { 400 while ( qitem ) {
401 if ( qitem->isSelected() ) { 401 if ( qitem->isSelected() ) {
402 Incidence* inc = ((KOListViewItem *) qitem)->data(); 402 Incidence* inc = ((KOListViewItem *) qitem)->data();
403 if ( inc->type() != "Journal" ) { 403 if ( inc->typeID() != journalID ) {
404 if ( inc->type() == "Todo" ) { 404 if ( inc->typeID() == todoID ) {
405 if ( ((Todo*)inc)->hasDueDate() ) 405 if ( ((Todo*)inc)->hasDueDate() )
406 sel.append(((KOListViewItem *)qitem)); 406 sel.append(((KOListViewItem *)qitem));
407 } else 407 } else
@@ -488,7 +488,7 @@ void KOListView::setCategories( bool removeOld )
488 if( item ) { 488 if( item ) {
489 Incidence* inc = item->data() ; 489 Incidence* inc = item->data() ;
490 bool setSub = false; 490 bool setSub = false;
491 if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) { 491 if( inc->typeID() == todoID && sel.count() == 1 && inc->relations().count() > 0 ) {
492 int result = KMessageBox::warningYesNoCancel(this, 492 int result = KMessageBox::warningYesNoCancel(this,
493 i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), 493 i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ),
494 i18n("Todo has subtodos"), 494 i18n("Todo has subtodos"),
@@ -611,7 +611,7 @@ void KOListView::saveDescriptionToFile()
611 Incidence *incidence = delSel.first(); 611 Incidence *incidence = delSel.first();
612 icount = 0; 612 icount = 0;
613 while ( incidence ) { 613 while ( incidence ) {
614 if ( incidence->type() == "Journal" ) { 614 if ( incidence->typeID() == journalID ) {
615 text += "\n************************************\n"; 615 text += "\n************************************\n";
616 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 616 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
617 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 617 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
@@ -621,7 +621,7 @@ void KOListView::saveDescriptionToFile()
621 } else { 621 } else {
622 if ( !incidence->description().isEmpty() ) { 622 if ( !incidence->description().isEmpty() ) {
623 text += "\n************************************\n"; 623 text += "\n************************************\n";
624 if ( incidence->type() == "Todo" ) 624 if ( incidence->typeID() == todoID )
625 text += i18n("To-Do: "); 625 text += i18n("To-Do: ");
626 text += incidence->summary(); 626 text += incidence->summary();
627 if ( incidence->hasStartDate() ) 627 if ( incidence->hasStartDate() )
@@ -669,7 +669,7 @@ void KOListView::writeToFile( bool iCal )
669 while ( item ) { 669 while ( item ) {
670 if ( item->isSelected() ) { 670 if ( item->isSelected() ) {
671 if ( !journal ) 671 if ( !journal )
672 if ( ((KOListViewItem *)item)->data()->type() == "Journal") 672 if ( ((KOListViewItem *)item)->data()->typeID() == journalID )
673 journal = true; 673 journal = true;
674 delSel.append(((KOListViewItem *)item)->data()); 674 delSel.append(((KOListViewItem *)item)->data());
675 ++icount; 675 ++icount;
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 5aaf360..2602487 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -702,7 +702,7 @@ void KOTodoView::updateView()
702 // qDebug("todo %s ", todo->summary().latin1()); 702 // qDebug("todo %s ", todo->summary().latin1());
703 Incidence *incidence = todo->relatedTo(); 703 Incidence *incidence = todo->relatedTo();
704 while ( incidence ) { 704 while ( incidence ) {
705 if ( incidence->type() == "Todo") { 705 if ( incidence->typeID() == todoID ) {
706 //qDebug("related %s ",incidence->summary().latin1() ); 706 //qDebug("related %s ",incidence->summary().latin1() );
707 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { 707 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
708 //qDebug("related not found "); 708 //qDebug("related not found ");
@@ -844,7 +844,7 @@ QMap<Todo *,KOTodoViewItem *>::ConstIterator
844 844
845 pendingSubtodo = 0; 845 pendingSubtodo = 0;
846 Incidence *incidence = todo->relatedTo(); 846 Incidence *incidence = todo->relatedTo();
847 if (incidence && incidence->type() == "Todo") { 847 if (incidence && incidence->typeID() == todoID ) {
848 Todo *relatedTodo = static_cast<Todo *>(incidence); 848 Todo *relatedTodo = static_cast<Todo *>(incidence);
849 849
850// kdDebug() << " has Related" << endl; 850// kdDebug() << " has Related" << endl;
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 62d7ede..e8574a0 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -489,14 +489,14 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
489 bool ok = true; 489 bool ok = true;
490 if ( reply ) { 490 if ( reply ) {
491 noc = ev->getNextOccurence( cdt, &ok ); 491 noc = ev->getNextOccurence( cdt, &ok );
492 if (! ok && ev->type() == "Event") 492 if (! ok && ev->typeID() == eventID)
493 return false; 493 return false;
494 } 494 }
495 bool bDay = false; 495 bool bDay = false;
496 if ( ev->isBirthday() || ev->isAnniversary() ) 496 if ( ev->isBirthday() || ev->isAnniversary() )
497 bDay = true; 497 bDay = true;
498 tempText += "<tr><td><b>"; 498 tempText += "<tr><td><b>";
499 if (ev->type()=="Event") { 499 if (ev->typeID() == eventID ) {
500 if (reply) { 500 if (reply) {
501 if (!ev->doesFloat()) 501 if (!ev->doesFloat())
502 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; 502 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
@@ -620,8 +620,8 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
620 if ( ev->cancelled() ) 620 if ( ev->cancelled() )
621 tempText += "</font>"; 621 tempText += "</font>";
622 tempText += "<a "; 622 tempText += "<a ";
623 if (ev->type()=="Event") tempText += "href=\"event:"; 623 if (ev->typeID() == eventID ) tempText += "href=\"event:";
624 if (ev->type()=="Todo") tempText += "href=\"todo:"; 624 if (ev->typeID() == todoID ) tempText += "href=\"todo:";
625 tempText += ev->uid() + "\">"; 625 tempText += ev->uid() + "\">";
626 if ( ev->summary().length() > 0 ) 626 if ( ev->summary().length() > 0 )
627 tempText += ev->summary(); 627 tempText += ev->summary();
@@ -631,7 +631,7 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a
631 noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); 631 noc = ev->getNextOccurence( cdt.addDays(-1), &ok );
632 if ( ok ) { 632 if ( ok ) {
633 int years = 0; 633 int years = 0;
634 if ( ev->type() =="Todo" ) { 634 if ( ev->typeID() == todoID ) {
635 years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); 635 years = noc.date().year() -((Todo*)ev)->dtDue().date().year();
636 } else 636 } else
637 years = noc.date().year() - ev->dtStart().date().year(); 637 years = noc.date().year() - ev->dtStart().date().year();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 53b65b2..481eab4 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1332,11 +1332,11 @@ void MainWindow::exportToPhone( int mode )
1332 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1332 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1333 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1333 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1334 while ( incidence ) { 1334 while ( incidence ) {
1335 if ( incidence->type() != "Journal" ) { 1335 if ( incidence->typeID() != journalID ) {
1336 bool add = true; 1336 bool add = true;
1337 if ( inFuture ) { 1337 if ( inFuture ) {
1338 QDateTime dt; 1338 QDateTime dt;
1339 if ( incidence->type() == "Todo" ) { 1339 if ( incidence->typeID() == todoID ) {
1340 Todo * t = (Todo*)incidence; 1340 Todo * t = (Todo*)incidence;
1341 if ( t->hasDueDate() ) 1341 if ( t->hasDueDate() )
1342 dt = t->dtDue(); 1342 dt = t->dtDue();
@@ -1596,7 +1596,7 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
1596 1596
1597 //KGlobal::locale()->formatDateTime(nextA, true); 1597 //KGlobal::locale()->formatDateTime(nextA, true);
1598 QString startString = ""; 1598 QString startString = "";
1599 if ( incidence->type() != "Todo" ) { 1599 if ( incidence->typeID() != todoID ) {
1600 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1600 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1601 if ( incidence->doesFloat() ) { 1601 if ( incidence->doesFloat() ) {
1602 startString += ": "+incidence->dtStartDateStr( true ); 1602 startString += ": "+incidence->dtStartDateStr( true );
@@ -1634,13 +1634,13 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
1634 1634
1635 enableIncidenceActions( true ); 1635 enableIncidenceActions( true );
1636 1636
1637 if ( incidence->type() == "Event" ) { 1637 if ( incidence->typeID() == eventID ) {
1638 mShowAction->setText( i18n("Show Event...") ); 1638 mShowAction->setText( i18n("Show Event...") );
1639 mEditAction->setText( i18n("Edit Event...") ); 1639 mEditAction->setText( i18n("Edit Event...") );
1640 mDeleteAction->setText( i18n("Delete Event...") ); 1640 mDeleteAction->setText( i18n("Delete Event...") );
1641 1641
1642 mNewSubTodoAction->setEnabled( false ); 1642 mNewSubTodoAction->setEnabled( false );
1643 } else if ( incidence->type() == "Todo" ) { 1643 } else if ( incidence->typeID() == todoID ) {
1644 mShowAction->setText( i18n("Show Todo...") ); 1644 mShowAction->setText( i18n("Show Todo...") );
1645 mEditAction->setText( i18n("Edit Todo...") ); 1645 mEditAction->setText( i18n("Edit Todo...") );
1646 mDeleteAction->setText( i18n("Delete Todo...") ); 1646 mDeleteAction->setText( i18n("Delete Todo...") );