summaryrefslogtreecommitdiffstats
path: root/libkcal/calendarlocal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkcal/calendarlocal.cpp')
-rw-r--r--libkcal/calendarlocal.cpp61
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;