summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libkcal/calendarlocal.cpp31
-rw-r--r--libkcal/calendarlocal.h1
-rw-r--r--libkcal/journal.cpp4
3 files changed, 24 insertions, 12 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 5baa7dc..e8c969f 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -270,3 +270,16 @@ void CalendarLocal::close()
}
-
+ 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 )
@@ -329,4 +342,4 @@ void CalendarLocal::deleteEvent( Event *event )
{
- if ( mUndoIncidence ) delete mUndoIncidence;
- mUndoIncidence = event->clone();
+ clearUndo();
+ mUndoIncidence = event;
if ( mEventList.removeRef( event ) ) {
@@ -384,5 +397,5 @@ void CalendarLocal::deleteTodo( Todo *todo )
// Handle orphaned children
- if ( mUndoIncidence ) delete mUndoIncidence;
+ clearUndo();
removeRelations( todo );
- mUndoIncidence = todo->clone();
+ mUndoIncidence = todo;
@@ -888,5 +901,4 @@ void CalendarLocal::deleteJournal( Journal *journal )
{
- if ( mUndoIncidence ) delete mUndoIncidence;
- mUndoIncidence = journal->clone();
- mUndoIncidence->setSummary( mUndoIncidence->description().left(25));
+ clearUndo();
+ mUndoIncidence = journal;
if ( mJournalList.removeRef(journal) ) {
@@ -969,4 +981,3 @@ void CalendarLocal::setCalendarRemove( int id )
- if ( mUndoIncidence ) delete mUndoIncidence;
- mUndoIncidence = 0;
+ clearUndo();
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index a7a85c8..ae7e30c 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -71,2 +71,3 @@ class CalendarLocal : public Calendar
void close();
+ void clearUndo();
diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp
index c4e4474..328db46 100644
--- a/libkcal/journal.cpp
+++ b/libkcal/journal.cpp
@@ -26,3 +26,3 @@ Journal::Journal()
{
- qDebug("New JJJ ");
+
}
@@ -31,3 +31,3 @@ Journal::~Journal()
{
- qDebug("delete JJJ ");
+
}