-rw-r--r-- | libkcal/calendarlocal.cpp | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index e8c969f..1a1c6be 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -267,22 +267,9 @@ void CalendarLocal::close() mJournalList.setAutoDelete( false ); setModified( false ); } - void CalendarLocal::clearUndo() -{ - if ( mUndoIncidence ) { - if ( mUndoIncidence->typeID() == eventID ) - delete ((Event*) mUndoIncidence) ; - else if ( mUndoIncidence->typeID() == todoID ) - delete ( (Todo*) mUndoIncidence ); - else if ( mUndoIncidence->typeID() == journalID ) - delete ( (Journal*) mUndoIncidence ); - else - delete mUndoIncidence; - } - mUndoIncidence = 0; -} + bool CalendarLocal::addAnniversaryNoDup( Event *event ) { QString cat; bool isBirthday = true; @@ -339,10 +326,9 @@ bool CalendarLocal::addEvent( Event *event ) } void CalendarLocal::deleteEvent( Event *event ) { - clearUndo(); - mUndoIncidence = event; + clearUndo(event); if ( mEventList.removeRef( event ) ) { setModified( true ); } } @@ -394,11 +380,10 @@ bool CalendarLocal::addTodo( Todo *todo ) void CalendarLocal::deleteTodo( Todo *todo ) { // Handle orphaned children - clearUndo(); removeRelations( todo ); - mUndoIncidence = todo; + clearUndo(todo); if ( mTodoList.removeRef( todo ) ) { setModified( true ); } @@ -898,10 +883,9 @@ bool CalendarLocal::addJournal(Journal *journal) } void CalendarLocal::deleteJournal( Journal *journal ) { - clearUndo(); - mUndoIncidence = journal; + clearUndo(journal); if ( mJournalList.removeRef(journal) ) { setModified( true ); } } @@ -978,9 +962,9 @@ void CalendarLocal::setCalendarRemove( int id ) ev = JournalList.next(); } } - clearUndo(); + clearUndo(0); } void CalendarLocal::setCalendarEnabled( int id, bool enable ) |