diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-08-27 23:01:53 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-08-27 23:01:53 +0000 |
commit | cfa6b4114cea52b167caaaeb417f98f83edd690f (patch) | |
tree | 5fb46adfe9f1caf37e2716e79b148176b09574ab /libkcal/calendarlocal.cpp | |
parent | a3e46fcf743ccdac7c2461658898ca254bf64dd6 (diff) | |
download | tdepim-cfa6b4114cea52b167caaaeb417f98f83edd690f.tar.gz tdepim-cfa6b4114cea52b167caaaeb417f98f83edd690f.zip |
Initial (i.e. read only) support for RECURRENCE-ID modified incidence series.
Write support requires further debugging and/or compliance checks with respect to Zimbra;
there is no obvious reason why it should not be working but Zimbra fails with 409 when saving.
User interface support is mostly complete, with event links being tracked across deletes.
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1168937 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkcal/calendarlocal.cpp')
-rw-r--r-- | libkcal/calendarlocal.cpp | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 39c48ae4b..716fa5e98 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -126,6 +126,10 @@ bool CalendarLocal::deleteEvent( Event *event ) setModified( true ); notifyIncidenceDeleted( event ); mDeletedIncidences.append( event ); + // Delete child events + if (!event->hasRecurrenceID()) { + deleteChildEvents(event); + } return true; } else { kdWarning() << "CalendarLocal::deleteEvent(): Event not found." << endl; @@ -133,6 +137,21 @@ bool CalendarLocal::deleteEvent( Event *event ) } } +bool CalendarLocal::deleteChildEvents( Event *event ) +{ + EventDictIterator it( mEvents ); + for( ; it.current(); ++it ) { + Event *e = *it; + if (e->uid() == event->uid()) { + if ( e->hasRecurrenceID() ) { + deleteEvent(( e )); + } + } + } + + return true; +} + void CalendarLocal::deleteAllEvents() { // kdDebug(5800) << "CalendarLocal::deleteAllEvents" << endl; @@ -178,6 +197,10 @@ bool CalendarLocal::deleteTodo( Todo *todo ) setModified( true ); notifyIncidenceDeleted( todo ); mDeletedIncidences.append( todo ); + // Delete child todos + if (!todo->hasRecurrenceID()) { + deleteChildTodos(todo); + } return true; } else { kdWarning() << "CalendarLocal::deleteTodo(): Todo not found." << endl; @@ -185,6 +208,21 @@ bool CalendarLocal::deleteTodo( Todo *todo ) } } +bool CalendarLocal::deleteChildTodos( Todo *todo ) +{ + Todo::List::ConstIterator it; + for( it = mTodoList.begin(); it != mTodoList.end(); ++it ) { + Todo *t = *it; + if (t->uid() == todo->uid()) { + if ( t->hasRecurrenceID() ) { + deleteTodo(( t )); + } + } + } + + return true; +} + void CalendarLocal::deleteAllTodos() { // kdDebug(5800) << "CalendarLocal::deleteAllTodos()\n"; @@ -392,13 +430,13 @@ Event::List CalendarLocal::rawEventsForDate( const TQDate &qd, int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() ); int i; for ( i = 0; i <= extraDays; i++ ) { - if ( event->recursOn( qd.addDays( -i ) ) ) { + if ( event->recursOn( qd.addDays( -i ), this ) ) { eventList.append( event ); break; } } } else { - if ( event->recursOn( qd ) ) + if ( event->recursOn( qd, this ) ) eventList.append( event ); } } else { @@ -527,6 +565,10 @@ bool CalendarLocal::deleteJournal( Journal *journal ) setModified( true ); notifyIncidenceDeleted( journal ); mDeletedIncidences.append( journal ); + // Delete child journals + if (!journal->hasRecurrenceID()) { + deleteChildJournals(journal); + } return true; } else { kdWarning() << "CalendarLocal::deleteJournal(): Journal not found." << endl; @@ -534,6 +576,21 @@ bool CalendarLocal::deleteJournal( Journal *journal ) } } +bool CalendarLocal::deleteChildJournals( Journal *journal ) +{ + Journal::List::ConstIterator it; + for( it = mJournalList.begin(); it != mJournalList.end(); ++it ) { + Journal *j = *it; + if (j->uid() == journal->uid()) { + if ( j->hasRecurrenceID() ) { + deleteJournal(( j )); + } + } + } + + return true; +} + void CalendarLocal::deleteAllJournals() { Journal::List::ConstIterator it; |