author | zautrix <zautrix> | 2005-06-08 10:34:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-08 10:34:22 (UTC) |
commit | 793d117812b4da36c9c11d90cccba347cbc6e208 (patch) (unidiff) | |
tree | 5bc77e2b7a32a541c2a3b3c3d6d50f873216deef | |
parent | 39d84e2fc3099bd5d7596e8be5dc6783826cec01 (diff) | |
download | kdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.zip kdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.tar.gz kdepimpi-793d117812b4da36c9c11d90cccba347cbc6e208.tar.bz2 |
changed incidence type to a faster access method
-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 | |||
@@ -167,19 +167,19 @@ MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Inciden | |||
167 | while ( inc ) { | 167 | while ( inc ) { |
168 | QDateTime dt ; | 168 | QDateTime dt ; |
169 | QString tempText = "<a "; | 169 | QString tempText = "<a "; |
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(); |
183 | else | 183 | else |
184 | tempText += i18n("-no summary-"); | 184 | tempText += i18n("-no summary-"); |
185 | QString timestr; | 185 | QString timestr; |
@@ -970,18 +970,18 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
970 | 970 | ||
971 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); | 971 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); |
972 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); | 972 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); |
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 "); |
985 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 985 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
986 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 986 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
987 | } | 987 | } |
@@ -1096,23 +1096,23 @@ Event* CalendarView::getLastSyncEvent() | |||
1096 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 1096 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
1097 | { | 1097 | { |
1098 | if ( lastSync.count() == 0 ) { | 1098 | if ( lastSync.count() == 0 ) { |
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(); |
1106 | 1106 | ||
1107 | while ( eve ) { | 1107 | while ( eve ) { |
1108 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 1108 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
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 ); |
1116 | eve->setDescription( des ); | 1116 | eve->setDescription( des ); |
1117 | //qDebug("setdes %s ", des.latin1()); | 1117 | //qDebug("setdes %s ", des.latin1()); |
1118 | eve->setReadOnly( true ); | 1118 | eve->setReadOnly( true ); |
@@ -1283,13 +1283,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1283 | } | 1283 | } |
1284 | } else { // no conflict ********** add or delete remote | 1284 | } else { // no conflict ********** add or delete remote |
1285 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ | 1285 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ |
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 ); |
1293 | //remote->deleteIncidence( inR ); | 1293 | //remote->deleteIncidence( inR ); |
1294 | ++deletedEventR; | 1294 | ++deletedEventR; |
1295 | } else { | 1295 | } else { |
@@ -1340,13 +1340,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1340 | bar.setProgress( incCounter ); | 1340 | bar.setProgress( incCounter ); |
1341 | ++incCounter; | 1341 | ++incCounter; |
1342 | uid = inL->uid(); | 1342 | uid = inL->uid(); |
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 ); |
1350 | if ( ! inR ) { | 1350 | if ( ! inR ) { |
1351 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ | 1351 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ |
1352 | // no conflict ********** add or delete local | 1352 | // no conflict ********** add or delete local |
@@ -1396,20 +1396,20 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1396 | remRem = er.count(); | 1396 | remRem = er.count(); |
1397 | inR = er.first(); | 1397 | inR = er.first(); |
1398 | QDateTime dt; | 1398 | QDateTime dt; |
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 ) |
1413 | dt = cur.addSecs( -62 ); | 1413 | dt = cur.addSecs( -62 ); |
1414 | } | 1414 | } |
1415 | else | 1415 | else |
@@ -2474,13 +2474,13 @@ void CalendarView::edit_cut() | |||
2474 | { | 2474 | { |
2475 | Event *anEvent=0; | 2475 | Event *anEvent=0; |
2476 | 2476 | ||
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 | } |
2484 | 2484 | ||
2485 | if (!anEvent) { | 2485 | if (!anEvent) { |
2486 | KNotifyClient::beep(); | 2486 | KNotifyClient::beep(); |
@@ -2495,13 +2495,13 @@ void CalendarView::edit_copy() | |||
2495 | { | 2495 | { |
2496 | Event *anEvent=0; | 2496 | Event *anEvent=0; |
2497 | 2497 | ||
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 | } |
2505 | 2505 | ||
2506 | if (!anEvent) { | 2506 | if (!anEvent) { |
2507 | KNotifyClient::beep(); | 2507 | KNotifyClient::beep(); |
@@ -2547,13 +2547,13 @@ void CalendarView::edit_options() | |||
2547 | void CalendarView::slotSelectPickerDate( QDate d) | 2547 | void CalendarView::slotSelectPickerDate( QDate d) |
2548 | { | 2548 | { |
2549 | mDateFrame->hide(); | 2549 | mDateFrame->hide(); |
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; |
2557 | if ( to->hasStartDate() && to->hasDueDate() ) | 2557 | if ( to->hasStartDate() && to->hasDueDate() ) |
2558 | len = to->dtStart().secsTo( to->dtDue()); | 2558 | len = to->dtStart().secsTo( to->dtDue()); |
2559 | if ( to->hasDueDate() ) | 2559 | if ( to->hasDueDate() ) |
@@ -2578,13 +2578,13 @@ void CalendarView::slotSelectPickerDate( QDate d) | |||
2578 | } else { | 2578 | } else { |
2579 | if ( mMoveIncidence->doesRecur() ) { | 2579 | if ( mMoveIncidence->doesRecur() ) { |
2580 | #if 0 | 2580 | #if 0 |
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); |
2588 | mMoveIncidence = newInc; | 2588 | mMoveIncidence = newInc; |
2589 | 2589 | ||
2590 | #endif | 2590 | #endif |
@@ -2764,13 +2764,13 @@ void CalendarView::moveIncidence(Incidence * inc ) | |||
2764 | { | 2764 | { |
2765 | if ( !inc ) return; | 2765 | if ( !inc ) return; |
2766 | showDatePickerPopup(); | 2766 | showDatePickerPopup(); |
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(); |
2774 | else | 2774 | else |
2775 | da = QDate::currentDate(); | 2775 | da = QDate::currentDate(); |
2776 | } else { | 2776 | } else { |
@@ -2897,13 +2897,13 @@ void CalendarView::cancelIncidence(Incidence * inc ) | |||
2897 | } | 2897 | } |
2898 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2898 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2899 | { | 2899 | { |
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() ) { |
2907 | int result = KMessageBox::warningYesNoCancel(this, | 2907 | int result = KMessageBox::warningYesNoCancel(this, |
2908 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), | 2908 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), |
2909 | i18n("Todo has subtodos"), | 2909 | i18n("Todo has subtodos"), |
@@ -3161,13 +3161,13 @@ void CalendarView::appointment_show() | |||
3161 | { | 3161 | { |
3162 | Event *anEvent = 0; | 3162 | Event *anEvent = 0; |
3163 | 3163 | ||
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 | } |
3171 | 3171 | ||
3172 | if (!anEvent) { | 3172 | if (!anEvent) { |
3173 | KNotifyClient::beep(); | 3173 | KNotifyClient::beep(); |
@@ -3181,13 +3181,13 @@ void CalendarView::appointment_edit() | |||
3181 | { | 3181 | { |
3182 | Event *anEvent = 0; | 3182 | Event *anEvent = 0; |
3183 | 3183 | ||
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 | } |
3191 | 3191 | ||
3192 | if (!anEvent) { | 3192 | if (!anEvent) { |
3193 | KNotifyClient::beep(); | 3193 | KNotifyClient::beep(); |
@@ -3201,13 +3201,13 @@ void CalendarView::appointment_delete() | |||
3201 | { | 3201 | { |
3202 | Event *anEvent = 0; | 3202 | Event *anEvent = 0; |
3203 | 3203 | ||
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 | } |
3211 | 3211 | ||
3212 | if (!anEvent) { | 3212 | if (!anEvent) { |
3213 | KNotifyClient::beep(); | 3213 | KNotifyClient::beep(); |
@@ -3402,13 +3402,13 @@ void CalendarView::action_mail() | |||
3402 | return; | 3402 | return; |
3403 | } | 3403 | } |
3404 | 3404 | ||
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); |
3412 | } | 3412 | } |
3413 | ICalFormat mForm(); | 3413 | ICalFormat mForm(); |
3414 | QString attachment = mForm.toString( &cal_tmp ); | 3414 | QString attachment = mForm.toString( &cal_tmp ); |
@@ -3447,16 +3447,16 @@ void CalendarView::schedule_publish(Incidence *incidence) | |||
3447 | if (incidence == 0) { | 3447 | if (incidence == 0) { |
3448 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3448 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3449 | if (incidence == 0) { | 3449 | if (incidence == 0) { |
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 | } |
3460 | 3460 | ||
3461 | if (!event && !todo) { | 3461 | if (!event && !todo) { |
3462 | KMessageBox::sorry(this,i18n("No event selected.")); | 3462 | KMessageBox::sorry(this,i18n("No event selected.")); |
@@ -3562,16 +3562,16 @@ void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) | |||
3562 | if (incidence == 0) { | 3562 | if (incidence == 0) { |
3563 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3563 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3564 | if (incidence == 0) { | 3564 | if (incidence == 0) { |
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 | ||
3575 | if (!event && !todo) { | 3575 | if (!event && !todo) { |
3576 | KMessageBox::sorry(this,i18n("No event selected.")); | 3576 | KMessageBox::sorry(this,i18n("No event selected.")); |
3577 | return; | 3577 | return; |
@@ -3769,13 +3769,13 @@ void CalendarView::processIncidenceSelection( Incidence *incidence ) | |||
3769 | if ( incidence == mSelectedIncidence ) return; | 3769 | if ( incidence == mSelectedIncidence ) return; |
3770 | 3770 | ||
3771 | mSelectedIncidence = incidence; | 3771 | mSelectedIncidence = 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 ); |
3779 | } else { | 3779 | } else { |
3780 | emit organizerEventsSelected(false); | 3780 | emit organizerEventsSelected(false); |
3781 | } | 3781 | } |
@@ -3784,13 +3784,13 @@ void CalendarView::processIncidenceSelection( Incidence *incidence ) | |||
3784 | emit groupEventsSelected( true ); | 3784 | emit groupEventsSelected( true ); |
3785 | } else { | 3785 | } else { |
3786 | emit groupEventsSelected(false); | 3786 | emit groupEventsSelected(false); |
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() ) { |
3794 | emit organizerEventsSelected( true ); | 3794 | emit organizerEventsSelected( true ); |
3795 | } else { | 3795 | } else { |
3796 | emit organizerEventsSelected(false); | 3796 | emit organizerEventsSelected(false); |
@@ -3807,13 +3807,13 @@ void CalendarView::processIncidenceSelection( Incidence *incidence ) | |||
3807 | emit organizerEventsSelected(false); | 3807 | emit organizerEventsSelected(false); |
3808 | emit groupEventsSelected(false); | 3808 | emit groupEventsSelected(false); |
3809 | } | 3809 | } |
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 ); |
3817 | }*/ | 3817 | }*/ |
3818 | } | 3818 | } |
3819 | 3819 | ||
@@ -4062,18 +4062,18 @@ void CalendarView::calendarModified( bool modified, Calendar * ) | |||
4062 | setModified( modified ); | 4062 | setModified( modified ); |
4063 | } | 4063 | } |
4064 | 4064 | ||
4065 | Todo *CalendarView::selectedTodo() | 4065 | Todo *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 | ||
4077 | return 0; | 4077 | return 0; |
4078 | } | 4078 | } |
4079 | 4079 | ||
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 2a2acb1..fc213d8 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -750,13 +750,13 @@ void KOAgenda::startItemAction(QPoint viewportPos) | |||
750 | mActionType = MOVE; | 750 | mActionType = MOVE; |
751 | mActionItem->startMove(); | 751 | mActionItem->startMove(); |
752 | setCursor(sizeAllCursor); | 752 | setCursor(sizeAllCursor); |
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()) { |
760 | mActionType = RESIZETOP; | 760 | mActionType = RESIZETOP; |
761 | setCursor(sizeVerCursor); | 761 | setCursor(sizeVerCursor); |
762 | } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && | 762 | } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && |
@@ -909,13 +909,13 @@ void KOAgenda::endItemAction() | |||
909 | type = -1; | 909 | type = -1; |
910 | KOAgendaItem *modifiedItem = placeItem; | 910 | KOAgendaItem *modifiedItem = placeItem; |
911 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); | 911 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); |
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; |
919 | emit itemModified( modifiedItem, mActionType ); | 919 | emit itemModified( modifiedItem, mActionType ); |
920 | } | 920 | } |
921 | else { | 921 | else { |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index df2e478..5a3c4d2 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -103,31 +103,31 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | |||
103 | mDate = qd; | 103 | mDate = qd; |
104 | mFirstMultiItem = 0; | 104 | mFirstMultiItem = 0; |
105 | mNextMultiItem = 0; | 105 | mNextMultiItem = 0; |
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()) |
113 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 113 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
114 | else | 114 | else |
115 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 115 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
116 | } | 116 | } |
117 | else { | 117 | else { |
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 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | } | 133 | } |
@@ -356,13 +356,13 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | |||
356 | f.setPointSize( nfh ); | 356 | f.setPointSize( nfh ); |
357 | paint->setFont(f); | 357 | paint->setFont(f); |
358 | } | 358 | } |
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; |
366 | if ( tempTodo->isCompleted() ) | 366 | if ( tempTodo->isCompleted() ) |
367 | paint->drawPixmap ( xx, yyy, completedPxmp ); | 367 | paint->drawPixmap ( xx, yyy, completedPxmp ); |
368 | else { | 368 | else { |
@@ -537,13 +537,13 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e ) | |||
537 | //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); | 537 | //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); |
538 | bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); | 538 | bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); |
539 | } | 539 | } |
540 | void KOAgendaItem::computeText() | 540 | void 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)+")"; |
547 | else if ( !(mIncidence->doesFloat())) | 547 | else if ( !(mIncidence->doesFloat())) |
548 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; | 548 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; |
549 | } | 549 | } |
@@ -569,29 +569,29 @@ void KOAgendaItem::computeText() | |||
569 | mDisplayedText += "\n("; | 569 | mDisplayedText += "\n("; |
570 | mDisplayedText += mIncidence->location() +")"; | 570 | mDisplayedText += mIncidence->location() +")"; |
571 | } | 571 | } |
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(); |
579 | } | 579 | } |
580 | else { | 580 | else { |
581 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); | 581 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); |
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()) |
595 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); | 595 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); |
596 | } | 596 | } |
597 | 597 | ||
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 7022e02..be51694 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -397,14 +397,14 @@ void KOListView::setAlarm() | |||
397 | QStringList itemList; | 397 | QStringList itemList; |
398 | QPtrList<KOListViewItem> sel ; | 398 | QPtrList<KOListViewItem> sel ; |
399 | QListViewItem *qitem = mListView->firstChild (); | 399 | QListViewItem *qitem = mListView->firstChild (); |
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 |
408 | sel.append(((KOListViewItem *)qitem)); | 408 | sel.append(((KOListViewItem *)qitem)); |
409 | } | 409 | } |
410 | } | 410 | } |
@@ -485,13 +485,13 @@ void KOListView::setCategories( bool removeOld ) | |||
485 | } | 485 | } |
486 | KOListViewItem * item, *temp; | 486 | KOListViewItem * item, *temp; |
487 | item = sel.first(); | 487 | item = sel.first(); |
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"), |
495 | i18n("Yes"), | 495 | i18n("Yes"), |
496 | i18n("No")); | 496 | i18n("No")); |
497 | if (result == KMessageBox::Cancel) item = 0; | 497 | if (result == KMessageBox::Cancel) item = 0; |
@@ -608,23 +608,23 @@ void KOListView::saveDescriptionToFile() | |||
608 | if ( createbup ) { | 608 | if ( createbup ) { |
609 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + | 609 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + |
610 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); | 610 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); |
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); |
618 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); | 618 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); |
619 | ++icount; | 619 | ++icount; |
620 | 620 | ||
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() ) |
628 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); | 628 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); |
629 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 629 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
630 | if ( !incidence->location().isEmpty() ) | 630 | if ( !incidence->location().isEmpty() ) |
@@ -666,13 +666,13 @@ void KOListView::writeToFile( bool iCal ) | |||
666 | QPtrList<Incidence> delSel ; | 666 | QPtrList<Incidence> delSel ; |
667 | QListViewItem *item = mListView->firstChild (); | 667 | QListViewItem *item = mListView->firstChild (); |
668 | bool journal = iCal; // warn only for vCal | 668 | bool journal = iCal; // warn only for vCal |
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; |
676 | } | 676 | } |
677 | 677 | ||
678 | item = item->nextSibling(); | 678 | item = item->nextSibling(); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 5aaf360..2602487 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -699,13 +699,13 @@ void KOTodoView::updateView() | |||
699 | todo = todoList.first();// todo; todo = todoList.next()) { | 699 | todo = todoList.first();// todo; todo = todoList.next()) { |
700 | while ( todo ) { | 700 | while ( todo ) { |
701 | bool next = true; | 701 | bool next = true; |
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 "); |
709 | todoList.remove( ); | 709 | todoList.remove( ); |
710 | todo = todoList.current(); | 710 | todo = todoList.current(); |
711 | next = false; | 711 | next = false; |
@@ -841,13 +841,13 @@ QMap<Todo *,KOTodoViewItem *>::ConstIterator | |||
841 | 841 | ||
842 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 842 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
843 | // TODO: Check, if dynmaic cast is necessary | 843 | // TODO: Check, if dynmaic cast is necessary |
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; |
851 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 851 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
852 | itemIterator = mTodoMap.find(relatedTodo); | 852 | itemIterator = mTodoMap.find(relatedTodo); |
853 | if (itemIterator == mTodoMap.end()) { | 853 | if (itemIterator == mTodoMap.end()) { |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 62d7ede..e8574a0 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -486,20 +486,20 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
486 | if ( appendTable && !notRed ) { | 486 | if ( appendTable && !notRed ) { |
487 | tempText = "<table>"; | 487 | tempText = "<table>"; |
488 | } | 488 | } |
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) +": "; |
503 | else | 503 | else |
504 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 504 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
505 | 505 | ||
@@ -617,24 +617,24 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
617 | if ( needClose ) { | 617 | if ( needClose ) { |
618 | tempText += "] "; | 618 | tempText += "] "; |
619 | } | 619 | } |
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(); |
628 | else | 628 | else |
629 | tempText += i18n("-no summary-"); | 629 | tempText += i18n("-no summary-"); |
630 | if ( bDay ) { | 630 | if ( bDay ) { |
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(); |
638 | tempText += i18n(" (%1 y.)"). arg( years ); | 638 | tempText += i18n(" (%1 y.)"). arg( years ); |
639 | } | 639 | } |
640 | } | 640 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 53b65b2..481eab4 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1329,17 +1329,17 @@ void MainWindow::exportToPhone( int mode ) | |||
1329 | CalendarLocal* cal = new CalendarLocal(); | 1329 | CalendarLocal* cal = new CalendarLocal(); |
1330 | cal->setLocalTime(); | 1330 | cal->setLocalTime(); |
1331 | Incidence *incidence = delSel.first(); | 1331 | Incidence *incidence = delSel.first(); |
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(); |
1343 | else | 1343 | else |
1344 | dt = cur.addSecs( 62 ); | 1344 | dt = cur.addSecs( 62 ); |
1345 | } | 1345 | } |
@@ -1593,13 +1593,13 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) | |||
1593 | return; | 1593 | return; |
1594 | 1594 | ||
1595 | } | 1595 | } |
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 ); |
1603 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1603 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1604 | 1604 | ||
1605 | } else { | 1605 | } else { |
@@ -1631,19 +1631,19 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) | |||
1631 | if ( !incidence->location().isEmpty() ) | 1631 | if ( !incidence->location().isEmpty() ) |
1632 | startString += " (" +incidence->location()+")"; | 1632 | startString += " (" +incidence->location()+")"; |
1633 | setCaption( incidence->summary()+startString); | 1633 | setCaption( incidence->summary()+startString); |
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...") ); |
1647 | 1647 | ||
1648 | mNewSubTodoAction->setEnabled( true ); | 1648 | mNewSubTodoAction->setEnabled( true ); |
1649 | } else { | 1649 | } else { |
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index ed39ddb..7e8e2c5 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -350,17 +350,17 @@ bool Calendar::addIncidence(Incidence *i) | |||
350 | Incidence::AddVisitor<Calendar> v(this); | 350 | Incidence::AddVisitor<Calendar> v(this); |
351 | 351 | ||
352 | return i->accept(v); | 352 | return i->accept(v); |
353 | } | 353 | } |
354 | void Calendar::deleteIncidence(Incidence *in) | 354 | void Calendar::deleteIncidence(Incidence *in) |
355 | { | 355 | { |
356 | if ( in->type() == "Event" ) | 356 | if ( in->typeID() == eventID ) |
357 | deleteEvent( (Event*) in ); | 357 | deleteEvent( (Event*) in ); |
358 | else if ( in->type() =="Todo" ) | 358 | else if ( in->typeID() == todoID ) |
359 | deleteTodo( (Todo*) in); | 359 | deleteTodo( (Todo*) in); |
360 | else if ( in->type() =="Journal" ) | 360 | else if ( in->typeID() == journalID ) |
361 | deleteJournal( (Journal*) in ); | 361 | deleteJournal( (Journal*) in ); |
362 | } | 362 | } |
363 | 363 | ||
364 | Incidence* Calendar::incidence( const QString& uid ) | 364 | Incidence* Calendar::incidence( const QString& uid ) |
365 | { | 365 | { |
366 | Incidence* i; | 366 | Incidence* i; |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index bc76c0b..fe74052 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -455,15 +455,13 @@ Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) | |||
455 | { | 455 | { |
456 | return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); | 456 | return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to ); |
457 | } | 457 | } |
458 | 458 | ||
459 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) | 459 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) |
460 | { | 460 | { |
461 | kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - " | 461 | |
462 | << to.toString() << ")\n"; | ||
463 | |||
464 | Alarm::List alarms; | 462 | Alarm::List alarms; |
465 | 463 | ||
466 | Event *e; | 464 | Event *e; |
467 | 465 | ||
468 | for( e = mEventList.first(); e; e = mEventList.next() ) { | 466 | for( e = mEventList.first(); e; e = mEventList.next() ) { |
469 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); | 467 | if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to ); |
@@ -485,14 +483,12 @@ void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, | |||
485 | Alarm *alarm; | 483 | Alarm *alarm; |
486 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { | 484 | for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) { |
487 | // kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() | 485 | // kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text() |
488 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; | 486 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; |
489 | if ( alarm->enabled() ) { | 487 | if ( alarm->enabled() ) { |
490 | if ( alarm->time() >= from && alarm->time() <= to ) { | 488 | if ( alarm->time() >= from && alarm->time() <= to ) { |
491 | kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary() | ||
492 | << "': " << alarm->time().toString() << endl; | ||
493 | alarms.append( alarm ); | 489 | alarms.append( alarm ); |
494 | } | 490 | } |
495 | } | 491 | } |
496 | } | 492 | } |
497 | } | 493 | } |
498 | 494 | ||
diff --git a/libkcal/calfilter.cpp b/libkcal/calfilter.cpp index c425dfc..20078a7 100644 --- a/libkcal/calfilter.cpp +++ b/libkcal/calfilter.cpp | |||
@@ -75,17 +75,17 @@ void CalFilter::apply(QPtrList<Todo> *eventlist) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | // kdDebug(5800) << "CalFilter::apply() done" << endl; | 77 | // kdDebug(5800) << "CalFilter::apply() done" << endl; |
78 | } | 78 | } |
79 | bool CalFilter::filterCalendarItem(Incidence *in) | 79 | bool CalFilter::filterCalendarItem(Incidence *in) |
80 | { | 80 | { |
81 | if ( in->type() == "Event" ) | 81 | if ( in->typeID() == eventID ) |
82 | return filterEvent( (Event*) in ); | 82 | return filterEvent( (Event*) in ); |
83 | else if ( in->type() =="Todo" ) | 83 | else if ( in->typeID() == todoID ) |
84 | return filterTodo( (Todo*) in); | 84 | return filterTodo( (Todo*) in); |
85 | else if ( in->type() =="Journal" ) | 85 | else if ( in->typeID () == journalID ) |
86 | return filterJournal( (Journal*) in ); | 86 | return filterJournal( (Journal*) in ); |
87 | return false; | 87 | return false; |
88 | } | 88 | } |
89 | bool CalFilter::filterEvent(Event *event) | 89 | bool CalFilter::filterEvent(Event *event) |
90 | { | 90 | { |
91 | if (mCriteria & HideEvents) | 91 | if (mCriteria & HideEvents) |
diff --git a/libkcal/event.h b/libkcal/event.h index 8729956..287d403 100644 --- a/libkcal/event.h +++ b/libkcal/event.h | |||
@@ -37,12 +37,13 @@ class Event : public Incidence | |||
37 | typedef ListBase<Event> List; | 37 | typedef ListBase<Event> List; |
38 | Event(); | 38 | Event(); |
39 | Event(const Event &); | 39 | Event(const Event &); |
40 | ~Event(); | 40 | ~Event(); |
41 | 41 | ||
42 | QCString type() const { return "Event"; } | 42 | QCString type() const { return "Event"; } |
43 | IncTypeID typeID() const { return eventID; } | ||
43 | 44 | ||
44 | Incidence *clone(); | 45 | Incidence *clone(); |
45 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; | 46 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; |
46 | 47 | ||
47 | /** for setting an event's ending date/time with a QDateTime. */ | 48 | /** for setting an event's ending date/time with a QDateTime. */ |
48 | void setDtEnd(const QDateTime &dtEnd); | 49 | void setDtEnd(const QDateTime &dtEnd); |
diff --git a/libkcal/freebusy.h b/libkcal/freebusy.h index 054feda..d741c72 100644 --- a/libkcal/freebusy.h +++ b/libkcal/freebusy.h | |||
@@ -45,12 +45,13 @@ class FreeBusy : public IncidenceBase | |||
45 | FreeBusy(Calendar *calendar, const QDateTime &start, const QDateTime &end); | 45 | FreeBusy(Calendar *calendar, const QDateTime &start, const QDateTime &end); |
46 | FreeBusy(QValueList<Period> busyPeriods); | 46 | FreeBusy(QValueList<Period> busyPeriods); |
47 | 47 | ||
48 | ~FreeBusy(); | 48 | ~FreeBusy(); |
49 | 49 | ||
50 | QCString type() const { return "FreeBusy"; } | 50 | QCString type() const { return "FreeBusy"; } |
51 | IncTypeID typeID() const { return freebusyID; } | ||
51 | 52 | ||
52 | virtual QDateTime dtEnd() const; | 53 | virtual QDateTime dtEnd() const; |
53 | bool setDtEnd( const QDateTime &end ); | 54 | bool setDtEnd( const QDateTime &end ); |
54 | 55 | ||
55 | QValueList<Period> busyPeriods() const; | 56 | QValueList<Period> busyPeriods() const; |
56 | 57 | ||
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp index 3a2aac6..d9fe40b 100644 --- a/libkcal/icalformat.cpp +++ b/libkcal/icalformat.cpp | |||
@@ -381,18 +381,18 @@ ScheduleMessage *ICalFormat::parseScheduleMessage( Calendar *cal, | |||
381 | 381 | ||
382 | icalcomponent *calendarComponent = mImpl->createCalendarComponent(cal); | 382 | icalcomponent *calendarComponent = mImpl->createCalendarComponent(cal); |
383 | 383 | ||
384 | Incidence *existingIncidence = cal->event(incidence->uid()); | 384 | Incidence *existingIncidence = cal->event(incidence->uid()); |
385 | if (existingIncidence) { | 385 | if (existingIncidence) { |
386 | // TODO: check, if cast is required, or if it can be done by virtual funcs. | 386 | // TODO: check, if cast is required, or if it can be done by virtual funcs. |
387 | if (existingIncidence->type() == "Todo") { | 387 | if (existingIncidence->typeID() == todoID ) { |
388 | Todo *todo = static_cast<Todo *>(existingIncidence); | 388 | Todo *todo = static_cast<Todo *>(existingIncidence); |
389 | icalcomponent_add_component(calendarComponent, | 389 | icalcomponent_add_component(calendarComponent, |
390 | mImpl->writeTodo(todo)); | 390 | mImpl->writeTodo(todo)); |
391 | } | 391 | } |
392 | if (existingIncidence->type() == "Event") { | 392 | if (existingIncidence->typeID() == eventID ) { |
393 | Event *event = static_cast<Event *>(existingIncidence); | 393 | Event *event = static_cast<Event *>(existingIncidence); |
394 | icalcomponent_add_component(calendarComponent, | 394 | icalcomponent_add_component(calendarComponent, |
395 | mImpl->writeEvent(event)); | 395 | mImpl->writeEvent(event)); |
396 | } | 396 | } |
397 | } else { | 397 | } else { |
398 | calendarComponent = 0; | 398 | calendarComponent = 0; |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 2405682..3e28714 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -2152,21 +2152,21 @@ icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence, | |||
2152 | return message; | 2152 | return message; |
2153 | } | 2153 | } |
2154 | 2154 | ||
2155 | icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); | 2155 | icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); |
2156 | 2156 | ||
2157 | // TODO: check, if dynamic cast is required | 2157 | // TODO: check, if dynamic cast is required |
2158 | if(incidence->type() == "Todo") { | 2158 | if(incidence->typeID() == todoID ) { |
2159 | Todo *todo = static_cast<Todo *>(incidence); | 2159 | Todo *todo = static_cast<Todo *>(incidence); |
2160 | icalcomponent_add_component(message,writeTodo(todo)); | 2160 | icalcomponent_add_component(message,writeTodo(todo)); |
2161 | } | 2161 | } |
2162 | if(incidence->type() == "Event") { | 2162 | if(incidence->typeID() == eventID ) { |
2163 | Event *event = static_cast<Event *>(incidence); | 2163 | Event *event = static_cast<Event *>(incidence); |
2164 | icalcomponent_add_component(message,writeEvent(event)); | 2164 | icalcomponent_add_component(message,writeEvent(event)); |
2165 | } | 2165 | } |
2166 | if(incidence->type() == "FreeBusy") { | 2166 | if(incidence->typeID() == freebusyID) { |
2167 | FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); | 2167 | FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); |
2168 | icalcomponent_add_component(message,writeFreeBusy(freebusy, method)); | 2168 | icalcomponent_add_component(message,writeFreeBusy(freebusy, method)); |
2169 | } | 2169 | } |
2170 | 2170 | ||
2171 | return message; | 2171 | return message; |
2172 | } | 2172 | } |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 762103f..f446197 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -233,13 +233,13 @@ Incidence* Incidence::recreateCloneException( QDate d ) | |||
233 | { | 233 | { |
234 | Incidence* newInc = clone(); | 234 | Incidence* newInc = clone(); |
235 | newInc->recreate(); | 235 | newInc->recreate(); |
236 | if ( doesRecur() ) { | 236 | if ( doesRecur() ) { |
237 | addExDate( d ); | 237 | addExDate( d ); |
238 | newInc->recurrence()->unsetRecurs(); | 238 | newInc->recurrence()->unsetRecurs(); |
239 | if ( type() == "Event") { | 239 | if ( typeID() == eventID ) { |
240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
241 | QTime tim = dtStart().time(); | 241 | QTime tim = dtStart().time(); |
242 | newInc->setDtStart( QDateTime(d, tim) ); | 242 | newInc->setDtStart( QDateTime(d, tim) ); |
243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
244 | } else { | 244 | } else { |
245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); | 245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); |
@@ -721,24 +721,24 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const | |||
721 | return QDateTime (); | 721 | return QDateTime (); |
722 | } | 722 | } |
723 | } else { | 723 | } else { |
724 | if ( hasStartDate () ) { | 724 | if ( hasStartDate () ) { |
725 | incidenceStart = dtStart(); | 725 | incidenceStart = dtStart(); |
726 | } | 726 | } |
727 | if ( type() =="Todo" ) { | 727 | if ( typeID() == todoID ) { |
728 | if ( ((Todo*)this)->hasDueDate() ) | 728 | if ( ((Todo*)this)->hasDueDate() ) |
729 | incidenceStart = ((Todo*)this)->dtDue(); | 729 | incidenceStart = ((Todo*)this)->dtDue(); |
730 | } | 730 | } |
731 | } | 731 | } |
732 | if ( incidenceStart > dt ) | 732 | if ( incidenceStart > dt ) |
733 | *ok = true; | 733 | *ok = true; |
734 | return incidenceStart; | 734 | return incidenceStart; |
735 | } | 735 | } |
736 | QDateTime Incidence::dtStart() const | 736 | QDateTime Incidence::dtStart() const |
737 | { | 737 | { |
738 | if ( doesRecur() ) { | 738 | if ( doesRecur() ) { |
739 | if ( type() == "Todo" ) { | 739 | if ( typeID() == todoID ) { |
740 | ((Todo*)this)->checkSetCompletedFalse(); | 740 | ((Todo*)this)->checkSetCompletedFalse(); |
741 | } | 741 | } |
742 | } | 742 | } |
743 | return mDtStart; | 743 | return mDtStart; |
744 | } | 744 | } |
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 8624786..05209e0 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h | |||
@@ -31,12 +31,13 @@ | |||
31 | #include "customproperties.h" | 31 | #include "customproperties.h" |
32 | #include "attendee.h" | 32 | #include "attendee.h" |
33 | 33 | ||
34 | namespace KCal { | 34 | namespace KCal { |
35 | 35 | ||
36 | typedef QValueList<QDate> DateList; | 36 | typedef QValueList<QDate> DateList; |
37 | enum IncTypeID { eventID,todoID,journalID,freebusyID }; | ||
37 | 38 | ||
38 | /** | 39 | /** |
39 | This class provides the base class common to all calendar components. | 40 | This class provides the base class common to all calendar components. |
40 | */ | 41 | */ |
41 | class IncidenceBase : public CustomProperties | 42 | class IncidenceBase : public CustomProperties |
42 | { | 43 | { |
@@ -48,12 +49,13 @@ class IncidenceBase : public CustomProperties | |||
48 | 49 | ||
49 | IncidenceBase(); | 50 | IncidenceBase(); |
50 | IncidenceBase(const IncidenceBase &); | 51 | IncidenceBase(const IncidenceBase &); |
51 | virtual ~IncidenceBase(); | 52 | virtual ~IncidenceBase(); |
52 | 53 | ||
53 | virtual QCString type() const = 0; | 54 | virtual QCString type() const = 0; |
55 | virtual IncTypeID typeID() const = 0; | ||
54 | 56 | ||
55 | /** Set the unique id for the event */ | 57 | /** Set the unique id for the event */ |
56 | void setUid(const QString &); | 58 | void setUid(const QString &); |
57 | /** Return the unique id for the event */ | 59 | /** Return the unique id for the event */ |
58 | QString uid() const; | 60 | QString uid() const; |
59 | 61 | ||
diff --git a/libkcal/journal.h b/libkcal/journal.h index 2c1d7ea..1cd0a22 100644 --- a/libkcal/journal.h +++ b/libkcal/journal.h | |||
@@ -34,12 +34,13 @@ class Journal : public Incidence | |||
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | Journal(); | 36 | Journal(); |
37 | ~Journal(); | 37 | ~Journal(); |
38 | 38 | ||
39 | QCString type() const { return "Journal"; } | 39 | QCString type() const { return "Journal"; } |
40 | IncTypeID typeID() const { return journalID; } | ||
40 | 41 | ||
41 | Incidence *clone(); | 42 | Incidence *clone(); |
42 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; | 43 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; |
43 | private: | 44 | private: |
44 | bool accept(Visitor &v) { return v.visit(this); } | 45 | bool accept(Visitor &v) { return v.visit(this); } |
45 | }; | 46 | }; |
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 7d61b7f..d1ace4f 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -18,15 +18,15 @@ QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bo | |||
18 | // return QString::null; | 18 | // return QString::null; |
19 | // #endif | 19 | // #endif |
20 | mDetails = details; | 20 | mDetails = details; |
21 | mCreated = created ; | 21 | mCreated = created ; |
22 | mModified = modified; | 22 | mModified = modified; |
23 | mText = ""; | 23 | mText = ""; |
24 | if ( inc->type() == "Event" ) | 24 | if ( inc->typeID() == eventID ) |
25 | setEvent((Event *) inc ); | 25 | setEvent((Event *) inc ); |
26 | else if ( inc->type() == "Todo" ) | 26 | else if ( inc->typeID() == todoID ) |
27 | setTodo((Todo *) inc ); | 27 | setTodo((Todo *) inc ); |
28 | return mText; | 28 | return mText; |
29 | } | 29 | } |
30 | 30 | ||
31 | KIncidenceFormatter* KIncidenceFormatter::instance() | 31 | KIncidenceFormatter* KIncidenceFormatter::instance() |
32 | { | 32 | { |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 38ba2c7..c97a61e 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -127,13 +127,13 @@ void Todo::saveRunningInfoToFile( QString comment ) | |||
127 | } | 127 | } |
128 | void Todo::saveParents() | 128 | void Todo::saveParents() |
129 | { | 129 | { |
130 | if (!relatedTo() ) | 130 | if (!relatedTo() ) |
131 | return; | 131 | return; |
132 | Incidence * inc = relatedTo(); | 132 | Incidence * inc = relatedTo(); |
133 | if ( inc->type() != "Todo" ) | 133 | if ( inc->typeID() != todoID ) |
134 | return; | 134 | return; |
135 | Todo* to = (Todo*)inc; | 135 | Todo* to = (Todo*)inc; |
136 | bool saveTodo = false; | 136 | bool saveTodo = false; |
137 | QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; | 137 | QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; |
138 | QFileInfo fi ( file ); | 138 | QFileInfo fi ( file ); |
139 | if ( fi.exists() ) { | 139 | if ( fi.exists() ) { |
@@ -561,14 +561,15 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_d | |||
561 | return QDateTime (); | 561 | return QDateTime (); |
562 | 562 | ||
563 | } | 563 | } |
564 | 564 | ||
565 | void Todo::checkSetCompletedFalse() | 565 | void Todo::checkSetCompletedFalse() |
566 | { | 566 | { |
567 | if ( !hasRecurrenceID() ) { | 567 | if ( !mHasRecurrenceID ) { |
568 | qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); | 568 | qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); |
569 | return; | ||
569 | } | 570 | } |
570 | // qDebug("Todo::checkSetCompletedFalse()"); | 571 | // qDebug("Todo::checkSetCompletedFalse()"); |
571 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 572 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
572 | if ( mPercentComplete == 100 ) { | 573 | if ( mPercentComplete == 100 ) { |
573 | QDateTime dt = QDateTime::currentDateTime(); | 574 | QDateTime dt = QDateTime::currentDateTime(); |
574 | if ( dt > mDtStart && dt > mRecurrenceID ) { | 575 | if ( dt > mDtStart && dt > mRecurrenceID ) { |
diff --git a/libkcal/todo.h b/libkcal/todo.h index ab8fdf1..501c2ba 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h | |||
@@ -38,12 +38,13 @@ namespace KCal { | |||
38 | public: | 38 | public: |
39 | Todo(); | 39 | Todo(); |
40 | Todo(const Todo &); | 40 | Todo(const Todo &); |
41 | ~Todo(); | 41 | ~Todo(); |
42 | typedef ListBase<Todo> List; | 42 | typedef ListBase<Todo> List; |
43 | QCString type() const { return "Todo"; } | 43 | QCString type() const { return "Todo"; } |
44 | IncTypeID typeID() const { return todoID; } | ||
44 | 45 | ||
45 | /** Return an exact copy of this todo. */ | 46 | /** Return an exact copy of this todo. */ |
46 | Incidence *clone(); | 47 | Incidence *clone(); |
47 | QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const; | 48 | QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const; |
48 | 49 | ||
49 | /** for setting the todo's due date/time with a QDateTime. */ | 50 | /** for setting the todo's due date/time with a QDateTime. */ |