author | zautrix <zautrix> | 2005-07-30 14:43:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-30 14:43:57 (UTC) |
commit | 9ca2cd947f22d33543e065f54c6487e86d80befa (patch) (side-by-side diff) | |
tree | 549192e9e27e8972e2b48cf40e1599118df12da5 /libkcal/calendar.cpp | |
parent | 055928e26613f4ab249bd82be86890ed278372f6 (diff) | |
download | kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.zip kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.gz kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.bz2 |
fixxx
-rw-r--r-- | libkcal/calendar.cpp | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index b7990d4..b1806ee 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp @@ -112,5 +112,24 @@ Calendar::~Calendar() delete mDefaultFilter; - if ( mUndoIncidence ) - delete mUndoIncidence; -} + clearUndo( 0 ); +} +void Calendar::clearUndo( Incidence * newUndo ) +{ + + 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 = newUndo; + if ( mUndoIncidence ) { + mUndoIncidence->clearRelations(); + } + +} + void Calendar::setDontDeleteIncidencesOnClose () @@ -449,3 +468,17 @@ void Calendar::removeRelations( Incidence *incidence ) // Remove this one from the orphans list - if( mOrphanUids.remove( uid ) ) + if( mOrphanUids.remove( uid ) ) { + QString r2uid = incidence->relatedToUid(); + QPtrList<Incidence> tempList; + while( Incidence* i = mOrphans[ r2uid ] ) { + mOrphans.remove( r2uid ); + if ( i != incidence ) tempList.append( i ); + } + Incidence* inc = tempList.first(); + while ( inc ) { + mOrphans.insert( r2uid, inc ); + inc = tempList.next(); + } + } + // LR: and another big bad bug found +#if 0 // This incidence is located in the orphans list - it should be removed @@ -460,2 +493,3 @@ void Calendar::removeRelations( Incidence *incidence ) } +#endif } |