summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore 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
@@ -269,5 +269,18 @@ void CalendarLocal::close()
269 setModified( false ); 269 setModified( false );
270} 270}
271 271 void CalendarLocal::clearUndo()
272{
273 if ( mUndoIncidence ) {
274 if ( mUndoIncidence->typeID() == eventID )
275 delete ((Event*) mUndoIncidence) ;
276 else if ( mUndoIncidence->typeID() == todoID )
277 delete ( (Todo*) mUndoIncidence );
278 else if ( mUndoIncidence->typeID() == journalID )
279 delete ( (Journal*) mUndoIncidence );
280 else
281 delete mUndoIncidence;
282 }
283 mUndoIncidence = 0;
284}
272bool CalendarLocal::addAnniversaryNoDup( Event *event ) 285bool CalendarLocal::addAnniversaryNoDup( Event *event )
273{ 286{
@@ -328,6 +341,6 @@ bool CalendarLocal::addEvent( Event *event )
328void CalendarLocal::deleteEvent( Event *event ) 341void CalendarLocal::deleteEvent( Event *event )
329{ 342{
330 if ( mUndoIncidence ) delete mUndoIncidence; 343 clearUndo();
331 mUndoIncidence = event->clone(); 344 mUndoIncidence = event;
332 if ( mEventList.removeRef( event ) ) { 345 if ( mEventList.removeRef( event ) ) {
333 setModified( true ); 346 setModified( true );
@@ -383,7 +396,7 @@ void CalendarLocal::deleteTodo( Todo *todo )
383{ 396{
384 // Handle orphaned children 397 // Handle orphaned children
385 if ( mUndoIncidence ) delete mUndoIncidence; 398 clearUndo();
386 removeRelations( todo ); 399 removeRelations( todo );
387 mUndoIncidence = todo->clone(); 400 mUndoIncidence = todo;
388 401
389 if ( mTodoList.removeRef( todo ) ) { 402 if ( mTodoList.removeRef( todo ) ) {
@@ -887,7 +900,6 @@ bool CalendarLocal::addJournal(Journal *journal)
887void CalendarLocal::deleteJournal( Journal *journal ) 900void CalendarLocal::deleteJournal( Journal *journal )
888{ 901{
889 if ( mUndoIncidence ) delete mUndoIncidence; 902 clearUndo();
890 mUndoIncidence = journal->clone(); 903 mUndoIncidence = journal;
891 mUndoIncidence->setSummary( mUndoIncidence->description().left(25));
892 if ( mJournalList.removeRef(journal) ) { 904 if ( mJournalList.removeRef(journal) ) {
893 setModified( true ); 905 setModified( true );
@@ -968,6 +980,5 @@ void CalendarLocal::setCalendarRemove( int id )
968 } 980 }
969 981
970 if ( mUndoIncidence ) delete mUndoIncidence; 982 clearUndo();
971 mUndoIncidence = 0;
972 983
973} 984}
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index a7a85c8..ae7e30c 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -70,4 +70,5 @@ class CalendarLocal : public Calendar
70 */ 70 */
71 void close(); 71 void close();
72 void clearUndo();
72 73
73 void save() {} 74 void save() {}
diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp
index c4e4474..328db46 100644
--- a/libkcal/journal.cpp
+++ b/libkcal/journal.cpp
@@ -25,10 +25,10 @@ using namespace KCal;
25Journal::Journal() 25Journal::Journal()
26{ 26{
27 qDebug("New JJJ "); 27
28} 28}
29 29
30Journal::~Journal() 30Journal::~Journal()
31{ 31{
32 qDebug("delete JJJ "); 32
33} 33}
34 34