summaryrefslogtreecommitdiffabout
path: root/libkcal/calendarlocal.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/calendarlocal.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/calendarlocal.cpp26
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
@@ -268,20 +268,7 @@ void CalendarLocal::close()
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;
@@ -340,8 +327,7 @@ bool CalendarLocal::addEvent( Event *event )
void CalendarLocal::deleteEvent( Event *event )
{
- clearUndo();
- mUndoIncidence = event;
+ clearUndo(event);
if ( mEventList.removeRef( event ) ) {
setModified( true );
}
@@ -395,9 +381,8 @@ 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 );
@@ -899,8 +884,7 @@ bool CalendarLocal::addJournal(Journal *journal)
void CalendarLocal::deleteJournal( Journal *journal )
{
- clearUndo();
- mUndoIncidence = journal;
+ clearUndo(journal);
if ( mJournalList.removeRef(journal) ) {
setModified( true );
}
@@ -979,7 +963,7 @@ void CalendarLocal::setCalendarRemove( int id )
}
}
- clearUndo();
+ clearUndo(0);
}