author | zautrix <zautrix> | 2005-07-30 14:43:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-30 14:43:57 (UTC) |
commit | 9ca2cd947f22d33543e065f54c6487e86d80befa (patch) (unidiff) | |
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 | |||
@@ -110,9 +110,28 @@ void Calendar::init() | |||
110 | Calendar::~Calendar() | 110 | Calendar::~Calendar() |
111 | { | 111 | { |
112 | delete mDefaultFilter; | 112 | delete mDefaultFilter; |
113 | if ( mUndoIncidence ) | 113 | clearUndo( 0 ); |
114 | delete mUndoIncidence; | 114 | } |
115 | } | 115 | void Calendar::clearUndo( Incidence * newUndo ) |
116 | { | ||
117 | |||
118 | if ( mUndoIncidence ) { | ||
119 | if ( mUndoIncidence->typeID() == eventID ) | ||
120 | delete ((Event*) mUndoIncidence) ; | ||
121 | else if ( mUndoIncidence->typeID() == todoID ) | ||
122 | delete ( (Todo*) mUndoIncidence ); | ||
123 | else if ( mUndoIncidence->typeID() == journalID ) | ||
124 | delete ( (Journal*) mUndoIncidence ); | ||
125 | else | ||
126 | delete mUndoIncidence; | ||
127 | } | ||
128 | mUndoIncidence = newUndo; | ||
129 | if ( mUndoIncidence ) { | ||
130 | mUndoIncidence->clearRelations(); | ||
131 | } | ||
132 | |||
133 | } | ||
134 | |||
116 | void Calendar::setDontDeleteIncidencesOnClose () | 135 | void Calendar::setDontDeleteIncidencesOnClose () |
117 | { | 136 | { |
118 | mDeleteIncidencesOnClose = false; | 137 | mDeleteIncidencesOnClose = false; |
@@ -447,7 +466,21 @@ void Calendar::removeRelations( Incidence *incidence ) | |||
447 | incidence->relatedTo()->removeRelation( incidence ); | 466 | incidence->relatedTo()->removeRelation( incidence ); |
448 | 467 | ||
449 | // Remove this one from the orphans list | 468 | // Remove this one from the orphans list |
450 | if( mOrphanUids.remove( uid ) ) | 469 | if( mOrphanUids.remove( uid ) ) { |
470 | QString r2uid = incidence->relatedToUid(); | ||
471 | QPtrList<Incidence> tempList; | ||
472 | while( Incidence* i = mOrphans[ r2uid ] ) { | ||
473 | mOrphans.remove( r2uid ); | ||
474 | if ( i != incidence ) tempList.append( i ); | ||
475 | } | ||
476 | Incidence* inc = tempList.first(); | ||
477 | while ( inc ) { | ||
478 | mOrphans.insert( r2uid, inc ); | ||
479 | inc = tempList.next(); | ||
480 | } | ||
481 | } | ||
482 | // LR: and another big bad bug found | ||
483 | #if 0 | ||
451 | // This incidence is located in the orphans list - it should be removed | 484 | // This incidence is located in the orphans list - it should be removed |
452 | if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { | 485 | if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { |
453 | // Removing wasn't that easy | 486 | // Removing wasn't that easy |
@@ -458,6 +491,7 @@ void Calendar::removeRelations( Incidence *incidence ) | |||
458 | } | 491 | } |
459 | } | 492 | } |
460 | } | 493 | } |
494 | #endif | ||
461 | } | 495 | } |
462 | 496 | ||
463 | void Calendar::registerObserver( Observer *observer ) | 497 | void Calendar::registerObserver( Observer *observer ) |