summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-02-13 11:55:52 (UTC)
committer zautrix <zautrix>2005-02-13 11:55:52 (UTC)
commit0a33f91e166747406ca2ccb5819881feeecfdb40 (patch) (unidiff)
treee9130a16aaa6365e106d6733c3e1adeca01f72ac /libkcal
parent00ec9899a4727a4c9100d320935dde7da4803801 (diff)
downloadkdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.zip
kdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.tar.gz
kdepimpi-0a33f91e166747406ca2ccb5819881feeecfdb40.tar.bz2
todo recurchanges
Diffstat (limited to 'libkcal') (more/less context) (ignore 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
@@ -371,65 +371,68 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
371 incidence->relatedTo()->uid().utf8())); 371 incidence->relatedTo()->uid().utf8()));
372 } 372 }
373 373
374 // recurrence rule stuff 374 // recurrence rule stuff
375 Recurrence *recur = incidence->recurrence(); 375 Recurrence *recur = incidence->recurrence();
376 if (recur->doesRecur()) { 376 if (recur->doesRecur()) {
377 377
378 icalcomponent_add_property(parent,writeRecurrenceRule(recur)); 378 icalcomponent_add_property(parent,writeRecurrenceRule(recur));
379 } 379 }
380 380
381 // recurrence excpetion dates 381 // recurrence excpetion dates
382 DateList dateList = incidence->exDates(); 382 DateList dateList = incidence->exDates();
383 DateList::ConstIterator exIt; 383 DateList::ConstIterator exIt;
384 for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { 384 for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) {
385 icalcomponent_add_property(parent,icalproperty_new_exdate( 385 icalcomponent_add_property(parent,icalproperty_new_exdate(
386 writeICalDate(*exIt))); 386 writeICalDate(*exIt)));
387 } 387 }
388 388
389 // attachments 389 // attachments
390 QPtrList<Attachment> attachments = incidence->attachments(); 390 QPtrList<Attachment> attachments = incidence->attachments();
391 for (Attachment *at = attachments.first(); at; at = attachments.next()) 391 for (Attachment *at = attachments.first(); at; at = attachments.next())
392 icalcomponent_add_property(parent,writeAttachment(at)); 392 icalcomponent_add_property(parent,writeAttachment(at));
393 393
394 // alarms 394 // alarms
395 QPtrList<Alarm> alarms = incidence->alarms(); 395 QPtrList<Alarm> alarms = incidence->alarms();
396 Alarm* alarm; 396 Alarm* alarm;
397 for (alarm = alarms.first(); alarm; alarm = alarms.next()) { 397 for (alarm = alarms.first(); alarm; alarm = alarms.next()) {
398 if (alarm->enabled()) { 398 if (alarm->enabled()) {
399 kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; 399 kdDebug(5800) << "Write alarm for " << incidence->summary() << endl;
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
407 410
408// if (incidence->hasDuration()) { 411// if (incidence->hasDuration()) {
409// icaldurationtype duration; 412// icaldurationtype duration;
410// duration = writeICalDuration(incidence->duration()); 413// duration = writeICalDuration(incidence->duration());
411// icalcomponent_add_property(parent,icalproperty_new_duration(duration)); 414// icalcomponent_add_property(parent,icalproperty_new_duration(duration));
412// } 415// }
413} 416}
414 417
415void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) 418void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase)
416{ 419{
417 icalcomponent_add_property(parent,icalproperty_new_dtstamp( 420 icalcomponent_add_property(parent,icalproperty_new_dtstamp(
418 writeICalDateTime(QDateTime::currentDateTime()))); 421 writeICalDateTime(QDateTime::currentDateTime())));
419 422
420 // organizer stuff 423 // organizer stuff
421 icalcomponent_add_property(parent,icalproperty_new_organizer( 424 icalcomponent_add_property(parent,icalproperty_new_organizer(
422 ("MAILTO:" + incidenceBase->organizer()).utf8())); 425 ("MAILTO:" + incidenceBase->organizer()).utf8()));
423 426
424 // attendees 427 // attendees
425 if (incidenceBase->attendeeCount() != 0) { 428 if (incidenceBase->attendeeCount() != 0) {
426 QPtrList<Attendee> al = incidenceBase->attendees(); 429 QPtrList<Attendee> al = incidenceBase->attendees();
427 QPtrListIterator<Attendee> ai(al); 430 QPtrListIterator<Attendee> ai(al);
428 for (; ai.current(); ++ai) { 431 for (; ai.current(); ++ai) {
429 icalcomponent_add_property(parent,writeAttendee(ai.current())); 432 icalcomponent_add_property(parent,writeAttendee(ai.current()));
430 } 433 }
431 } 434 }
432 435
433 // custom properties 436 // custom properties
434 writeCustomProperties(parent, incidenceBase); 437 writeCustomProperties(parent, incidenceBase);
435} 438}
@@ -1175,64 +1178,69 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence)
1175 incidence->setDtStart(readICalDateTime(icaltime)); 1178 incidence->setDtStart(readICalDateTime(icaltime));
1176 } 1179 }
1177 break; 1180 break;
1178 1181
1179 case ICAL_DURATION_PROPERTY: // start date and time 1182 case ICAL_DURATION_PROPERTY: // start date and time
1180 icalduration = icalproperty_get_duration(p); 1183 icalduration = icalproperty_get_duration(p);
1181 incidence->setDuration(readICalDuration(icalduration)); 1184 incidence->setDuration(readICalDuration(icalduration));
1182 break; 1185 break;
1183 1186
1184 case ICAL_DESCRIPTION_PROPERTY: // description 1187 case ICAL_DESCRIPTION_PROPERTY: // description
1185 text = icalproperty_get_description(p); 1188 text = icalproperty_get_description(p);
1186 incidence->setDescription(QString::fromUtf8(text)); 1189 incidence->setDescription(QString::fromUtf8(text));
1187 break; 1190 break;
1188 1191
1189 case ICAL_SUMMARY_PROPERTY: // summary 1192 case ICAL_SUMMARY_PROPERTY: // summary
1190 { 1193 {
1191 text = icalproperty_get_summary(p); 1194 text = icalproperty_get_summary(p);
1192 incidence->setSummary(QString::fromUtf8(text)); 1195 incidence->setSummary(QString::fromUtf8(text));
1193 } 1196 }
1194 break; 1197 break;
1195 case ICAL_STATUS_PROPERTY: // summary 1198 case ICAL_STATUS_PROPERTY: // summary
1196 { 1199 {
1197 if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) ) 1200 if ( ICAL_STATUS_CANCELLED == icalproperty_get_status(p) )
1198 incidence->setCancelled( true ); 1201 incidence->setCancelled( true );
1199 } 1202 }
1200 break; 1203 break;
1201 1204
1202 case ICAL_LOCATION_PROPERTY: // location 1205 case ICAL_LOCATION_PROPERTY: // location
1203 text = icalproperty_get_location(p); 1206 text = icalproperty_get_location(p);
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) {
1210 incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo))); 1218 incidence->setStatus(s = fakeCString(vObjectUStringZValue(vo)));
1211 deleteStr(s); 1219 deleteStr(s);
1212 } 1220 }
1213 else 1221 else
1214 incidence->setStatus("NEEDS ACTION"); 1222 incidence->setStatus("NEEDS ACTION");
1215#endif 1223#endif
1216 1224
1217 case ICAL_PRIORITY_PROPERTY: // priority 1225 case ICAL_PRIORITY_PROPERTY: // priority
1218 intvalue = icalproperty_get_priority(p); 1226 intvalue = icalproperty_get_priority(p);
1219 incidence->setPriority(intvalue); 1227 incidence->setPriority(intvalue);
1220 break; 1228 break;
1221 1229
1222 case ICAL_CATEGORIES_PROPERTY: // categories 1230 case ICAL_CATEGORIES_PROPERTY: // categories
1223 text = icalproperty_get_categories(p); 1231 text = icalproperty_get_categories(p);
1224 categories.append(QString::fromUtf8(text)); 1232 categories.append(QString::fromUtf8(text));
1225 break; 1233 break;
1226 //******************************************* 1234 //*******************************************
1227 case ICAL_RRULE_PROPERTY: 1235 case ICAL_RRULE_PROPERTY:
1228 // we do need (maybe )start datetime of incidence for recurrence 1236 // we do need (maybe )start datetime of incidence for recurrence
1229 // such that we can read recurrence only after we read incidence completely 1237 // such that we can read recurrence only after we read incidence completely
1230 readrec = true; 1238 readrec = true;
1231 rectype = icalproperty_get_rrule(p); 1239 rectype = icalproperty_get_rrule(p);
1232 break; 1240 break;
1233 1241
1234 case ICAL_EXDATE_PROPERTY: 1242 case ICAL_EXDATE_PROPERTY:
1235 icaltime = icalproperty_get_exdate(p); 1243 icaltime = icalproperty_get_exdate(p);
1236 incidence->addExDate(readICalDate(icaltime)); 1244 incidence->addExDate(readICalDate(icaltime));
1237 break; 1245 break;
1238 1246
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index f9e1e9e..dbc159c 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -10,195 +10,228 @@
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include <kglobal.h> 21#include <kglobal.h>
22#include <klocale.h> 22#include <klocale.h>
23#include <kdebug.h> 23#include <kdebug.h>
24 24
25#include "calformat.h" 25#include "calformat.h"
26 26
27#include "incidence.h" 27#include "incidence.h"
28#include "todo.h" 28#include "todo.h"
29 29
30using namespace KCal; 30using namespace KCal;
31 31
32Incidence::Incidence() : 32Incidence::Incidence() :
33 IncidenceBase(), 33 IncidenceBase(),
34 mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) 34 mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3)
35{ 35{
36 mRecurrence = new Recurrence(this); 36 mRecurrence = new Recurrence(this);
37 mCancelled = false; 37 mCancelled = false;
38 recreate(); 38 recreate();
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 )
45{ 46{
46// TODO: reenable attributes currently commented out. 47// TODO: reenable attributes currently commented out.
47 mRevision = i.mRevision; 48 mRevision = i.mRevision;
48 mCreated = i.mCreated; 49 mCreated = i.mCreated;
49 mDescription = i.mDescription; 50 mDescription = i.mDescription;
50 mSummary = i.mSummary; 51 mSummary = i.mSummary;
51 mCategories = i.mCategories; 52 mCategories = i.mCategories;
52// Incidence *mRelatedTo; Incidence *mRelatedTo; 53// Incidence *mRelatedTo; Incidence *mRelatedTo;
53 mRelatedTo = 0; 54 mRelatedTo = 0;
54 mRelatedToUid = i.mRelatedToUid; 55 mRelatedToUid = i.mRelatedToUid;
55// QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; 56// QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations;
56 mExDates = i.mExDates; 57 mExDates = i.mExDates;
57 mAttachments = i.mAttachments; 58 mAttachments = i.mAttachments;
58 mResources = i.mResources; 59 mResources = i.mResources;
59 mSecrecy = i.mSecrecy; 60 mSecrecy = i.mSecrecy;
60 mPriority = i.mPriority; 61 mPriority = i.mPriority;
61 mLocation = i.mLocation; 62 mLocation = i.mLocation;
62 mCancelled = i.mCancelled; 63 mCancelled = i.mCancelled;
63 mHasStartDate = i.mHasStartDate; 64 mHasStartDate = i.mHasStartDate;
64 QPtrListIterator<Alarm> it( i.mAlarms ); 65 QPtrListIterator<Alarm> it( i.mAlarms );
65 const Alarm *a; 66 const Alarm *a;
66 while( (a = it.current()) ) { 67 while( (a = it.current()) ) {
67 Alarm *b = new Alarm( *a ); 68 Alarm *b = new Alarm( *a );
68 b->setParent( this ); 69 b->setParent( this );
69 mAlarms.append( b ); 70 mAlarms.append( b );
70 71
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
78Incidence::~Incidence() 80Incidence::~Incidence()
79{ 81{
80 82
81 Incidence *ev; 83 Incidence *ev;
82 QPtrList<Incidence> Relations = relations(); 84 QPtrList<Incidence> Relations = relations();
83 for (ev=Relations.first();ev;ev=Relations.next()) { 85 for (ev=Relations.first();ev;ev=Relations.next()) {
84 if (ev->relatedTo() == this) ev->setRelatedTo(0); 86 if (ev->relatedTo() == this) ev->setRelatedTo(0);
85 } 87 }
86 if (relatedTo()) relatedTo()->removeRelation(this); 88 if (relatedTo()) relatedTo()->removeRelation(this);
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{
93 return mCancelled; 115 return mCancelled;
94} 116}
95void Incidence::setCancelled( bool b ) 117void Incidence::setCancelled( bool b )
96{ 118{
97 mCancelled = b; 119 mCancelled = b;
98 updated(); 120 updated();
99} 121}
100bool Incidence::hasStartDate() const 122bool Incidence::hasStartDate() const
101{ 123{
102 return mHasStartDate; 124 return mHasStartDate;
103} 125}
104 126
105void Incidence::setHasStartDate(bool f) 127void Incidence::setHasStartDate(bool f)
106{ 128{
107 if (mReadOnly) return; 129 if (mReadOnly) return;
108 mHasStartDate = f; 130 mHasStartDate = f;
109 updated(); 131 updated();
110} 132}
111 133
112// A string comparison that considers that null and empty are the same 134// A string comparison that considers that null and empty are the same
113static bool stringCompare( const QString& s1, const QString& s2 ) 135static bool stringCompare( const QString& s1, const QString& s2 )
114{ 136{
115 if ( s1.isEmpty() && s2.isEmpty() ) 137 if ( s1.isEmpty() && s2.isEmpty() )
116 return true; 138 return true;
117 return s1 == s2; 139 return s1 == s2;
118} 140}
119 141
120bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) 142bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
121{ 143{
122 144
123 if( i1.alarms().count() != i2.alarms().count() ) { 145 if( i1.alarms().count() != i2.alarms().count() ) {
124 return false; // no need to check further 146 return false; // no need to check further
125 } 147 }
126 if ( i1.alarms().count() > 0 ) { 148 if ( i1.alarms().count() > 0 ) {
127 if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) ) 149 if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) )
128 { 150 {
129 qDebug("alarm not equal "); 151 qDebug("alarm not equal ");
130 return false; 152 return false;
131 } 153 }
132 } 154 }
133#if 0 155#if 0
134 QPtrListIterator<Alarm> a1( i1.alarms() ); 156 QPtrListIterator<Alarm> a1( i1.alarms() );
135 QPtrListIterator<Alarm> a2( i2.alarms() ); 157 QPtrListIterator<Alarm> a2( i2.alarms() );
136 for( ; a1.current() && a2.current(); ++a1, ++a2 ) { 158 for( ; a1.current() && a2.current(); ++a1, ++a2 ) {
137 if( *a1.current() == *a2.current() ) { 159 if( *a1.current() == *a2.current() ) {
138 continue; 160 continue;
139 } 161 }
140 else { 162 else {
141 return false; 163 return false;
142 } 164 }
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() ) {
149 if ( i1.hasStartDate() ) { 181 if ( i1.hasStartDate() ) {
150 if ( i1.dtStart() != i2.dtStart() ) 182 if ( i1.dtStart() != i2.dtStart() )
151 return false; 183 return false;
152 } 184 }
153 } else { 185 } else {
154 return false; 186 return false;
155 } 187 }
156 if (!( *i1.recurrence() == *i2.recurrence()) ) { 188 if (!( *i1.recurrence() == *i2.recurrence()) ) {
157 qDebug("recurrence is NOT equal "); 189 qDebug("recurrence is NOT equal ");
158 return false; 190 return false;
159 } 191 }
160 return 192 return
161 // i1.created() == i2.created() && 193 // i1.created() == i2.created() &&
162 stringCompare( i1.description(), i2.description() ) && 194 stringCompare( i1.description(), i2.description() ) &&
163 stringCompare( i1.summary(), i2.summary() ) && 195 stringCompare( i1.summary(), i2.summary() ) &&
164 i1.categories() == i2.categories() && 196 i1.categories() == i2.categories() &&
165 // no need to compare mRelatedTo 197 // no need to compare mRelatedTo
166 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && 198 stringCompare( i1.relatedToUid(), i2.relatedToUid() ) &&
167 // i1.relations() == i2.relations() && 199 // i1.relations() == i2.relations() &&
168 i1.exDates() == i2.exDates() && 200 i1.exDates() == i2.exDates() &&
169 i1.attachments() == i2.attachments() && 201 i1.attachments() == i2.attachments() &&
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
176Incidence* Incidence::recreateCloneException( QDate d ) 209Incidence* Incidence::recreateCloneException( QDate d )
177{ 210{
178 Incidence* newInc = clone(); 211 Incidence* newInc = clone();
179 newInc->recreate(); 212 newInc->recreate();
180 if ( doesRecur() ) { 213 if ( doesRecur() ) {
181 addExDate( d ); 214 addExDate( d );
182 newInc->recurrence()->unsetRecurs(); 215 newInc->recurrence()->unsetRecurs();
183 int len = dtStart().secsTo( ((Event*)this)->dtEnd()); 216 int len = dtStart().secsTo( ((Event*)this)->dtEnd());
184 QTime tim = dtStart().time(); 217 QTime tim = dtStart().time();
185 newInc->setDtStart( QDateTime(d, tim) ); 218 newInc->setDtStart( QDateTime(d, tim) );
186 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 219 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
187 } 220 }
188 return newInc; 221 return newInc;
189} 222}
190 223
191void Incidence::recreate() 224void Incidence::recreate()
192{ 225{
193 setCreated(QDateTime::currentDateTime()); 226 setCreated(QDateTime::currentDateTime());
194 227
195 setUid(CalFormat::createUniqueId()); 228 setUid(CalFormat::createUniqueId());
196 229
197 setRevision(0); 230 setRevision(0);
198 setIDStr( ":" ); 231 setIDStr( ":" );
199 setLastModified(QDateTime::currentDateTime()); 232 setLastModified(QDateTime::currentDateTime());
200} 233}
201 234
202void Incidence::setReadOnly( bool readOnly ) 235void Incidence::setReadOnly( bool readOnly )
203{ 236{
204 IncidenceBase::setReadOnly( readOnly ); 237 IncidenceBase::setReadOnly( readOnly );
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index de2a381..38d2aaa 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -234,66 +234,75 @@ class Incidence : public IncidenceBase
234 Alarm* newAlarm(); 234 Alarm* newAlarm();
235 /** Add an alarm which is associated with this incidence */ 235 /** Add an alarm which is associated with this incidence */
236 void addAlarm(Alarm*); 236 void addAlarm(Alarm*);
237 /** Remove an alarm that is associated with this incidence */ 237 /** Remove an alarm that is associated with this incidence */
238 void removeAlarm(Alarm*); 238 void removeAlarm(Alarm*);
239 /** Remove all alarms that are associated with this incidence */ 239 /** Remove all alarms that are associated with this incidence */
240 void clearAlarms(); 240 void clearAlarms();
241 /** return whether any alarm associated with this incidence is enabled */ 241 /** return whether any alarm associated with this incidence is enabled */
242 bool isAlarmEnabled() const; 242 bool isAlarmEnabled() const;
243 243
244 /** 244 /**
245 Return the recurrence rule associated with this incidence. If there is 245 Return the recurrence rule associated with this incidence. If there is
246 none, returns an appropriate (non-0) object. 246 none, returns an appropriate (non-0) object.
247 */ 247 */
248 Recurrence *recurrence() const; 248 Recurrence *recurrence() const;
249 void setRecurrence(Recurrence * r); 249 void setRecurrence(Recurrence * r);
250 /** 250 /**
251 Forward to Recurrence::doesRecur(). 251 Forward to Recurrence::doesRecur().
252 */ 252 */
253 ushort doesRecur() const; 253 ushort doesRecur() const;
254 254
255 /** set the event's/todo's location. Do _not_ use it with journal */ 255 /** set the event's/todo's location. Do _not_ use it with journal */
256 void setLocation(const QString &location); 256 void setLocation(const QString &location);
257 /** return the event's/todo's location. Do _not_ use it with journal */ 257 /** return the event's/todo's location. Do _not_ use it with journal */
258 QString location() const; 258 QString location() const;
259 /** returns TRUE or FALSE depending on whether the todo has a start date */ 259 /** returns TRUE or FALSE depending on whether the todo has a start date */
260 bool hasStartDate() const; 260 bool hasStartDate() const;
261 /** sets the event's hasStartDate value. */ 261 /** sets the event's hasStartDate value. */
262 void setHasStartDate(bool f); 262 void setHasStartDate(bool f);
263 QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; 263 QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const;
264 bool cancelled() const; 264 bool cancelled() const;
265 void setCancelled( bool b ); 265 void setCancelled( bool b );
266
267 bool hasRecurrenceID() const;
268 void setHasRecurrenceID( bool b );
269
270 void setRecurrenceID(QDateTime);
271 QDateTime recurrenceID () const;
272
266 273
267protected: 274protected:
268 QPtrList<Alarm> mAlarms; 275 QPtrList<Alarm> mAlarms;
269 QPtrList<Incidence> mRelations; 276 QPtrList<Incidence> mRelations;
270 private: 277 private:
271 int mRevision; 278 int mRevision;
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;
278 QStringList mCategories; 287 QStringList mCategories;
279 Incidence *mRelatedTo; 288 Incidence *mRelatedTo;
280 QString mRelatedToUid; 289 QString mRelatedToUid;
281 DateList mExDates; 290 DateList mExDates;
282 QPtrList<Attachment> mAttachments; 291 QPtrList<Attachment> mAttachments;
283 QStringList mResources; 292 QStringList mResources;
284 bool mHasStartDate; // if todo has associated start date 293 bool mHasStartDate; // if todo has associated start date
285 294
286 int mSecrecy; 295 int mSecrecy;
287 int mPriority; // 1 = highest, 2 = less, etc. 296 int mPriority; // 1 = highest, 2 = less, etc.
288 297
289 //QPtrList<Alarm> mAlarms; 298 //QPtrList<Alarm> mAlarms;
290 Recurrence *mRecurrence; 299 Recurrence *mRecurrence;
291 300
292 QString mLocation; 301 QString mLocation;
293}; 302};
294 303
295bool operator==( const Incidence&, const Incidence& ); 304bool operator==( const Incidence&, const Incidence& );
296 305
297} 306}
298 307
299#endif 308#endif