summaryrefslogtreecommitdiffabout
path: root/libkcal
Side-by-side diff
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/icalformatimpl.cpp10
-rw-r--r--libkcal/incidence.cpp35
-rw-r--r--libkcal/incidence.h9
3 files changed, 52 insertions, 2 deletions
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index bd13132..bb9cb29 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -399,9 +399,12 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
kdDebug(5800) << "Write alarm for " << incidence->summary() << endl;
icalcomponent_add_component(parent,writeAlarm(alarm));
}
}
-
+ if( incidence->hasRecurrenceID() ) {
+ icalcomponent_add_property(parent,
+ icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID())));
+ }
// duration
// turned off as it always is set to PTS0 (and must not occur together with DTEND
@@ -1203,8 +1206,13 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence)
text = icalproperty_get_location(p);
incidence->setLocation(QString::fromUtf8(text));
break;
+ case ICAL_RECURRENCEID_PROPERTY:
+ icaltime = icalproperty_get_recurrenceid(p);
+ incidence->setRecurrenceID( readICalDateTime(icaltime) );
+ qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() );
+ break;
#if 0
// status
if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) {
incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo)));
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index f9e1e9e..dbc159c 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -38,8 +38,9 @@ Incidence::Incidence() :
recreate();
mHasStartDate = true;
mAlarms.setAutoDelete(true);
mAttachments.setAutoDelete(true);
+ mHasRecurrenceID = false;
}
Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
{
@@ -70,9 +71,10 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
++it;
}
mAlarms.setAutoDelete(true);
-
+ mHasRecurrenceID = i.mHasRecurrenceID;
+ mRecurrenceID = i.mRecurrenceID;
mRecurrence = new Recurrence( *(i.mRecurrence), this );
}
Incidence::~Incidence()
@@ -86,8 +88,28 @@ Incidence::~Incidence()
if (relatedTo()) relatedTo()->removeRelation(this);
delete mRecurrence;
}
+bool Incidence::hasRecurrenceID() const
+{
+ return mHasRecurrenceID;
+}
+
+void Incidence::setHasRecurrenceID( bool b )
+{
+ mHasRecurrenceID = b;
+}
+
+void Incidence::setRecurrenceID(QDateTime d)
+{
+ mRecurrenceID = d;
+ mHasRecurrenceID = true;
+ updated();
+}
+QDateTime Incidence::recurrenceID () const
+{
+ return mRecurrenceID;
+}
bool Incidence::cancelled() const
{
return mCancelled;
@@ -142,8 +164,18 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
}
}
#endif
+ if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) {
+ if ( i1.hasRecurrenceID() ) {
+ if ( i1.recurrenceID() != i2.recurrenceID() )
+ return false;
+ }
+
+ } else {
+ return false;
+ }
+
if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) )
return false;
if ( i1.hasStartDate() == i2.hasStartDate() ) {
if ( i1.hasStartDate() ) {
@@ -169,8 +201,9 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
i1.attachments() == i2.attachments() &&
i1.resources() == i2.resources() &&
i1.secrecy() == i2.secrecy() &&
i1.priority() == i2.priority() &&
+ i1.cancelled() == i2.cancelled() &&
stringCompare( i1.location(), i2.location() );
}
Incidence* Incidence::recreateCloneException( QDate d )
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index de2a381..38d2aaa 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -263,16 +263,25 @@ class Incidence : public IncidenceBase
QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const;
bool cancelled() const;
void setCancelled( bool b );
+ bool hasRecurrenceID() const;
+ void setHasRecurrenceID( bool b );
+
+ void setRecurrenceID(QDateTime);
+ QDateTime recurrenceID () const;
+
+
protected:
QPtrList<Alarm> mAlarms;
QPtrList<Incidence> mRelations;
private:
int mRevision;
bool mCancelled;
// base components of jounal, event and todo
+ QDateTime mRecurrenceID;
+ bool mHasRecurrenceID;
QDateTime mCreated;
QString mDescription;
QString mSummary;
QStringList mCategories;