-rw-r--r-- | libkcal/calendarlocal.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 3f46d53..12294c0 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -147,21 +147,21 @@ bool CalendarLocal::addEvent( Event *event ) setModified( true ); return true; } void CalendarLocal::deleteEvent( Event *event ) { - - - if ( mEventList.removeRef( event ) ) { - setModified( true ); - } + if ( mUndoIncidence ) delete mUndoIncidence; + mUndoIncidence = event->clone(); + if ( mEventList.removeRef( event ) ) { + setModified( true ); + } } Event *CalendarLocal::event( const QString &uid ) { Event *event; @@ -196,17 +196,19 @@ bool CalendarLocal::addTodo( Todo *todo ) setModified( true ); return true; } void CalendarLocal::deleteTodo( Todo *todo ) { // Handle orphaned children - removeRelations( todo ); + if ( mUndoIncidence ) delete mUndoIncidence; + mUndoIncidence = todo->clone(); + removeRelations( todo ); if ( mTodoList.removeRef( todo ) ) { setModified( true ); } } QPtrList<Todo> CalendarLocal::rawTodos() { @@ -682,16 +684,19 @@ bool CalendarLocal::addJournal(Journal *journal) setModified( true ); return true; } void CalendarLocal::deleteJournal( Journal *journal ) { + if ( mUndoIncidence ) delete mUndoIncidence; + mUndoIncidence = journal->clone(); + mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); if ( mJournalList.removeRef(journal) ) { setModified( true ); } } Journal *CalendarLocal::journal( const QDate &date ) { // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; |