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 | 22 | ||||
-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 | 1 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 4 | ||||
-rw-r--r-- | libkcal/event.cpp | 1 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 10 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 53 | ||||
-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, 87 insertions, 47 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a76f2ed..a9d42f0 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3759,7 +3759,7 @@ void CalendarView::deleteEvent(Event *anEvent) | |||
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()) { |
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 0dd5ef5..c738f7e 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -579,7 +579,7 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
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); |
@@ -999,7 +999,7 @@ void KOAgenda::endItemAction() | |||
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 ); |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 303a92a..49ad9b8 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -234,7 +234,7 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | |||
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; |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index a01323a..04f30bb 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1201,7 +1201,7 @@ void KOAgendaView::fillAgenda() | |||
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 ) ) { |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index ec1154a..057df0d 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -453,7 +453,7 @@ void KODayMatrix::updateViewTimed() | |||
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; |
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index de4e4f7..89504db 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp | |||
@@ -897,16 +897,17 @@ void KOEditorRecurrence::readEvent(Incidence *event) | |||
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(); | ||
901 | int f = r->frequency(); | ||
902 | 900 | ||
903 | int recurs = r->doesRecur(); | 901 | |
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 ) { | |
909 | Recurrence *r = event->recurrence(); | ||
910 | int f = r->frequency(); | ||
910 | switch ( recurs ) { | 911 | switch ( recurs ) { |
911 | case Recurrence::rNone: | 912 | case Recurrence::rNone: |
912 | setDefaults( event->dtStart(), dtEnd ); | 913 | setDefaults( event->dtStart(), dtEnd ); |
@@ -984,13 +985,14 @@ void KOEditorRecurrence::readEvent(Incidence *event) | |||
984 | setDefaults( event->dtStart(), dtEnd ); | 985 | setDefaults( event->dtStart(), dtEnd ); |
985 | break; | 986 | break; |
986 | } | 987 | } |
987 | 988 | } | |
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 | { |
@@ -1007,12 +1009,16 @@ void KOEditorRecurrence::readEvent(Incidence *event) | |||
1007 | 1009 | ||
1008 | void KOEditorRecurrence::writeEvent( Incidence *event ) | 1010 | void KOEditorRecurrence::writeEvent( Incidence *event ) |
1009 | { | 1011 | { |
1012 | |||
1013 | |||
1014 | if ( !mEnabledCheck->isChecked() ) { | ||
1015 | if ( event->doesRecur() ) | ||
1016 | event->recurrence()->unsetRecurs(); | ||
1017 | } else { | ||
1010 | Recurrence *r = event->recurrence(); | 1018 | Recurrence *r = event->recurrence(); |
1011 | 1019 | ||
1012 | // clear out any old settings; | 1020 | // clear out any old settings; |
1013 | r->unsetRecurs(); | 1021 | r->unsetRecurs(); |
1014 | |||
1015 | if ( mEnabledCheck->isChecked() ) { | ||
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(); |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index a690ab1..db695f5 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -347,9 +347,9 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
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(); |
@@ -481,7 +481,7 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
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>"); |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index d25f671..e7a5e0e 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -133,7 +133,7 @@ bool ListItemVisitor::visit(Event *e) | |||
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,"---"); |
@@ -184,7 +184,7 @@ bool ListItemVisitor::visit(Todo *t) | |||
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()) { |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 498d9b0..eea9a4d 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -787,7 +787,7 @@ int MonthViewCell::insertEvent(Event *event) | |||
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 |
@@ -878,7 +878,7 @@ void MonthViewCell::insertTodo(Todo *todo) | |||
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()); |
@@ -1105,6 +1105,8 @@ void MonthViewCell::contextMenu( QListBoxItem *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 ); |
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp index 100a81b..682f83b 100644 --- a/korganizer/kotodoeditor.cpp +++ b/korganizer/kotodoeditor.cpp | |||
@@ -377,6 +377,7 @@ void KOTodoEditor::writeTodo(Todo *event) | |||
377 | } | 377 | } |
378 | } else { | 378 | } else { |
379 | event->setHasRecurrenceID( false ); | 379 | event->setHasRecurrenceID( false ); |
380 | if ( event->doesRecur() ) | ||
380 | event->recurrence()->unsetRecurs(); | 381 | event->recurrence()->unsetRecurs(); |
381 | } | 382 | } |
382 | } | 383 | } |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index fafcb58..f88403c 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -507,7 +507,7 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
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 ) ) { |
@@ -622,7 +622,7 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a | |||
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"; |
diff --git a/libkcal/event.cpp b/libkcal/event.cpp index ad66639..0766fd9 100644 --- a/libkcal/event.cpp +++ b/libkcal/event.cpp | |||
@@ -173,6 +173,7 @@ void Event::setDuration(int 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) |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 4794bc9..f349681 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -372,12 +372,8 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | |||
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 | |||
378 | icalcomponent_add_property(parent,writeRecurrenceRule(recur)); | ||
379 | } | ||
380 | |||
381 | // recurrence excpetion dates | 377 | // recurrence excpetion dates |
382 | DateList dateList = incidence->exDates(); | 378 | DateList dateList = incidence->exDates(); |
383 | DateList::ConstIterator exIt; | 379 | DateList::ConstIterator exIt; |
@@ -385,6 +381,7 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | |||
385 | icalcomponent_add_property(parent,icalproperty_new_exdate( | 381 | icalcomponent_add_property(parent,icalproperty_new_exdate( |
386 | writeICalDate(*exIt))); | 382 | writeICalDate(*exIt))); |
387 | } | 383 | } |
384 | } | ||
388 | 385 | ||
389 | // attachments | 386 | // attachments |
390 | QPtrList<Attachment> attachments = incidence->attachments(); | 387 | QPtrList<Attachment> attachments = incidence->attachments(); |
@@ -1295,6 +1292,7 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) | |||
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 |
1295 | if ( readrec ) | ||
1298 | incidence->recurrence()->setCompatVersion(); | 1296 | incidence->recurrence()->setCompatVersion(); |
1299 | 1297 | ||
1300 | // add categories | 1298 | // add categories |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index e4bcc5e..4643a3a 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -33,7 +33,7 @@ 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; |
@@ -78,7 +78,10 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) | |||
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 | if ( i.mRecurrence ) | ||
81 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); | 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; |
@@ -93,6 +96,7 @@ Incidence::~Incidence() | |||
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); |
99 | if ( mRecurrence ) | ||
96 | delete mRecurrence; | 100 | delete mRecurrence; |
97 | 101 | ||
98 | } | 102 | } |
@@ -208,10 +212,24 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | |||
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) ) { |
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 ) | ||
213 | return false; | 229 | return false; |
214 | } | 230 | } |
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() ) && |
@@ -279,7 +297,8 @@ void Incidence::cloneRelations( Incidence * newInc ) | |||
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 | { |
@@ -330,7 +349,9 @@ 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 | ||
@@ -504,7 +525,7 @@ void Incidence::removeRelation(Incidence *event) | |||
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 | ||
@@ -512,7 +533,6 @@ 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(); |
@@ -698,13 +718,19 @@ bool Incidence::isAlarmEnabled() const | |||
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 | { |
733 | if ( mRecurrence ) | ||
708 | delete mRecurrence; | 734 | delete mRecurrence; |
709 | mRecurrence = r; | 735 | mRecurrence = r; |
710 | } | 736 | } |
@@ -720,6 +746,11 @@ 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 | { |
@@ -733,12 +764,12 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const | |||
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 { |
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index d4af9f0..8519f01 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -249,7 +249,7 @@ class Incidence : public IncidenceBase | |||
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(). |
@@ -278,9 +278,11 @@ class Incidence : public IncidenceBase | |||
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; |
@@ -309,7 +311,6 @@ protected: | |||
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 | }; |
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 9359fad..f8f40f1 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -105,7 +105,7 @@ void KIncidenceFormatter::setEvent(Event *event) | |||
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>"); |
@@ -216,7 +216,7 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
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>"); |
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 8efc1ea..2e19740 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -392,7 +392,7 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | |||
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; |
@@ -459,7 +459,7 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) | |||
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; |
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h index c7df017..6dae3d2 100644 --- a/libkcal/vcalformat.h +++ b/libkcal/vcalformat.h | |||
@@ -74,7 +74,7 @@ class VCalFormat : public CalFormat { | |||
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 &); |