author | zautrix <zautrix> | 2005-07-30 08:08:47 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-30 08:08:47 (UTC) |
commit | 055928e26613f4ab249bd82be86890ed278372f6 (patch) (side-by-side diff) | |
tree | 0dfc4cba815a2ba0b30c71fbd74b340e2bcc8572 | |
parent | 9cbd19485635dc0edacd14403e4c63d6d469bfce (diff) | |
download | kdepimpi-055928e26613f4ab249bd82be86890ed278372f6.zip kdepimpi-055928e26613f4ab249bd82be86890ed278372f6.tar.gz kdepimpi-055928e26613f4ab249bd82be86890ed278372f6.tar.bz2 |
fixxx
-rw-r--r-- | libkcal/calendarlocal.cpp | 31 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 | ||||
-rw-r--r-- | libkcal/journal.cpp | 4 |
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 "); + } |