author | zautrix <zautrix> | 2005-07-27 22:26:08 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-27 22:26:08 (UTC) |
commit | 0e38cffd7ba745f237c659e1c48080fcb25b126c (patch) (unidiff) | |
tree | 6069600e18bae5300c6ce427735457dbfed93141 | |
parent | 136f9082862e7a56abb3a201e96f5e7386c4f1b9 (diff) | |
download | kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.zip kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.tar.gz kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.tar.bz2 |
rec changes
-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 4 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 2 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 2 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 2 | ||||
-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 172 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 6 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 4 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kotodoeditor.cpp | 3 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 4 | ||||
-rw-r--r-- | libkcal/event.cpp | 1 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 24 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 63 | ||||
-rw-r--r-- | libkcal/incidence.h | 5 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 4 | ||||
-rw-r--r-- | libkcal/vcalformat.cpp | 4 | ||||
-rw-r--r-- | libkcal/vcalformat.h | 2 |
18 files changed, 175 insertions, 135 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a76f2ed..a9d42f0 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3756,13 +3756,13 @@ void CalendarView::deleteEvent(Event *anEvent) | |||
3756 | { | 3756 | { |
3757 | if (!anEvent) { | 3757 | if (!anEvent) { |
3758 | KNotifyClient::beep(); | 3758 | KNotifyClient::beep(); |
3759 | return; | 3759 | return; |
3760 | } | 3760 | } |
3761 | 3761 | ||
3762 | if (anEvent->recurrence()->doesRecur()) { | 3762 | if (anEvent->doesRecur()) { |
3763 | QDate itemDate = mViewManager->currentSelectionDate(); | 3763 | QDate itemDate = mViewManager->currentSelectionDate(); |
3764 | int km; | 3764 | int km; |
3765 | if (!itemDate.isValid()) { | 3765 | if (!itemDate.isValid()) { |
3766 | //kdDebug() << "Date Not Valid" << endl; | 3766 | //kdDebug() << "Date Not Valid" << endl; |
3767 | if (KOPrefs::instance()->mConfirm) { | 3767 | if (KOPrefs::instance()->mConfirm) { |
3768 | km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 3768 | km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 0dd5ef5..c738f7e 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -576,13 +576,13 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
576 | mActionItem = (KOAgendaItem *)object; | 576 | mActionItem = (KOAgendaItem *)object; |
577 | if (mActionItem) { | 577 | if (mActionItem) { |
578 | emit signalClearSelection(); | 578 | emit signalClearSelection(); |
579 | slotClearSelection(); | 579 | slotClearSelection(); |
580 | selectItem(mActionItem); | 580 | selectItem(mActionItem); |
581 | Incidence *incidence = mActionItem->incidence(); | 581 | Incidence *incidence = mActionItem->incidence(); |
582 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | 582 | if ( incidence->isReadOnly() /*|| incidence->doesRecur() */) { |
583 | mActionItem = 0; | 583 | mActionItem = 0; |
584 | } else { | 584 | } else { |
585 | startItemAction(viewportPos); | 585 | startItemAction(viewportPos); |
586 | } | 586 | } |
587 | } | 587 | } |
588 | } | 588 | } |
@@ -996,13 +996,13 @@ void KOAgenda::endItemAction() | |||
996 | 996 | ||
997 | if ( mItemMoved ) { | 997 | if ( mItemMoved ) { |
998 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); | 998 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); |
999 | if ( !placeItem ) { | 999 | if ( !placeItem ) { |
1000 | placeItem = mActionItem; | 1000 | placeItem = mActionItem; |
1001 | } | 1001 | } |
1002 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { | 1002 | if ( placeItem->incidence()->doesRecur() ) { |
1003 | Incidence* oldInc = placeItem->incidence(); | 1003 | Incidence* oldInc = placeItem->incidence(); |
1004 | placeItem->recreateIncidence(); | 1004 | placeItem->recreateIncidence(); |
1005 | emit addToCalSignal(placeItem->incidence(), oldInc ); | 1005 | emit addToCalSignal(placeItem->incidence(), oldInc ); |
1006 | } | 1006 | } |
1007 | int type = mActionType; | 1007 | int type = mActionType; |
1008 | if ( mAllDayMode ) | 1008 | if ( mAllDayMode ) |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 303a92a..49ad9b8 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -231,13 +231,13 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | |||
231 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 231 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
232 | if ( horLayout ) | 232 | if ( horLayout ) |
233 | ++xOff; | 233 | ++xOff; |
234 | else | 234 | else |
235 | ++yOff; | 235 | ++yOff; |
236 | } | 236 | } |
237 | if (mIncidence->recurrence()->doesRecur()) { | 237 | if (mIncidence->doesRecur()) { |
238 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); | 238 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); |
239 | if ( horLayout ) | 239 | if ( horLayout ) |
240 | ++xOff; | 240 | ++xOff; |
241 | else | 241 | else |
242 | ++yOff; | 242 | ++yOff; |
243 | } | 243 | } |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index a01323a..04f30bb 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1198,13 +1198,13 @@ void KOAgendaView::fillAgenda() | |||
1198 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1198 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1199 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1199 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1200 | 1200 | ||
1201 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1201 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1202 | 1202 | ||
1203 | if (event->doesFloat()) { | 1203 | if (event->doesFloat()) { |
1204 | if (event->recurrence()->doesRecur()) { | 1204 | if (event->doesRecur()) { |
1205 | if (event->isMultiDay() ) { | 1205 | if (event->isMultiDay() ) { |
1206 | endX = endX - beginX;// endX is now number of days | 1206 | endX = endX - beginX;// endX is now number of days |
1207 | if ( event->recursOn( currentDate ) ) { | 1207 | if ( event->recursOn( currentDate ) ) { |
1208 | endX += curCol; | 1208 | endX += curCol; |
1209 | beginX = curCol; | 1209 | beginX = curCol; |
1210 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1210 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index ec1154a..057df0d 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -450,13 +450,13 @@ void KODayMatrix::updateViewTimed() | |||
450 | hDays.fill( false); | 450 | hDays.fill( false); |
451 | eDays.fill( false); | 451 | eDays.fill( false); |
452 | mHolidays.clear(); | 452 | mHolidays.clear(); |
453 | QDate mStartDate = days[0]; | 453 | QDate mStartDate = days[0]; |
454 | QDate endDate = mStartDate.addDays( timeSpan ); | 454 | QDate endDate = mStartDate.addDays( timeSpan ); |
455 | for( event = events.first(); event; event = events.next() ) { // for event | 455 | for( event = events.first(); event; event = events.next() ) { // for event |
456 | ushort recurType = event->recurrence()->doesRecur(); | 456 | ushort recurType = event->doesRecur(); |
457 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 457 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
458 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 458 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
459 | continue; | 459 | continue; |
460 | } | 460 | } |
461 | if ( event->doesRecur() ) { | 461 | if ( event->doesRecur() ) { |
462 | bool last; | 462 | bool last; |
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index de4e4f7..89504db 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp | |||
@@ -894,106 +894,108 @@ void KOEditorRecurrence::readEvent(Incidence *event) | |||
894 | QPtrList<int> rmd; | 894 | QPtrList<int> rmd; |
895 | int day = 0; | 895 | int day = 0; |
896 | int count = 0; | 896 | int count = 0; |
897 | int month = 0; | 897 | int month = 0; |
898 | setDateTimes( event->dtStart(), dtEnd ); | 898 | setDateTimes( event->dtStart(), dtEnd ); |
899 | 899 | ||
900 | Recurrence *r = event->recurrence(); | 900 | |
901 | int f = r->frequency(); | ||
902 | 901 | ||
903 | int recurs = r->doesRecur(); | 902 | int recurs = event->doesRecur(); |
904 | 903 | ||
905 | mEnabledCheck->setChecked( recurs ); | 904 | mEnabledCheck->setChecked( recurs ); |
906 | setEnabled( recurs ); | 905 | setEnabled( recurs ); |
907 | 906 | ||
908 | int recurrenceType = RecurrenceChooser::Weekly; | 907 | int recurrenceType = RecurrenceChooser::Weekly; |
909 | 908 | if ( recurs ) { | |
910 | switch ( recurs ) { | 909 | Recurrence *r = event->recurrence(); |
911 | case Recurrence::rNone: | 910 | int f = r->frequency(); |
912 | setDefaults( event->dtStart(), dtEnd ); | 911 | switch ( recurs ) { |
913 | break; | 912 | case Recurrence::rNone: |
914 | case Recurrence::rDaily: | 913 | setDefaults( event->dtStart(), dtEnd ); |
915 | recurrenceType = RecurrenceChooser::Daily; | 914 | break; |
916 | mDaily->setFrequency( f ); | 915 | case Recurrence::rDaily: |
917 | break; | 916 | recurrenceType = RecurrenceChooser::Daily; |
918 | case Recurrence::rWeekly: | 917 | mDaily->setFrequency( f ); |
919 | recurrenceType = RecurrenceChooser::Weekly; | 918 | break; |
920 | mWeekly->setFrequency( f ); | 919 | case Recurrence::rWeekly: |
921 | mWeekly->setDays( r->days() ); | 920 | recurrenceType = RecurrenceChooser::Weekly; |
922 | break; | 921 | mWeekly->setFrequency( f ); |
923 | case Recurrence::rMonthlyPos: | 922 | mWeekly->setDays( r->days() ); |
924 | // we only handle one possibility in the list right now, | 923 | break; |
925 | // so I have hardcoded calls with first(). If we make the GUI | 924 | case Recurrence::rMonthlyPos: |
926 | // more extended, this can be changed. | 925 | // we only handle one possibility in the list right now, |
927 | recurrenceType = RecurrenceChooser::Monthly; | 926 | // so I have hardcoded calls with first(). If we make the GUI |
928 | 927 | // more extended, this can be changed. | |
929 | rmp = r->monthPositions(); | 928 | recurrenceType = RecurrenceChooser::Monthly; |
930 | if ( rmp.first()->negative ) | 929 | |
931 | count = 5 - rmp.first()->rPos - 1; | 930 | rmp = r->monthPositions(); |
932 | else | 931 | if ( rmp.first()->negative ) |
933 | count = rmp.first()->rPos - 1; | 932 | count = 5 - rmp.first()->rPos - 1; |
934 | day = 0; | 933 | else |
935 | while ( !rmp.first()->rDays.testBit( day ) ) ++day; | 934 | count = rmp.first()->rPos - 1; |
936 | mMonthly->setByPos( count, day ); | 935 | day = 0; |
937 | 936 | while ( !rmp.first()->rDays.testBit( day ) ) ++day; | |
938 | mMonthly->setFrequency( f ); | 937 | mMonthly->setByPos( count, day ); |
939 | 938 | ||
940 | break; | 939 | mMonthly->setFrequency( f ); |
941 | case Recurrence::rMonthlyDay: | 940 | |
942 | recurrenceType = RecurrenceChooser::Monthly; | 941 | break; |
943 | 942 | case Recurrence::rMonthlyDay: | |
944 | rmd = r->monthDays(); | 943 | recurrenceType = RecurrenceChooser::Monthly; |
945 | day = *rmd.first() - 1; | 944 | |
946 | mMonthly->setByDay( day ); | 945 | rmd = r->monthDays(); |
947 | 946 | day = *rmd.first() - 1; | |
948 | mMonthly->setFrequency( f ); | 947 | mMonthly->setByDay( day ); |
949 | 948 | ||
950 | break; | 949 | mMonthly->setFrequency( f ); |
951 | case Recurrence::rYearlyMonth: | 950 | |
952 | { | 951 | break; |
953 | recurrenceType = RecurrenceChooser::Yearly; | 952 | case Recurrence::rYearlyMonth: |
954 | //qDebug("Recurrence::rYearlyMonth: "); | 953 | { |
955 | day = event->dtStart().date().day(); | 954 | recurrenceType = RecurrenceChooser::Yearly; |
956 | rmd = r->yearNums(); | 955 | //qDebug("Recurrence::rYearlyMonth: "); |
957 | if ( rmd.count() > 0 ) | 956 | day = event->dtStart().date().day(); |
958 | month = *rmd.first(); | 957 | rmd = r->yearNums(); |
959 | else | 958 | if ( rmd.count() > 0 ) |
960 | month = event->dtStart().date().month() ; | 959 | month = *rmd.first(); |
961 | mYearly->setByMonth( month, day ); | 960 | else |
961 | month = event->dtStart().date().month() ; | ||
962 | mYearly->setByMonth( month, day ); | ||
962 | #if 0 | 963 | #if 0 |
963 | //qDebug("2day = %d ",day ); | 964 | //qDebug("2day = %d ",day ); |
964 | QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); | 965 | QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); |
965 | int month; | 966 | int month; |
966 | if ( !monthlist.isEmpty() ) { | 967 | if ( !monthlist.isEmpty() ) { |
967 | month = monthlist.first()->rPos ; | 968 | month = monthlist.first()->rPos ; |
968 | } else { | 969 | } else { |
969 | month = event->dtStart().date().month() ; | 970 | month = event->dtStart().date().month() ; |
970 | } | 971 | } |
971 | mYearly->setByMonth( day, month ); | 972 | mYearly->setByMonth( day, month ); |
972 | #endif | 973 | #endif |
973 | mYearly->setFrequency( f ); | 974 | mYearly->setFrequency( f ); |
974 | } | 975 | } |
975 | 976 | ||
976 | break; | 977 | break; |
977 | case Recurrence::rYearlyDay: | 978 | case Recurrence::rYearlyDay: |
978 | //qDebug("Recurrence::rYearlyDay: "); | 979 | //qDebug("Recurrence::rYearlyDay: "); |
979 | recurrenceType = RecurrenceChooser::Yearly; | 980 | recurrenceType = RecurrenceChooser::Yearly; |
980 | mYearly->setByDay( event->dtStart().date().dayOfYear() ); | 981 | mYearly->setByDay( event->dtStart().date().dayOfYear() ); |
981 | mYearly->setFrequency( f ); | 982 | mYearly->setFrequency( f ); |
982 | break; | 983 | break; |
983 | default: | 984 | default: |
984 | setDefaults( event->dtStart(), dtEnd ); | 985 | setDefaults( event->dtStart(), dtEnd ); |
985 | break; | 986 | break; |
987 | } | ||
986 | } | 988 | } |
987 | |||
988 | mRecurrenceChooser->setType( recurrenceType ); | 989 | mRecurrenceChooser->setType( recurrenceType ); |
989 | showCurrentRule( recurrenceType ); | 990 | showCurrentRule( recurrenceType ); |
990 | 991 | ||
991 | mRecurrenceRange->setDateTimes( event->dtStart() ); | 992 | mRecurrenceRange->setDateTimes( event->dtStart() ); |
992 | 993 | ||
993 | if ( r->doesRecur() ) { | 994 | if ( event->doesRecur() ) { |
995 | Recurrence *r = event->recurrence(); | ||
994 | mRecurrenceRange->setDuration( r->duration() ); | 996 | mRecurrenceRange->setDuration( r->duration() ); |
995 | if ( r->duration() == 0 ) | 997 | if ( r->duration() == 0 ) |
996 | { | 998 | { |
997 | if ( r->endDate() < event->dtStart().date() ) | 999 | if ( r->endDate() < event->dtStart().date() ) |
998 | mRecurrenceRange->setEndDate( event->dtStart().date() ); | 1000 | mRecurrenceRange->setEndDate( event->dtStart().date() ); |
999 | else | 1001 | else |
@@ -1004,18 +1006,22 @@ void KOEditorRecurrence::readEvent(Incidence *event) | |||
1004 | 1006 | ||
1005 | mExceptions->setDates( event->exDates() ); | 1007 | mExceptions->setDates( event->exDates() ); |
1006 | } | 1008 | } |
1007 | 1009 | ||
1008 | void KOEditorRecurrence::writeEvent( Incidence *event ) | 1010 | void KOEditorRecurrence::writeEvent( Incidence *event ) |
1009 | { | 1011 | { |
1010 | Recurrence *r = event->recurrence(); | 1012 | |
1011 | 1013 | ||
1012 | // clear out any old settings; | 1014 | if ( !mEnabledCheck->isChecked() ) { |
1013 | r->unsetRecurs(); | 1015 | if ( event->doesRecur() ) |
1016 | event->recurrence()->unsetRecurs(); | ||
1017 | } else { | ||
1018 | Recurrence *r = event->recurrence(); | ||
1014 | 1019 | ||
1015 | if ( mEnabledCheck->isChecked() ) { | 1020 | // clear out any old settings; |
1021 | r->unsetRecurs(); | ||
1016 | int duration = mRecurrenceRange->duration(); | 1022 | int duration = mRecurrenceRange->duration(); |
1017 | QDate endDate; | 1023 | QDate endDate; |
1018 | if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); | 1024 | if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); |
1019 | 1025 | ||
1020 | int recurrenceType = mRecurrenceChooser->type(); | 1026 | int recurrenceType = mRecurrenceChooser->type(); |
1021 | 1027 | ||
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index a690ab1..db695f5 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -344,15 +344,15 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
344 | } | 344 | } |
345 | } | 345 | } |
346 | if (!event->location().isEmpty()) { | 346 | if (!event->location().isEmpty()) { |
347 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); | 347 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); |
348 | mMailSubject += i18n(" at ") + event->location(); | 348 | mMailSubject += i18n(" at ") + event->location(); |
349 | } | 349 | } |
350 | if (event->recurrence()->doesRecur()) { | 350 | if (event->doesRecur()) { |
351 | 351 | ||
352 | QString recurText = event->recurrence()->recurrenceText(); | 352 | QString recurText = event->recurrenceText(); |
353 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 353 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
354 | bool ok; | 354 | bool ok; |
355 | QDate start = QDate::currentDate(); | 355 | QDate start = QDate::currentDate(); |
356 | QDateTime next; | 356 | QDateTime next; |
357 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 357 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
358 | if ( ok ) { | 358 | if ( ok ) { |
@@ -478,13 +478,13 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
478 | mText += "</font>"; | 478 | mText += "</font>"; |
479 | mMailSubject += i18n("(cancelled)"); | 479 | mMailSubject += i18n("(cancelled)"); |
480 | } | 480 | } |
481 | 481 | ||
482 | 482 | ||
483 | 483 | ||
484 | if (event->recurrence()->doesRecur()) { | 484 | if (event->doesRecur()) { |
485 | 485 | ||
486 | QString recurText = event->recurrence()->recurrenceText(); | 486 | QString recurText = event->recurrence()->recurrenceText(); |
487 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 487 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
488 | 488 | ||
489 | } | 489 | } |
490 | if (event->hasStartDate()) { | 490 | if (event->hasStartDate()) { |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index d25f671..e7a5e0e 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -130,13 +130,13 @@ bool ListItemVisitor::visit(Event *e) | |||
130 | mItem->setText(4,e->dtEndTimeStr()); | 130 | mItem->setText(4,e->dtEndTimeStr()); |
131 | if ( e->isAlarmEnabled() ) { | 131 | if ( e->isAlarmEnabled() ) { |
132 | mItem->setText(5,e->alarms().first()->offsetText() ); | 132 | mItem->setText(5,e->alarms().first()->offsetText() ); |
133 | } else { | 133 | } else { |
134 | mItem->setText(5, i18n("No")); | 134 | mItem->setText(5, i18n("No")); |
135 | } | 135 | } |
136 | mItem->setText(6, e->recurrence()->recurrenceText()); | 136 | mItem->setText(6, e->recurrenceText()); |
137 | if( ! e->doesRecur() ) | 137 | if( ! e->doesRecur() ) |
138 | mItem->setSortKey( 6, "-" ); | 138 | mItem->setSortKey( 6, "-" ); |
139 | mItem->setText(7,"---"); | 139 | mItem->setText(7,"---"); |
140 | mItem->setText(8,"---"); | 140 | mItem->setText(8,"---"); |
141 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 141 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
142 | mItem->setText(10,e->categoriesStr()); | 142 | mItem->setText(10,e->categoriesStr()); |
@@ -181,13 +181,13 @@ bool ListItemVisitor::visit(Todo *t) | |||
181 | mItem->setText(4,"---"); | 181 | mItem->setText(4,"---"); |
182 | if ( t->isAlarmEnabled() ) { | 182 | if ( t->isAlarmEnabled() ) { |
183 | mItem->setText(5,t->alarms().first()->offsetText() ); | 183 | mItem->setText(5,t->alarms().first()->offsetText() ); |
184 | } else { | 184 | } else { |
185 | mItem->setText(5, i18n("No")); | 185 | mItem->setText(5, i18n("No")); |
186 | } | 186 | } |
187 | mItem->setText(6, t->recurrence()->recurrenceText()); | 187 | mItem->setText(6, t->recurrenceText()); |
188 | if( ! t->doesRecur() ) | 188 | if( ! t->doesRecur() ) |
189 | mItem->setSortKey( 6, "-" ); | 189 | mItem->setSortKey( 6, "-" ); |
190 | if (t->hasDueDate()) { | 190 | if (t->hasDueDate()) { |
191 | mItem->setText(7,t->dtDueDateStr()); | 191 | mItem->setText(7,t->dtDueDateStr()); |
192 | if (t->doesFloat()) { | 192 | if (t->doesFloat()) { |
193 | mItem->setText(8,"---"); | 193 | mItem->setText(8,"---"); |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 498d9b0..eea9a4d 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -784,13 +784,13 @@ int MonthViewCell::insertEvent(Event *event) | |||
784 | 784 | ||
785 | } else { | 785 | } else { |
786 | pal = mStandardPalette ; | 786 | pal = mStandardPalette ; |
787 | } | 787 | } |
788 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); | 788 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); |
789 | item->setPalette( pal ); | 789 | item->setPalette( pal ); |
790 | item->setRecur( event->recurrence()->doesRecur() ); | 790 | item->setRecur( event->doesRecur() ); |
791 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); | 791 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); |
792 | item->setMoreInfo( event->description().length() > 0 ); | 792 | item->setMoreInfo( event->description().length() > 0 ); |
793 | #ifdef DESKTOP_VERSION | 793 | #ifdef DESKTOP_VERSION |
794 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 794 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
795 | KOPrefs::instance()->email()); | 795 | KOPrefs::instance()->email()); |
796 | if ( me != 0 ) { | 796 | if ( me != 0 ) { |
@@ -875,13 +875,13 @@ void MonthViewCell::insertTodo(Todo *todo) | |||
875 | 875 | ||
876 | } else { | 876 | } else { |
877 | pal = mStandardPalette ; | 877 | pal = mStandardPalette ; |
878 | } | 878 | } |
879 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); | 879 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); |
880 | item->setPalette( pal ); | 880 | item->setPalette( pal ); |
881 | item->setRecur( todo->recurrence()->doesRecur() ); | 881 | item->setRecur( todo->doesRecur() ); |
882 | item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); | 882 | item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); |
883 | item->setMoreInfo( todo->description().length() > 0 ); | 883 | item->setMoreInfo( todo->description().length() > 0 ); |
884 | insertItem( item , count()); | 884 | insertItem( item , count()); |
885 | #ifdef DESKTOP_VERSION | 885 | #ifdef DESKTOP_VERSION |
886 | mToolTip.append( text ); | 886 | mToolTip.append( text ); |
887 | #endif | 887 | #endif |
@@ -1102,12 +1102,14 @@ void MonthViewCell::contextMenu( QListBoxItem *item ) | |||
1102 | { | 1102 | { |
1103 | mMonthView->setPopupCell( this ); | 1103 | mMonthView->setPopupCell( this ); |
1104 | if ( !item ) { | 1104 | if ( !item ) { |
1105 | mMonthView->showContextMenu( 0 ); | 1105 | mMonthView->showContextMenu( 0 ); |
1106 | return; | 1106 | return; |
1107 | } | 1107 | } |
1108 | //selection( item ); | ||
1109 | //qApp->processEvents(); | ||
1108 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1110 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1109 | Incidence *incidence = eventItem->incidence(); | 1111 | Incidence *incidence = eventItem->incidence(); |
1110 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 1112 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
1111 | } | 1113 | } |
1112 | 1114 | ||
1113 | void MonthViewCell::selection( QListBoxItem *item ) | 1115 | void MonthViewCell::selection( QListBoxItem *item ) |
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp index 100a81b..682f83b 100644 --- a/korganizer/kotodoeditor.cpp +++ b/korganizer/kotodoeditor.cpp | |||
@@ -374,13 +374,14 @@ void KOTodoEditor::writeTodo(Todo *event) | |||
374 | event->setRecurDates(); | 374 | event->setRecurDates(); |
375 | } else { | 375 | } else { |
376 | event->setHasRecurrenceID( false ); | 376 | event->setHasRecurrenceID( false ); |
377 | } | 377 | } |
378 | } else { | 378 | } else { |
379 | event->setHasRecurrenceID( false ); | 379 | event->setHasRecurrenceID( false ); |
380 | event->recurrence()->unsetRecurs(); | 380 | if ( event->doesRecur() ) |
381 | event->recurrence()->unsetRecurs(); | ||
381 | } | 382 | } |
382 | } | 383 | } |
383 | 384 | ||
384 | bool KOTodoEditor::validateInput() | 385 | bool KOTodoEditor::validateInput() |
385 | { | 386 | { |
386 | if (!mGeneral->validateInput()) return false; | 387 | if (!mGeneral->validateInput()) return false; |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index fafcb58..f88403c 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -504,13 +504,13 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
504 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 504 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
505 | 505 | ||
506 | } else { | 506 | } else { |
507 | if (!ev->doesFloat()) { | 507 | if (!ev->doesFloat()) { |
508 | Event *event = static_cast<Event *>(ev); | 508 | Event *event = static_cast<Event *>(ev); |
509 | QDateTime st,end; | 509 | QDateTime st,end; |
510 | if ( event->recurrence()->doesRecur() ) { | 510 | if ( event->doesRecur() ) { |
511 | QDate recDate= mEventDate; | 511 | QDate recDate= mEventDate; |
512 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | 512 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); |
513 | while ( ! event->recursOn( recDate ) ) { | 513 | while ( ! event->recursOn( recDate ) ) { |
514 | recDate = recDate.addDays( -1 ); | 514 | recDate = recDate.addDays( -1 ); |
515 | 515 | ||
516 | } | 516 | } |
@@ -619,13 +619,13 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
619 | if ( ev->description().length() > 0 ) { | 619 | if ( ev->description().length() > 0 ) { |
620 | if ( !needClose) | 620 | if ( !needClose) |
621 | tempText +="["; | 621 | tempText +="["; |
622 | tempText += "i"; | 622 | tempText += "i"; |
623 | needClose =true; | 623 | needClose =true; |
624 | } | 624 | } |
625 | if ( ev->recurrence()->doesRecur() ) { | 625 | if ( ev->doesRecur() ) { |
626 | if ( !needClose) | 626 | if ( !needClose) |
627 | tempText +="["; | 627 | tempText +="["; |
628 | tempText += "r"; | 628 | tempText += "r"; |
629 | needClose =true; | 629 | needClose =true; |
630 | } | 630 | } |
631 | if ( needClose ) { | 631 | if ( needClose ) { |
diff --git a/libkcal/event.cpp b/libkcal/event.cpp index ad66639..0766fd9 100644 --- a/libkcal/event.cpp +++ b/libkcal/event.cpp | |||
@@ -170,12 +170,13 @@ void Event::setDuration(int seconds) | |||
170 | { | 170 | { |
171 | setHasEndDate(false); | 171 | setHasEndDate(false); |
172 | Incidence::setDuration(seconds); | 172 | Incidence::setDuration(seconds); |
173 | } | 173 | } |
174 | bool Event::matchTime(QDateTime*startDT, QDateTime* endDT) | 174 | bool Event::matchTime(QDateTime*startDT, QDateTime* endDT) |
175 | { | 175 | { |
176 | if ( cancelled() ) return false; | ||
176 | if ( ! doesRecur() ) { | 177 | if ( ! doesRecur() ) { |
177 | if ( doesFloat() ) { | 178 | if ( doesFloat() ) { |
178 | if ( mDtEnd.addDays( 1 ) < *startDT) | 179 | if ( mDtEnd.addDays( 1 ) < *startDT) |
179 | return false; | 180 | return false; |
180 | if ( endDT && mDtStart > * endDT) | 181 | if ( endDT && mDtStart > * endDT) |
181 | return false; | 182 | return false; |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 4794bc9..f349681 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -369,24 +369,21 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | |||
369 | if (!incidence->relatedToUid().isEmpty()) { | 369 | if (!incidence->relatedToUid().isEmpty()) { |
370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( | 370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( |
371 | incidence->relatedToUid().utf8())); | 371 | incidence->relatedToUid().utf8())); |
372 | } | 372 | } |
373 | 373 | ||
374 | // recurrence rule stuff | 374 | // recurrence rule stuff |
375 | Recurrence *recur = incidence->recurrence(); | 375 | if (incidence->doesRecur()) { |
376 | if (recur->doesRecur()) { | 376 | icalcomponent_add_property(parent,writeRecurrenceRule(incidence->recurrence())); |
377 | 377 | // recurrence excpetion dates | |
378 | icalcomponent_add_property(parent,writeRecurrenceRule(recur)); | 378 | DateList dateList = incidence->exDates(); |
379 | } | 379 | DateList::ConstIterator exIt; |
380 | 380 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { | |
381 | // recurrence excpetion dates | 381 | icalcomponent_add_property(parent,icalproperty_new_exdate( |
382 | DateList dateList = incidence->exDates(); | 382 | writeICalDate(*exIt))); |
383 | DateList::ConstIterator exIt; | 383 | } |
384 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { | ||
385 | icalcomponent_add_property(parent,icalproperty_new_exdate( | ||
386 | writeICalDate(*exIt))); | ||
387 | } | 384 | } |
388 | 385 | ||
389 | // attachments | 386 | // attachments |
390 | QPtrList<Attachment> attachments = incidence->attachments(); | 387 | QPtrList<Attachment> attachments = incidence->attachments(); |
391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) | 388 | for (Attachment *at = attachments.first(); at; at = attachments.next()) |
392 | icalcomponent_add_property(parent,writeAttachment(at)); | 389 | icalcomponent_add_property(parent,writeAttachment(at)); |
@@ -1292,13 +1289,14 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) | |||
1292 | kp = incidence->nonKDECustomProperty("X-KOPIEXTID"); | 1289 | kp = incidence->nonKDECustomProperty("X-KOPIEXTID"); |
1293 | if (!kp.isNull()) { | 1290 | if (!kp.isNull()) { |
1294 | incidence->setIDStr(kp); | 1291 | incidence->setIDStr(kp); |
1295 | } | 1292 | } |
1296 | 1293 | ||
1297 | // Cancel backwards compatibility mode for subsequent changes by the application | 1294 | // Cancel backwards compatibility mode for subsequent changes by the application |
1298 | incidence->recurrence()->setCompatVersion(); | 1295 | if ( readrec ) |
1296 | incidence->recurrence()->setCompatVersion(); | ||
1299 | 1297 | ||
1300 | // add categories | 1298 | // add categories |
1301 | incidence->setCategories(categories); | 1299 | incidence->setCategories(categories); |
1302 | 1300 | ||
1303 | // iterate through all alarms | 1301 | // iterate through all alarms |
1304 | for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); | 1302 | for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index e4bcc5e..4643a3a 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -30,13 +30,13 @@ | |||
30 | using namespace KCal; | 30 | using namespace KCal; |
31 | 31 | ||
32 | Incidence::Incidence() : | 32 | Incidence::Incidence() : |
33 | IncidenceBase(), | 33 | IncidenceBase(), |
34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) | 34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) |
35 | { | 35 | { |
36 | mRecurrence = new Recurrence(this); | 36 | mRecurrence = 0;//new Recurrence(this); |
37 | mCancelled = false; | 37 | mCancelled = false; |
38 | recreate(); | 38 | recreate(); |
39 | mHasStartDate = true; | 39 | mHasStartDate = true; |
40 | mAlarms.setAutoDelete(true); | 40 | mAlarms.setAutoDelete(true); |
41 | mAttachments.setAutoDelete(true); | 41 | mAttachments.setAutoDelete(true); |
42 | mHasRecurrenceID = false; | 42 | mHasRecurrenceID = false; |
@@ -75,13 +75,16 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) | |||
75 | 75 | ||
76 | ++it; | 76 | ++it; |
77 | } | 77 | } |
78 | mAlarms.setAutoDelete(true); | 78 | mAlarms.setAutoDelete(true); |
79 | mHasRecurrenceID = i.mHasRecurrenceID; | 79 | mHasRecurrenceID = i.mHasRecurrenceID; |
80 | mRecurrenceID = i.mRecurrenceID; | 80 | mRecurrenceID = i.mRecurrenceID; |
81 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); | 81 | if ( i.mRecurrence ) |
82 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); | ||
83 | else | ||
84 | mRecurrence = 0; | ||
82 | mHoliday = i.mHoliday ; | 85 | mHoliday = i.mHoliday ; |
83 | mBirthday = i.mBirthday; | 86 | mBirthday = i.mBirthday; |
84 | mAnniversary = i.mAnniversary; | 87 | mAnniversary = i.mAnniversary; |
85 | } | 88 | } |
86 | 89 | ||
87 | Incidence::~Incidence() | 90 | Incidence::~Incidence() |
@@ -90,13 +93,14 @@ Incidence::~Incidence() | |||
90 | Incidence *ev; | 93 | Incidence *ev; |
91 | QPtrList<Incidence> Relations = relations(); | 94 | QPtrList<Incidence> Relations = relations(); |
92 | for (ev=Relations.first();ev;ev=Relations.next()) { | 95 | for (ev=Relations.first();ev;ev=Relations.next()) { |
93 | if (ev->relatedTo() == this) ev->setRelatedTo(0); | 96 | if (ev->relatedTo() == this) ev->setRelatedTo(0); |
94 | } | 97 | } |
95 | if (relatedTo()) relatedTo()->removeRelation(this); | 98 | if (relatedTo()) relatedTo()->removeRelation(this); |
96 | delete mRecurrence; | 99 | if ( mRecurrence ) |
100 | delete mRecurrence; | ||
97 | 101 | ||
98 | } | 102 | } |
99 | 103 | ||
100 | bool Incidence::isHoliday() const | 104 | bool Incidence::isHoliday() const |
101 | { | 105 | { |
102 | return mHoliday; | 106 | return mHoliday; |
@@ -205,16 +209,30 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | |||
205 | if ( i1.dtStart() != i2.dtStart() ) | 209 | if ( i1.dtStart() != i2.dtStart() ) |
206 | return false; | 210 | return false; |
207 | } | 211 | } |
208 | } else { | 212 | } else { |
209 | return false; | 213 | return false; |
210 | } | 214 | } |
211 | if (!( *i1.recurrence() == *i2.recurrence()) ) { | 215 | if ( i1.mRecurrence != 0 && i2.mRecurrence != 0 ) { |
212 | qDebug("recurrence is NOT equal "); | 216 | if (!( *i1.mRecurrence == *i2.mRecurrence) ) { |
213 | return false; | 217 | //qDebug("recurrence is NOT equal "); |
218 | return false; | ||
219 | } | ||
220 | } else { | ||
221 | // one ( or both ) recurrence is 0 | ||
222 | if ( i1.mRecurrence == 0 ) { | ||
223 | if ( i2.mRecurrence != 0 && i2.mRecurrence->doesRecur() != Recurrence::rNone ) | ||
224 | return false; | ||
225 | } else { | ||
226 | // i1.mRecurrence != 0 | ||
227 | // i2.mRecurrence == 0 | ||
228 | if ( i1.mRecurrence->doesRecur() != Recurrence::rNone ) | ||
229 | return false; | ||
230 | } | ||
214 | } | 231 | } |
232 | |||
215 | return | 233 | return |
216 | // i1.created() == i2.created() && | 234 | // i1.created() == i2.created() && |
217 | stringCompare( i1.description(), i2.description() ) && | 235 | stringCompare( i1.description(), i2.description() ) && |
218 | stringCompare( i1.summary(), i2.summary() ) && | 236 | stringCompare( i1.summary(), i2.summary() ) && |
219 | i1.categories() == i2.categories() && | 237 | i1.categories() == i2.categories() && |
220 | // no need to compare mRelatedTo | 238 | // no need to compare mRelatedTo |
@@ -276,13 +294,14 @@ void Incidence::cloneRelations( Incidence * newInc ) | |||
276 | inc->cloneRelations( cloneInc ); | 294 | inc->cloneRelations( cloneInc ); |
277 | } | 295 | } |
278 | } | 296 | } |
279 | void Incidence::setReadOnly( bool readOnly ) | 297 | void Incidence::setReadOnly( bool readOnly ) |
280 | { | 298 | { |
281 | IncidenceBase::setReadOnly( readOnly ); | 299 | IncidenceBase::setReadOnly( readOnly ); |
282 | recurrence()->setRecurReadOnly( readOnly); | 300 | if ( mRecurrence ) |
301 | mRecurrence->setRecurReadOnly( readOnly); | ||
283 | } | 302 | } |
284 | void Incidence::setLastModifiedSubInvalid() | 303 | void Incidence::setLastModifiedSubInvalid() |
285 | { | 304 | { |
286 | mLastModifiedSub = QDateTime(); | 305 | mLastModifiedSub = QDateTime(); |
287 | if ( mRelatedTo ) | 306 | if ( mRelatedTo ) |
288 | mRelatedTo->setLastModifiedSubInvalid(); | 307 | mRelatedTo->setLastModifiedSubInvalid(); |
@@ -327,13 +346,15 @@ int Incidence::revision() const | |||
327 | } | 346 | } |
328 | 347 | ||
329 | void Incidence::setDtStart(const QDateTime &dtStart) | 348 | void Incidence::setDtStart(const QDateTime &dtStart) |
330 | { | 349 | { |
331 | 350 | ||
332 | QDateTime dt = getEvenTime(dtStart); | 351 | QDateTime dt = getEvenTime(dtStart); |
333 | recurrence()->setRecurStart( dt); | 352 | |
353 | if ( mRecurrence ) | ||
354 | mRecurrence->setRecurStart( dt); | ||
334 | IncidenceBase::setDtStart( dt ); | 355 | IncidenceBase::setDtStart( dt ); |
335 | } | 356 | } |
336 | 357 | ||
337 | void Incidence::setDescription(const QString &description) | 358 | void Incidence::setDescription(const QString &description) |
338 | { | 359 | { |
339 | if (mReadOnly) return; | 360 | if (mReadOnly) return; |
@@ -501,21 +522,20 @@ void Incidence::removeRelation(Incidence *event) | |||
501 | mRelations.removeRef(event); | 522 | mRelations.removeRef(event); |
502 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); | 523 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); |
503 | } | 524 | } |
504 | 525 | ||
505 | bool Incidence::recursOn(const QDate &qd) const | 526 | bool Incidence::recursOn(const QDate &qd) const |
506 | { | 527 | { |
507 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; | 528 | if (mRecurrence && mRecurrence->recursOnPure(qd) && !isException(qd)) return true; |
508 | else return false; | 529 | else return false; |
509 | } | 530 | } |
510 | 531 | ||
511 | void Incidence::setExDates(const DateList &exDates) | 532 | void Incidence::setExDates(const DateList &exDates) |
512 | { | 533 | { |
513 | if (mReadOnly) return; | 534 | if (mReadOnly) return; |
514 | mExDates = exDates; | 535 | mExDates = exDates; |
515 | |||
516 | recurrence()->setRecurExDatesCount(mExDates.count()); | 536 | recurrence()->setRecurExDatesCount(mExDates.count()); |
517 | 537 | ||
518 | updated(); | 538 | updated(); |
519 | } | 539 | } |
520 | 540 | ||
521 | void Incidence::addExDate(const QDate &date) | 541 | void Incidence::addExDate(const QDate &date) |
@@ -695,21 +715,27 @@ bool Incidence::isAlarmEnabled() const | |||
695 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { | 715 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { |
696 | if (alarm->enabled()) | 716 | if (alarm->enabled()) |
697 | return true; | 717 | return true; |
698 | } | 718 | } |
699 | return false; | 719 | return false; |
700 | } | 720 | } |
701 | 721 | #include <stdlib.h> | |
702 | Recurrence *Incidence::recurrence() const | 722 | Recurrence *Incidence::recurrence() |
703 | { | 723 | { |
724 | if ( ! mRecurrence ) { | ||
725 | mRecurrence = new Recurrence(this); | ||
726 | qDebug("creating new recurence "); | ||
727 | //abort(); | ||
728 | } | ||
704 | return mRecurrence; | 729 | return mRecurrence; |
705 | } | 730 | } |
706 | void Incidence::setRecurrence( Recurrence * r) | 731 | void Incidence::setRecurrence( Recurrence * r) |
707 | { | 732 | { |
708 | delete mRecurrence; | 733 | if ( mRecurrence ) |
709 | mRecurrence = r; | 734 | delete mRecurrence; |
735 | mRecurrence = r; | ||
710 | } | 736 | } |
711 | 737 | ||
712 | void Incidence::setLocation(const QString &location) | 738 | void Incidence::setLocation(const QString &location) |
713 | { | 739 | { |
714 | if (mReadOnly) return; | 740 | if (mReadOnly) return; |
715 | mLocation = location; | 741 | mLocation = location; |
@@ -717,12 +743,17 @@ void Incidence::setLocation(const QString &location) | |||
717 | } | 743 | } |
718 | 744 | ||
719 | QString Incidence::location() const | 745 | QString Incidence::location() const |
720 | { | 746 | { |
721 | return mLocation; | 747 | return mLocation; |
722 | } | 748 | } |
749 | QString Incidence::recurrenceText() const | ||
750 | { | ||
751 | if ( mRecurrence ) return mRecurrence->recurrenceText(); | ||
752 | return i18n("No"); | ||
753 | } | ||
723 | 754 | ||
724 | ushort Incidence::doesRecur() const | 755 | ushort Incidence::doesRecur() const |
725 | { | 756 | { |
726 | if ( mRecurrence ) return mRecurrence->doesRecur(); | 757 | if ( mRecurrence ) return mRecurrence->doesRecur(); |
727 | else return Recurrence::rNone; | 758 | else return Recurrence::rNone; |
728 | } | 759 | } |
@@ -730,18 +761,18 @@ ushort Incidence::doesRecur() const | |||
730 | QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const | 761 | QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const |
731 | { | 762 | { |
732 | QDateTime incidenceStart = dt; | 763 | QDateTime incidenceStart = dt; |
733 | *ok = false; | 764 | *ok = false; |
734 | if ( doesRecur() ) { | 765 | if ( doesRecur() ) { |
735 | bool last; | 766 | bool last; |
736 | recurrence()->getPreviousDateTime( incidenceStart , &last ); | 767 | mRecurrence->getPreviousDateTime( incidenceStart , &last ); |
737 | int count = 0; | 768 | int count = 0; |
738 | if ( !last ) { | 769 | if ( !last ) { |
739 | while ( !last ) { | 770 | while ( !last ) { |
740 | ++count; | 771 | ++count; |
741 | incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); | 772 | incidenceStart = mRecurrence->getNextDateTime( incidenceStart, &last ); |
742 | if ( recursOn( incidenceStart.date() ) ) { | 773 | if ( recursOn( incidenceStart.date() ) ) { |
743 | last = true; // exit while llop | 774 | last = true; // exit while llop |
744 | } else { | 775 | } else { |
745 | if ( last ) { // no alarm on last recurrence | 776 | if ( last ) { // no alarm on last recurrence |
746 | return QDateTime (); | 777 | return QDateTime (); |
747 | } | 778 | } |
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index d4af9f0..8519f01 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -246,13 +246,13 @@ class Incidence : public IncidenceBase | |||
246 | bool isAlarmEnabled() const; | 246 | bool isAlarmEnabled() const; |
247 | 247 | ||
248 | /** | 248 | /** |
249 | Return the recurrence rule associated with this incidence. If there is | 249 | Return the recurrence rule associated with this incidence. If there is |
250 | none, returns an appropriate (non-0) object. | 250 | none, returns an appropriate (non-0) object. |
251 | */ | 251 | */ |
252 | Recurrence *recurrence() const; | 252 | Recurrence *recurrence(); |
253 | void setRecurrence(Recurrence * r); | 253 | void setRecurrence(Recurrence * r); |
254 | /** | 254 | /** |
255 | Forward to Recurrence::doesRecur(). | 255 | Forward to Recurrence::doesRecur(). |
256 | */ | 256 | */ |
257 | ushort doesRecur() const; | 257 | ushort doesRecur() const; |
258 | 258 | ||
@@ -275,15 +275,17 @@ class Incidence : public IncidenceBase | |||
275 | QDateTime recurrenceID () const; | 275 | QDateTime recurrenceID () const; |
276 | QDateTime dtStart() const; | 276 | QDateTime dtStart() const; |
277 | bool isHoliday() const; | 277 | bool isHoliday() const; |
278 | bool isBirthday() const; | 278 | bool isBirthday() const; |
279 | bool isAnniversary() const; | 279 | bool isAnniversary() const; |
280 | QDateTime lastModifiedSub(); | 280 | QDateTime lastModifiedSub(); |
281 | QString recurrenceText() const; | ||
281 | void setLastModifiedSubInvalid(); | 282 | void setLastModifiedSubInvalid(); |
282 | 283 | ||
283 | 284 | ||
285 | Recurrence *mRecurrence; | ||
284 | protected: | 286 | protected: |
285 | QPtrList<Alarm> mAlarms; | 287 | QPtrList<Alarm> mAlarms; |
286 | QPtrList<Incidence> mRelations; | 288 | QPtrList<Incidence> mRelations; |
287 | QDateTime mRecurrenceID; | 289 | QDateTime mRecurrenceID; |
288 | bool mHasRecurrenceID; | 290 | bool mHasRecurrenceID; |
289 | private: | 291 | private: |
@@ -306,13 +308,12 @@ protected: | |||
306 | bool mHasStartDate; // if todo has associated start date | 308 | bool mHasStartDate; // if todo has associated start date |
307 | 309 | ||
308 | int mSecrecy; | 310 | int mSecrecy; |
309 | int mPriority; // 1 = highest, 2 = less, etc. | 311 | int mPriority; // 1 = highest, 2 = less, etc. |
310 | 312 | ||
311 | //QPtrList<Alarm> mAlarms; | 313 | //QPtrList<Alarm> mAlarms; |
312 | Recurrence *mRecurrence; | ||
313 | 314 | ||
314 | QString mLocation; | 315 | QString mLocation; |
315 | }; | 316 | }; |
316 | 317 | ||
317 | bool operator==( const Incidence&, const Incidence& ); | 318 | bool operator==( const Incidence&, const Incidence& ); |
318 | 319 | ||
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 9359fad..f8f40f1 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -102,13 +102,13 @@ void KIncidenceFormatter::setEvent(Event *event) | |||
102 | } | 102 | } |
103 | if (!event->location().isEmpty()) { | 103 | if (!event->location().isEmpty()) { |
104 | addTag("b",i18n("Location: ")); | 104 | addTag("b",i18n("Location: ")); |
105 | mText.append(deTag(event->location())+"<br>"); | 105 | mText.append(deTag(event->location())+"<br>"); |
106 | } | 106 | } |
107 | 107 | ||
108 | if (event->recurrence()->doesRecur()) { | 108 | if (event->doesRecur()) { |
109 | 109 | ||
110 | QString recurText = event->recurrence()->recurrenceText(); | 110 | QString recurText = event->recurrence()->recurrenceText(); |
111 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 111 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
112 | 112 | ||
113 | bool ok; | 113 | bool ok; |
114 | QDate start = QDate::currentDate(); | 114 | QDate start = QDate::currentDate(); |
@@ -213,13 +213,13 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
213 | addTag("i",i18n("This todo has been cancelled!")); | 213 | addTag("i",i18n("This todo has been cancelled!")); |
214 | mText.append("<br>"); | 214 | mText.append("<br>"); |
215 | mText += "</font>"; | 215 | mText += "</font>"; |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | if (event->recurrence()->doesRecur()) { | 219 | if (event->doesRecur()) { |
220 | 220 | ||
221 | QString recurText = event->recurrence()->recurrenceText(); | 221 | QString recurText = event->recurrence()->recurrenceText(); |
222 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 222 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
223 | } | 223 | } |
224 | 224 | ||
225 | if (event->hasStartDate()) { | 225 | if (event->hasStartDate()) { |
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 8efc1ea..2e19740 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -389,13 +389,13 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | |||
389 | addPropValue(vtodo, XPilotStatusProp, tmpStr.local8Bit()); | 389 | addPropValue(vtodo, XPilotStatusProp, tmpStr.local8Bit()); |
390 | } | 390 | } |
391 | 391 | ||
392 | return vtodo; | 392 | return vtodo; |
393 | } | 393 | } |
394 | 394 | ||
395 | VObject* VCalFormat::eventToVEvent(const Event *anEvent) | 395 | VObject* VCalFormat::eventToVEvent(Event *anEvent) |
396 | { | 396 | { |
397 | VObject *vevent; | 397 | VObject *vevent; |
398 | QString tmpStr; | 398 | QString tmpStr; |
399 | 399 | ||
400 | vevent = newVObject(VCEventProp); | 400 | vevent = newVObject(VCEventProp); |
401 | 401 | ||
@@ -456,13 +456,13 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) | |||
456 | addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); | 456 | addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); |
457 | addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); | 457 | addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); |
458 | } | 458 | } |
459 | } | 459 | } |
460 | 460 | ||
461 | // recurrence rule stuff | 461 | // recurrence rule stuff |
462 | if (anEvent->recurrence()->doesRecur()) { | 462 | if (anEvent->doesRecur()) { |
463 | // some more variables | 463 | // some more variables |
464 | QPtrList<Recurrence::rMonthPos> tmpPositions; | 464 | QPtrList<Recurrence::rMonthPos> tmpPositions; |
465 | QPtrList<int> tmpDays; | 465 | QPtrList<int> tmpDays; |
466 | int *tmpDay; | 466 | int *tmpDay; |
467 | Recurrence::rMonthPos *tmpPos; | 467 | Recurrence::rMonthPos *tmpPos; |
468 | QString tmpStr2; | 468 | QString tmpStr2; |
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h index c7df017..6dae3d2 100644 --- a/libkcal/vcalformat.h +++ b/libkcal/vcalformat.h | |||
@@ -71,13 +71,13 @@ class VCalFormat : public CalFormat { | |||
71 | Todo *VTodoToEvent(VObject *vtodo); | 71 | Todo *VTodoToEvent(VObject *vtodo); |
72 | /** translates a VObject into a Event and returns a pointer to it. */ | 72 | /** translates a VObject into a Event and returns a pointer to it. */ |
73 | Event *VEventToEvent(VObject *vevent); | 73 | Event *VEventToEvent(VObject *vevent); |
74 | /** translate a Event into a VTodo-type VObject and return pointer */ | 74 | /** translate a Event into a VTodo-type VObject and return pointer */ |
75 | VObject *eventToVTodo(const Todo *anEvent); | 75 | VObject *eventToVTodo(const Todo *anEvent); |
76 | /** translate a Event into a VObject and returns a pointer to it. */ | 76 | /** translate a Event into a VObject and returns a pointer to it. */ |
77 | VObject* eventToVEvent(const Event *anEvent); | 77 | VObject* eventToVEvent(Event *anEvent); |
78 | 78 | ||
79 | /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ | 79 | /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ |
80 | QString qDateToISO(const QDate &); | 80 | QString qDateToISO(const QDate &); |
81 | /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */ | 81 | /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */ |
82 | QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE); | 82 | QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE); |
83 | /** takes a string in the format YYYYMMDDTHHMMSS and returns a | 83 | /** takes a string in the format YYYYMMDDTHHMMSS and returns a |