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
@@ -269,18 +269,5 @@ 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 )
{
@@ -341,6 +328,5 @@ bool CalendarLocal::addEvent( Event *event )
void CalendarLocal::deleteEvent( Event *event )
{
- clearUndo();
- mUndoIncidence = event;
+ clearUndo(event);
if ( mEventList.removeRef( event ) ) {
setModified( true );
@@ -396,7 +382,6 @@ void CalendarLocal::deleteTodo( Todo *todo )
{
// Handle orphaned children
- clearUndo();
removeRelations( todo );
- mUndoIncidence = todo;
+ clearUndo(todo);
if ( mTodoList.removeRef( todo ) ) {
@@ -900,6 +885,5 @@ bool CalendarLocal::addJournal(Journal *journal)
void CalendarLocal::deleteJournal( Journal *journal )
{
- clearUndo();
- mUndoIncidence = journal;
+ clearUndo(journal);
if ( mJournalList.removeRef(journal) ) {
setModified( true );
@@ -980,5 +964,5 @@ void CalendarLocal::setCalendarRemove( int id )
}
- clearUndo();
+ clearUndo(0);
}