summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
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
@@ -400,7 +400,10 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
400 icalcomponent_add_component(parent,writeAlarm(alarm)); 400 icalcomponent_add_component(parent,writeAlarm(alarm));
401 } 401 }
402 } 402 }
403 403 if( incidence->hasRecurrenceID() ) {
404 icalcomponent_add_property(parent,
405 icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID())));
406 }
404 // duration 407 // duration
405 408
406// turned off as it always is set to PTS0 (and must not occur together with DTEND 409// turned off as it always is set to PTS0 (and must not occur together with DTEND
@@ -1204,6 +1207,11 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence)
1204 incidence->setLocation(QString::fromUtf8(text)); 1207 incidence->setLocation(QString::fromUtf8(text));
1205 break; 1208 break;
1206 1209
1210 case ICAL_RECURRENCEID_PROPERTY:
1211 icaltime = icalproperty_get_recurrenceid(p);
1212 incidence->setRecurrenceID( readICalDateTime(icaltime) );
1213 qDebug(" RecurrenceID %s",incidence->recurrenceID().toString().latin1() );
1214 break;
1207#if 0 1215#if 0
1208 // status 1216 // status
1209 if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) { 1217 if ((vo = isAPropertyOf(vincidence, VCStatusProp)) != 0) {
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index f9e1e9e..dbc159c 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -39,6 +39,7 @@ Incidence::Incidence() :
39 mHasStartDate = true; 39 mHasStartDate = true;
40 mAlarms.setAutoDelete(true); 40 mAlarms.setAutoDelete(true);
41 mAttachments.setAutoDelete(true); 41 mAttachments.setAutoDelete(true);
42 mHasRecurrenceID = false;
42} 43}
43 44
44Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) 45Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
@@ -71,7 +72,8 @@ Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
71 ++it; 72 ++it;
72 } 73 }
73 mAlarms.setAutoDelete(true); 74 mAlarms.setAutoDelete(true);
74 75 mHasRecurrenceID = i.mHasRecurrenceID;
76 mRecurrenceID = i.mRecurrenceID;
75 mRecurrence = new Recurrence( *(i.mRecurrence), this ); 77 mRecurrence = new Recurrence( *(i.mRecurrence), this );
76} 78}
77 79
@@ -87,6 +89,26 @@ Incidence::~Incidence()
87 delete mRecurrence; 89 delete mRecurrence;
88 90
89} 91}
92bool Incidence::hasRecurrenceID() const
93{
94 return mHasRecurrenceID;
95}
96
97void Incidence::setHasRecurrenceID( bool b )
98{
99 mHasRecurrenceID = b;
100}
101
102void Incidence::setRecurrenceID(QDateTime d)
103{
104 mRecurrenceID = d;
105 mHasRecurrenceID = true;
106 updated();
107}
108QDateTime Incidence::recurrenceID () const
109{
110 return mRecurrenceID;
111}
90 112
91bool Incidence::cancelled() const 113bool Incidence::cancelled() const
92{ 114{
@@ -143,6 +165,16 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
143 } 165 }
144#endif 166#endif
145 167
168 if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) {
169 if ( i1.hasRecurrenceID() ) {
170 if ( i1.recurrenceID() != i2.recurrenceID() )
171 return false;
172 }
173
174 } else {
175 return false;
176 }
177
146 if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) 178 if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) )
147 return false; 179 return false;
148 if ( i1.hasStartDate() == i2.hasStartDate() ) { 180 if ( i1.hasStartDate() == i2.hasStartDate() ) {
@@ -170,6 +202,7 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
170 i1.resources() == i2.resources() && 202 i1.resources() == i2.resources() &&
171 i1.secrecy() == i2.secrecy() && 203 i1.secrecy() == i2.secrecy() &&
172 i1.priority() == i2.priority() && 204 i1.priority() == i2.priority() &&
205 i1.cancelled() == i2.cancelled() &&
173 stringCompare( i1.location(), i2.location() ); 206 stringCompare( i1.location(), i2.location() );
174} 207}
175 208
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index de2a381..38d2aaa 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -264,6 +264,13 @@ class Incidence : public IncidenceBase
264 bool cancelled() const; 264 bool cancelled() const;
265 void setCancelled( bool b ); 265 void setCancelled( bool b );
266 266
267 bool hasRecurrenceID() const;
268 void setHasRecurrenceID( bool b );
269
270 void setRecurrenceID(QDateTime);
271 QDateTime recurrenceID () const;
272
273
267protected: 274protected:
268 QPtrList<Alarm> mAlarms; 275 QPtrList<Alarm> mAlarms;
269 QPtrList<Incidence> mRelations; 276 QPtrList<Incidence> mRelations;
@@ -272,6 +279,8 @@ protected:
272 bool mCancelled; 279 bool mCancelled;
273 280
274 // base components of jounal, event and todo 281 // base components of jounal, event and todo
282 QDateTime mRecurrenceID;
283 bool mHasRecurrenceID;
275 QDateTime mCreated; 284 QDateTime mCreated;
276 QString mDescription; 285 QString mDescription;
277 QString mSummary; 286 QString mSummary;