summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-30 14:43:57 (UTC)
committer zautrix <zautrix>2005-07-30 14:43:57 (UTC)
commit9ca2cd947f22d33543e065f54c6487e86d80befa (patch) (side-by-side diff)
tree549192e9e27e8972e2b48cf40e1599118df12da5
parent055928e26613f4ab249bd82be86890ed278372f6 (diff)
downloadkdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.zip
kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.gz
kdepimpi-9ca2cd947f22d33543e065f54c6487e86d80befa.tar.bz2
fixxx
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libkcal/calendar.cpp38
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp26
-rw-r--r--libkcal/calendarlocal.h1
-rw-r--r--libkcal/incidence.cpp6
-rw-r--r--libkcal/incidence.h1
6 files changed, 48 insertions, 25 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 )
+ 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
}
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 95477cd..3f6895d 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -82,2 +82,3 @@ public:
virtual void stopAllTodos() = 0;
+ virtual void clearUndo( Incidence * newUndo );
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e8c969f..1a1c6be 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -270,16 +270,3 @@ 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 )
@@ -342,4 +329,3 @@ void CalendarLocal::deleteEvent( Event *event )
{
- clearUndo();
- mUndoIncidence = event;
+ clearUndo(event);
if ( mEventList.removeRef( event ) ) {
@@ -397,5 +383,4 @@ void CalendarLocal::deleteTodo( Todo *todo )
// Handle orphaned children
- clearUndo();
removeRelations( todo );
- mUndoIncidence = todo;
+ clearUndo(todo);
@@ -901,4 +886,3 @@ void CalendarLocal::deleteJournal( Journal *journal )
{
- clearUndo();
- mUndoIncidence = journal;
+ clearUndo(journal);
if ( mJournalList.removeRef(journal) ) {
@@ -981,3 +965,3 @@ void CalendarLocal::setCalendarRemove( int id )
- clearUndo();
+ clearUndo(0);
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index ae7e30c..a7a85c8 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -71,3 +71,2 @@ class CalendarLocal : public Calendar
void close();
- void clearUndo();
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 52d94fb..549014e 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -493,3 +493,7 @@ void Incidence::setRelatedToUid(const QString &relatedToUid)
}
-
+void Incidence::clearRelations()
+{
+ mRelatedTo = 0;
+ mRelations.clear();
+}
QString Incidence::relatedToUid() const
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index 88df217..eef9e64 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -116,2 +116,3 @@ class Incidence : public IncidenceBase
void addRelationsToList(QPtrList<Incidence> *rel);
+ void clearRelations();
virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0;