author | zautrix <zautrix> | 2005-04-10 13:17:21 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-10 13:17:21 (UTC) |
commit | ef11b9d4de01d601bfcfb8efacb0aeff1e657edb (patch) (side-by-side diff) | |
tree | 5f4e6aa51ef357c6d9ecbe4d9a2908b8c2ca1228 /libkcal | |
parent | 04fe8f3523c46511e846a42e4bb92d6b8d33758b (diff) | |
download | kdepimpi-ef11b9d4de01d601bfcfb8efacb0aeff1e657edb.zip kdepimpi-ef11b9d4de01d601bfcfb8efacb0aeff1e657edb.tar.gz kdepimpi-ef11b9d4de01d601bfcfb8efacb0aeff1e657edb.tar.bz2 |
fix
-rw-r--r-- | libkcal/calendar.cpp | 10 | ||||
-rw-r--r-- | libkcal/calendar.h | 3 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 14 | ||||
-rw-r--r-- | libkcal/incidence.h | 1 |
4 files changed, 26 insertions, 2 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index 406cd48..ed39ddb 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp @@ -332,13 +332,21 @@ QPtrList<Event> Calendar::events( const QDate &start, const QDate &end, QPtrList<Event> Calendar::events() { QPtrList<Event> el = rawEvents(); mFilter->apply(&el); return el; } - +void Calendar::addIncidenceBranch(Incidence *i) +{ + addIncidence( i ); + Incidence * inc; + QPtrList<Incidence> Relations = i->relations(); + for (inc=Relations.first();inc;inc=Relations.next()) { + addIncidenceBranch( inc ); + } +} bool Calendar::addIncidence(Incidence *i) { Incidence::AddVisitor<Calendar> v(this); return i->accept(v); diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 2f2c3aa..ab40970 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -137,12 +137,15 @@ public: /** Add an incidence to calendar. @return true on success, false on error. */ virtual bool addIncidence( Incidence * ); + + // Adds an incidence and all relatedto incidences to the cal + void addIncidenceBranch( Incidence * ); /** Return filtered list of all incidences of this calendar. */ virtual QPtrList<Incidence> incidences(); /** diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 6bca12c..78fa24f 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -260,13 +260,25 @@ void Incidence::recreate() setUid(CalFormat::createUniqueId()); setRevision(0); setIDStr( ":" ); setLastModified(QDateTime::currentDateTime()); } - +void Incidence::cloneRelations( Incidence * newInc ) +{ + // newInc is already a clone of this incidence + Incidence * inc; + Incidence * cloneInc; + QPtrList<Incidence> Relations = relations(); + for (inc=Relations.first();inc;inc=Relations.next()) { + cloneInc = inc->clone(); + cloneInc->recreate(); + cloneInc->setRelatedTo( newInc ); + inc->cloneRelations( cloneInc ); + } +} void Incidence::setReadOnly( bool readOnly ) { IncidenceBase::setReadOnly( readOnly ); recurrence()->setRecurReadOnly( readOnly); } diff --git a/libkcal/incidence.h b/libkcal/incidence.h index f8da342..60070a2 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -109,12 +109,13 @@ class Incidence : public IncidenceBase bool accept(Visitor &v) { return v.visit(this); } </pre> */ virtual bool accept(Visitor &) { return false; } virtual Incidence *clone() = 0; + virtual void cloneRelations( Incidence * ); virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; void setReadOnly( bool ); /** Recreate event. The event is made a new unique event, but already stored |