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 @@ -268,7 +268,20 @@ 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; @@ -327,8 +340,8 @@ bool CalendarLocal::addEvent( Event *event ) void CalendarLocal::deleteEvent( Event *event ) { - if ( mUndoIncidence ) delete mUndoIncidence; - mUndoIncidence = event->clone(); + clearUndo(); + mUndoIncidence = event; if ( mEventList.removeRef( event ) ) { setModified( true ); } @@ -382,9 +395,9 @@ bool CalendarLocal::addTodo( Todo *todo ) void CalendarLocal::deleteTodo( Todo *todo ) { // Handle orphaned children - if ( mUndoIncidence ) delete mUndoIncidence; + clearUndo(); removeRelations( todo ); - mUndoIncidence = todo->clone(); + mUndoIncidence = todo; if ( mTodoList.removeRef( todo ) ) { setModified( true ); @@ -886,9 +899,8 @@ bool CalendarLocal::addJournal(Journal *journal) 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) ) { setModified( true ); } @@ -967,8 +979,7 @@ 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 @@ -69,6 +69,7 @@ class CalendarLocal : public Calendar Clears out the current calendar, freeing all used memory etc. etc. */ void close(); + void clearUndo(); void save() {} diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp index c4e4474..328db46 100644 --- a/libkcal/journal.cpp +++ b/libkcal/journal.cpp @@ -24,12 +24,12 @@ using namespace KCal; Journal::Journal() { - qDebug("New JJJ "); + } Journal::~Journal() { - qDebug("delete JJJ "); + } Incidence *Journal::clone() |