summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-04-10 13:17:21 (UTC)
committer zautrix <zautrix>2005-04-10 13:17:21 (UTC)
commitef11b9d4de01d601bfcfb8efacb0aeff1e657edb (patch) (side-by-side diff)
tree5f4e6aa51ef357c6d9ecbe4d9a2908b8c2ca1228 /libkcal
parent04fe8f3523c46511e846a42e4bb92d6b8d33758b (diff)
downloadkdepimpi-ef11b9d4de01d601bfcfb8efacb0aeff1e657edb.zip
kdepimpi-ef11b9d4de01d601bfcfb8efacb0aeff1e657edb.tar.gz
kdepimpi-ef11b9d4de01d601bfcfb8efacb0aeff1e657edb.tar.bz2
fix
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/calendar.cpp10
-rw-r--r--libkcal/calendar.h3
-rw-r--r--libkcal/incidence.cpp14
-rw-r--r--libkcal/incidence.h1
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
@@ -326,25 +326,33 @@ QPtrList<Event> Calendar::events( const QDate &start, const QDate &end,
{
QPtrList<Event> el = rawEvents(start,end,inclusive);
mFilter->apply(&el);
return el;
}
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);
}
void Calendar::deleteIncidence(Incidence *in)
{
if ( in->type() == "Event" )
deleteEvent( (Event*) in );
else if ( in->type() =="Todo" )
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 2f2c3aa..ab40970 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -131,24 +131,27 @@ public:
void setLocalTime();
/**
Return whether local time is being used.
*/
bool isLocalTime() const;
/**
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();
/**
Return unfiltered list of all incidences of this calendar.
*/
virtual QPtrList<Incidence> rawIncidences();
/**
Adds a Event to this calendar object.
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 6bca12c..78fa24f 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -254,25 +254,37 @@ Incidence* Incidence::recreateCloneException( QDate d )
}
void Incidence::recreate()
{
setCreated(QDateTime::currentDateTime());
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);
}
void Incidence::setCreated(QDateTime created)
{
if (mReadOnly) return;
mCreated = getEvenTime(created);
}
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index f8da342..60070a2 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -103,24 +103,25 @@ class Incidence : public IncidenceBase
~Incidence();
/**
Accept IncidenceVisitor. A class taking part in the visitor mechanism has to
provide this implementation:
<pre>
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
event information is preserved. Sets uniquie id, creation date, last
modification date and revision number.
*/
void recreate();
Incidence* recreateCloneException(QDate);