summaryrefslogtreecommitdiff
authortille <tille>2003-05-15 13:20:20 (UTC)
committer tille <tille>2003-05-15 13:20:20 (UTC)
commit7a5aff141f755ea67fccfee7ccc4fbbd3d3c0b94 (patch) (unidiff)
treee7503907e2ef21dae71141abb0954a5f3c43fe34
parent5b0993378eb33f4bf576b91286ece24d49806ccf (diff)
downloadopie-7a5aff141f755ea67fccfee7ccc4fbbd3d3c0b94.zip
opie-7a5aff141f755ea67fccfee7ccc4fbbd3d3c0b94.tar.gz
opie-7a5aff141f755ea67fccfee7ccc4fbbd3d3c0b94.tar.bz2
how did this compile last time...? ;)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/oevent.cpp10
-rw-r--r--libopie2/opiepim/oevent.cpp10
2 files changed, 10 insertions, 10 deletions
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp
index 2b138c0..83b191f 100644
--- a/libopie/pim/oevent.cpp
+++ b/libopie/pim/oevent.cpp
@@ -24,401 +24,401 @@ int OCalendarHelper::week( const QDate& date) {
24} 24}
25int OCalendarHelper::ocurrence( const QDate& date) { 25int OCalendarHelper::ocurrence( const QDate& date) {
26 // calculates the number of occurrances of this day of the 26 // calculates the number of occurrances of this day of the
27 // week till the given date (e.g 3rd Wednesday of the month) 27 // week till the given date (e.g 3rd Wednesday of the month)
28 return ( date.day() - 1 ) / 7 + 1; 28 return ( date.day() - 1 ) / 7 + 1;
29} 29}
30int OCalendarHelper::dayOfWeek( char day ) { 30int OCalendarHelper::dayOfWeek( char day ) {
31 int dayOfWeek = 1; 31 int dayOfWeek = 1;
32 char i = ORecur::MON; 32 char i = ORecur::MON;
33 while ( !( i & day ) && i <= ORecur::SUN ) { 33 while ( !( i & day ) && i <= ORecur::SUN ) {
34 i <<= 1; 34 i <<= 1;
35 ++dayOfWeek; 35 ++dayOfWeek;
36 } 36 }
37 return dayOfWeek; 37 return dayOfWeek;
38} 38}
39int OCalendarHelper::monthDiff( const QDate& first, const QDate& second ) { 39int OCalendarHelper::monthDiff( const QDate& first, const QDate& second ) {
40 return ( second.year() - first.year() ) * 12 + 40 return ( second.year() - first.year() ) * 12 +
41 second.month() - first.month(); 41 second.month() - first.month();
42} 42}
43 43
44struct OEvent::Data : public QShared { 44struct OEvent::Data : public QShared {
45 Data() : QShared() { 45 Data() : QShared() {
46 child = 0; 46 child = 0;
47 recur = 0; 47 recur = 0;
48 manager = 0; 48 manager = 0;
49 isAllDay = false; 49 isAllDay = false;
50 parent = 0; 50 parent = 0;
51 } 51 }
52 ~Data() { 52 ~Data() {
53 delete manager; 53 delete manager;
54 delete recur; 54 delete recur;
55 } 55 }
56 QString description; 56 QString description;
57 QString location; 57 QString location;
58 OPimNotifyManager* manager; 58 OPimNotifyManager* manager;
59 ORecur* recur; 59 ORecur* recur;
60 QString note; 60 QString note;
61 QDateTime created; 61 QDateTime created;
62 QDateTime start; 62 QDateTime start;
63 QDateTime end; 63 QDateTime end;
64 bool isAllDay : 1; 64 bool isAllDay : 1;
65 QString timezone; 65 QString timezone;
66 QArray<int>* child; 66 QArray<int>* child;
67 int parent; 67 int parent;
68}; 68};
69 69
70OEvent::OEvent( int uid ) 70OEvent::OEvent( int uid )
71 : OPimRecord( uid ) { 71 : OPimRecord( uid ) {
72 data = new Data; 72 data = new Data;
73} 73}
74OEvent::OEvent( const OEvent& ev) 74OEvent::OEvent( const OEvent& ev)
75 : OPimRecord( ev ), data( ev.data ) 75 : OPimRecord( ev ), data( ev.data )
76{ 76{
77 data->ref(); 77 data->ref();
78} 78}
79OEvent::~OEvent() { 79OEvent::~OEvent() {
80 if ( data->deref() ) { 80 if ( data->deref() ) {
81 delete data; 81 delete data;
82 data = 0; 82 data = 0;
83 } 83 }
84} 84}
85OEvent& OEvent::operator=( const OEvent& ev) { 85OEvent& OEvent::operator=( const OEvent& ev) {
86 if ( this == &ev ) return *this; 86 if ( this == &ev ) return *this;
87 87
88 OPimRecord::operator=( ev ); 88 OPimRecord::operator=( ev );
89 ev.data->ref(); 89 ev.data->ref();
90 deref(); 90 deref();
91 data = ev.data; 91 data = ev.data;
92 92
93 93
94 return *this; 94 return *this;
95} 95}
96QString OEvent::description()const { 96QString OEvent::description()const {
97 return data->description; 97 return data->description;
98} 98}
99void OEvent::setDescription( const QString& description ) { 99void OEvent::setDescription( const QString& description ) {
100 changeOrModify(); 100 changeOrModify();
101 data->description = description; 101 data->description = description;
102} 102}
103void OEvent::setLocation( const QString& loc ) { 103void OEvent::setLocation( const QString& loc ) {
104 changeOrModify(); 104 changeOrModify();
105 data->location = loc; 105 data->location = loc;
106} 106}
107QString OEvent::location()const { 107QString OEvent::location()const {
108 return data->location; 108 return data->location;
109} 109}
110OPimNotifyManager &OEvent::notifiers()const { 110OPimNotifyManager &OEvent::notifiers()const {
111 // I hope we can skip the changeOrModify here 111 // I hope we can skip the changeOrModify here
112 // the notifier should take care of it 112 // the notifier should take care of it
113 // and OPimNotify is shared too 113 // and OPimNotify is shared too
114 if (!data->manager ) 114 if (!data->manager )
115 data->manager = new OPimNotifyManager; 115 data->manager = new OPimNotifyManager;
116 116
117 return *data->manager; 117 return *data->manager;
118} 118}
119bool OEvent::hasNotifiers()const { 119bool OEvent::hasNotifiers()const {
120 if (!data->manager ) 120 if (!data->manager )
121 return false; 121 return false;
122 if (data->manager->reminders().isEmpty() && 122 if (data->manager->reminders().isEmpty() &&
123 data->manager->alarms().isEmpty() ) 123 data->manager->alarms().isEmpty() )
124 return false; 124 return false;
125 125
126 return true; 126 return true;
127} 127}
128ORecur OEvent::recurrence()const { 128ORecur OEvent::recurrence()const {
129 if (!data->recur) 129 if (!data->recur)
130 data->recur = new ORecur; 130 data->recur = new ORecur;
131 131
132 return *data->recur; 132 return *data->recur;
133} 133}
134void OEvent::setRecurrence( const ORecur& rec) { 134void OEvent::setRecurrence( const ORecur& rec) {
135 changeOrModify(); 135 changeOrModify();
136 if (data->recur ) 136 if (data->recur )
137 (*data->recur) = rec; 137 (*data->recur) = rec;
138 else 138 else
139 data->recur = new ORecur( rec ); 139 data->recur = new ORecur( rec );
140} 140}
141bool OEvent::hasRecurrence()const { 141bool OEvent::hasRecurrence()const {
142 if (!data->recur ) return false; 142 if (!data->recur ) return false;
143 return data->recur->doesRecur(); 143 return data->recur->doesRecur();
144} 144}
145QString OEvent::note()const { 145QString OEvent::note()const {
146 return data->note; 146 return data->note;
147} 147}
148void OEvent::setNote( const QString& note ) { 148void OEvent::setNote( const QString& note ) {
149 changeOrModify(); 149 changeOrModify();
150 data->note = note; 150 data->note = note;
151} 151}
152QDateTime OEvent::createdDateTime()const { 152QDateTime OEvent::createdDateTime()const {
153 return data->created; 153 return data->created;
154} 154}
155void OEvent::setCreatedDateTime( const QDateTime& time ) { 155void OEvent::setCreatedDateTime( const QDateTime& time ) {
156 changeOrModify(); 156 changeOrModify();
157 data->created = time; 157 data->created = time;
158} 158}
159QDateTime OEvent::startDateTime()const { 159QDateTime OEvent::startDateTime()const {
160 if ( data->isAllDay ) 160 if ( data->isAllDay )
161 return QDateTime( data->start.date(), QTime(0, 0, 0 ) ); 161 return QDateTime( data->start.date(), QTime(0, 0, 0 ) );
162 return data->start; 162 return data->start;
163} 163}
164QDateTime OEvent::startDateTimeInZone()const { 164QDateTime OEvent::startDateTimeInZone()const {
165 /* if no timezone, or all day event or if the current and this timeZone match... */ 165 /* if no timezone, or all day event or if the current and this timeZone match... */
166 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime(); 166 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime();
167 167
168 OTimeZone zone(data->timezone ); 168 OTimeZone zone(data->timezone );
169 return zone.toDateTime( data->start, OTimeZone::current() ); 169 return zone.toDateTime( data->start, OTimeZone::current() );
170} 170}
171void OEvent::setStartDateTime( const QDateTime& dt ) { 171void OEvent::setStartDateTime( const QDateTime& dt ) {
172 changeOrModify(); 172 changeOrModify();
173 data->start = dt; 173 data->start = dt;
174} 174}
175QDateTime OEvent::endDateTime()const { 175QDateTime OEvent::endDateTime()const {
176 /* 176 /*
177 * if all Day event the end time needs 177 * if all Day event the end time needs
178 * to be on the same day as the start 178 * to be on the same day as the start
179 */ 179 */
180 if ( data->isAllDay ) 180 if ( data->isAllDay )
181 return QDateTime( data->start.date(), QTime(23, 59, 59 ) ); 181 return QDateTime( data->start.date(), QTime(23, 59, 59 ) );
182 return data->end; 182 return data->end;
183} 183}
184QDateTime OEvent::endDateTimeInZone()const { 184QDateTime OEvent::endDateTimeInZone()const {
185 /* if no timezone, or all day event or if the current and this timeZone match... */ 185 /* if no timezone, or all day event or if the current and this timeZone match... */
186 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime(); 186 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime();
187 187
188 OTimeZone zone(data->timezone ); 188 OTimeZone zone(data->timezone );
189 return zone.toDateTime( data->end, OTimeZone::current() ); 189 return zone.toDateTime( data->end, OTimeZone::current() );
190} 190}
191void OEvent::setEndDateTime( const QDateTime& dt ) { 191void OEvent::setEndDateTime( const QDateTime& dt ) {
192 changeOrModify(); 192 changeOrModify();
193 data->end = dt; 193 data->end = dt;
194} 194}
195bool OEvent::isMultipleDay()const { 195bool OEvent::isMultipleDay()const {
196 return data->end.date().day() - data->start.date().day(); 196 return data->end.date().day() - data->start.date().day();
197} 197}
198bool OEvent::isAllDay()const { 198bool OEvent::isAllDay()const {
199 return data->isAllDay; 199 return data->isAllDay;
200} 200}
201void OEvent::setAllDay( bool allDay ) { 201void OEvent::setAllDay( bool allDay ) {
202 changeOrModify(); 202 changeOrModify();
203 data->isAllDay = allDay; 203 data->isAllDay = allDay;
204 if (allDay ) data->timezone = "UTC"; 204 if (allDay ) data->timezone = "UTC";
205} 205}
206void OEvent::setTimeZone( const QString& tz ) { 206void OEvent::setTimeZone( const QString& tz ) {
207 changeOrModify(); 207 changeOrModify();
208 data->timezone = tz; 208 data->timezone = tz;
209} 209}
210QString OEvent::timeZone()const { 210QString OEvent::timeZone()const {
211 if (data->isAllDay ) return QString::fromLatin1("UTC"); 211 if (data->isAllDay ) return QString::fromLatin1("UTC");
212 return data->timezone; 212 return data->timezone;
213} 213}
214bool OEvent::match( const QRegExp& re )const { 214bool OEvent::match( const QRegExp& re )const {
215 if ( re.match( data->description ) != -1 ){ 215 if ( re.match( data->description ) != -1 ){
216 setLastHitField( DatebookDescription ); 216 setLastHitField( Qtopia::DatebookDescription );
217 return true; 217 return true;
218 } 218 }
219 if ( re.match( data->note ) != -1 ){ 219 if ( re.match( data->note ) != -1 ){
220 setLastHitField( Note ); 220 setLastHitField( Qtopia::Note );
221 return true; 221 return true;
222 } 222 }
223 if ( re.match( data->location ) != -1 ){ 223 if ( re.match( data->location ) != -1 ){
224 setLastHitField( Location ); 224 setLastHitField( Qtopia::Location );
225 return true; 225 return true;
226 } 226 }
227 if ( re.match( data->start.toString() ) != -1 ){ 227 if ( re.match( data->start.toString() ) != -1 ){
228 setLastHitField( StartDateTime ); 228 setLastHitField( Qtopia::StartDateTime );
229 return true; 229 return true;
230 } 230 }
231 if ( re.match( data->end.toString() ) != -1 ){ 231 if ( re.match( data->end.toString() ) != -1 ){
232 setLastHitField( EndDateTime ); 232 setLastHitField( Qtopia::EndDateTime );
233 return true; 233 return true;
234 } 234 }
235 return false; 235 return false;
236} 236}
237QString OEvent::toRichText()const { 237QString OEvent::toRichText()const {
238 QString text; 238 QString text;
239 if ( !description().isEmpty() ) { 239 if ( !description().isEmpty() ) {
240 text += "<b>" + QObject::tr( "Description:") + "</b><br>"; 240 text += "<b>" + QObject::tr( "Description:") + "</b><br>";
241 text += Qtopia::escapeString(description() ). 241 text += Qtopia::escapeString(description() ).
242 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 242 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
243 } 243 }
244 if ( startDateTime().isValid() ) { 244 if ( startDateTime().isValid() ) {
245 text += "<b>" + QObject::tr( "Start:") + "</b> "; 245 text += "<b>" + QObject::tr( "Start:") + "</b> ";
246 text += Qtopia::escapeString(startDateTime().toString() ). 246 text += Qtopia::escapeString(startDateTime().toString() ).
247 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 247 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
248 } 248 }
249 if ( endDateTime().isValid() ) { 249 if ( endDateTime().isValid() ) {
250 text += "<b>" + QObject::tr( "End:") + "</b> "; 250 text += "<b>" + QObject::tr( "End:") + "</b> ";
251 text += Qtopia::escapeString(endDateTime().toString() ). 251 text += Qtopia::escapeString(endDateTime().toString() ).
252 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 252 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
253 } 253 }
254 if ( !note().isEmpty() ) { 254 if ( !note().isEmpty() ) {
255 text += "<b>" + QObject::tr( "Note:") + "</b><br>"; 255 text += "<b>" + QObject::tr( "Note:") + "</b><br>";
256 text += note(); 256 text += note();
257// text += Qtopia::escapeString(note() ). 257// text += Qtopia::escapeString(note() ).
258// replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 258// replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
259 } 259 }
260 return text; 260 return text;
261} 261}
262QString OEvent::toShortText()const { 262QString OEvent::toShortText()const {
263 QString text; 263 QString text;
264 text += QString::number( startDateTime().date().day() ); 264 text += QString::number( startDateTime().date().day() );
265 text += "."; 265 text += ".";
266 text += QString::number( startDateTime().date().month() ); 266 text += QString::number( startDateTime().date().month() );
267 text += "."; 267 text += ".";
268 text += QString::number( startDateTime().date().year() ); 268 text += QString::number( startDateTime().date().year() );
269 text += " "; 269 text += " ";
270 text += QString::number( startDateTime().time().hour() ); 270 text += QString::number( startDateTime().time().hour() );
271 text += ":"; 271 text += ":";
272 text += QString::number( startDateTime().time().minute() ); 272 text += QString::number( startDateTime().time().minute() );
273 text += " - "; 273 text += " - ";
274 text += description(); 274 text += description();
275 return text; 275 return text;
276} 276}
277QString OEvent::type()const { 277QString OEvent::type()const {
278 return QString::fromLatin1("OEvent"); 278 return QString::fromLatin1("OEvent");
279} 279}
280QString OEvent::recordField( int /*id */ )const { 280QString OEvent::recordField( int /*id */ )const {
281 return QString::null; 281 return QString::null;
282} 282}
283int OEvent::rtti() { 283int OEvent::rtti() {
284 return OPimResolver::DateBook; 284 return OPimResolver::DateBook;
285} 285}
286bool OEvent::loadFromStream( QDataStream& ) { 286bool OEvent::loadFromStream( QDataStream& ) {
287 return true; 287 return true;
288} 288}
289bool OEvent::saveToStream( QDataStream& )const { 289bool OEvent::saveToStream( QDataStream& )const {
290 return true; 290 return true;
291} 291}
292void OEvent::changeOrModify() { 292void OEvent::changeOrModify() {
293 if ( data->count != 1 ) { 293 if ( data->count != 1 ) {
294 data->deref(); 294 data->deref();
295 Data* d2 = new Data; 295 Data* d2 = new Data;
296 d2->description = data->description; 296 d2->description = data->description;
297 d2->location = data->location; 297 d2->location = data->location;
298 298
299 if (data->manager ) 299 if (data->manager )
300 d2->manager = new OPimNotifyManager( *data->manager ); 300 d2->manager = new OPimNotifyManager( *data->manager );
301 301
302 if ( data->recur ) 302 if ( data->recur )
303 d2->recur = new ORecur( *data->recur ); 303 d2->recur = new ORecur( *data->recur );
304 304
305 d2->note = data->note; 305 d2->note = data->note;
306 d2->created = data->created; 306 d2->created = data->created;
307 d2->start = data->start; 307 d2->start = data->start;
308 d2->end = data->end; 308 d2->end = data->end;
309 d2->isAllDay = data->isAllDay; 309 d2->isAllDay = data->isAllDay;
310 d2->timezone = data->timezone; 310 d2->timezone = data->timezone;
311 d2->parent = data->parent; 311 d2->parent = data->parent;
312 312
313 if ( data->child ) { 313 if ( data->child ) {
314 d2->child = new QArray<int>( *data->child ); 314 d2->child = new QArray<int>( *data->child );
315 d2->child->detach(); 315 d2->child->detach();
316 } 316 }
317 317
318 data = d2; 318 data = d2;
319 } 319 }
320} 320}
321void OEvent::deref() { 321void OEvent::deref() {
322 if ( data->deref() ) { 322 if ( data->deref() ) {
323 delete data; 323 delete data;
324 data = 0; 324 data = 0;
325 } 325 }
326} 326}
327// FIXME 327// FIXME
328QMap<int, QString> OEvent::toMap()const { 328QMap<int, QString> OEvent::toMap()const {
329 return QMap<int, QString>(); 329 return QMap<int, QString>();
330} 330}
331QMap<QString, QString> OEvent::toExtraMap()const { 331QMap<QString, QString> OEvent::toExtraMap()const {
332 return QMap<QString, QString>(); 332 return QMap<QString, QString>();
333} 333}
334int OEvent::parent()const { 334int OEvent::parent()const {
335 return data->parent; 335 return data->parent;
336} 336}
337void OEvent::setParent( int uid ) { 337void OEvent::setParent( int uid ) {
338 changeOrModify(); 338 changeOrModify();
339 data->parent = uid; 339 data->parent = uid;
340} 340}
341QArray<int> OEvent::children() const{ 341QArray<int> OEvent::children() const{
342 if (!data->child) return QArray<int>(); 342 if (!data->child) return QArray<int>();
343 else 343 else
344 return data->child->copy(); 344 return data->child->copy();
345} 345}
346void OEvent::setChildren( const QArray<int>& arr ) { 346void OEvent::setChildren( const QArray<int>& arr ) {
347 changeOrModify(); 347 changeOrModify();
348 if (data->child) delete data->child; 348 if (data->child) delete data->child;
349 349
350 data->child = new QArray<int>( arr ); 350 data->child = new QArray<int>( arr );
351 data->child->detach(); 351 data->child->detach();
352} 352}
353void OEvent::addChild( int uid ) { 353void OEvent::addChild( int uid ) {
354 changeOrModify(); 354 changeOrModify();
355 if (!data->child ) { 355 if (!data->child ) {
356 data->child = new QArray<int>(1); 356 data->child = new QArray<int>(1);
357 (*data->child)[0] = uid; 357 (*data->child)[0] = uid;
358 }else{ 358 }else{
359 int count = data->child->count(); 359 int count = data->child->count();
360 data->child->resize( count + 1 ); 360 data->child->resize( count + 1 );
361 (*data->child)[count] = uid; 361 (*data->child)[count] = uid;
362 } 362 }
363} 363}
364void OEvent::removeChild( int uid ) { 364void OEvent::removeChild( int uid ) {
365 if (!data->child || !data->child->contains( uid ) ) return; 365 if (!data->child || !data->child->contains( uid ) ) return;
366 changeOrModify(); 366 changeOrModify();
367 QArray<int> newAr( data->child->count() - 1 ); 367 QArray<int> newAr( data->child->count() - 1 );
368 int j = 0; 368 int j = 0;
369 uint count = data->child->count(); 369 uint count = data->child->count();
370 for ( uint i = 0; i < count; i++ ) { 370 for ( uint i = 0; i < count; i++ ) {
371 if ( (*data->child)[i] != uid ) { 371 if ( (*data->child)[i] != uid ) {
372 newAr[j] = (*data->child)[i]; 372 newAr[j] = (*data->child)[i];
373 j++; 373 j++;
374 } 374 }
375 } 375 }
376 (*data->child) = newAr; 376 (*data->child) = newAr;
377} 377}
378struct OEffectiveEvent::Data : public QShared { 378struct OEffectiveEvent::Data : public QShared {
379 Data() : QShared() { 379 Data() : QShared() {
380 } 380 }
381 OEvent event; 381 OEvent event;
382 QDate date; 382 QDate date;
383 QTime start, end; 383 QTime start, end;
384 QDate startDate, endDate; 384 QDate startDate, endDate;
385 bool dates : 1; 385 bool dates : 1;
386}; 386};
387 387
388OEffectiveEvent::OEffectiveEvent() { 388OEffectiveEvent::OEffectiveEvent() {
389 data = new Data; 389 data = new Data;
390 data->date = QDate::currentDate(); 390 data->date = QDate::currentDate();
391 data->start = data->end = QTime::currentTime(); 391 data->start = data->end = QTime::currentTime();
392 data->dates = false; 392 data->dates = false;
393} 393}
394OEffectiveEvent::OEffectiveEvent( const OEvent& ev, const QDate& startDate, 394OEffectiveEvent::OEffectiveEvent( const OEvent& ev, const QDate& startDate,
395 Position pos ) { 395 Position pos ) {
396 data = new Data; 396 data = new Data;
397 data->event = ev; 397 data->event = ev;
398 data->date = startDate; 398 data->date = startDate;
399 if ( pos & Start ) 399 if ( pos & Start )
400 data->start = ev.startDateTime().time(); 400 data->start = ev.startDateTime().time();
401 else 401 else
402 data->start = QTime( 0, 0, 0 ); 402 data->start = QTime( 0, 0, 0 );
403 403
404 if ( pos & End ) 404 if ( pos & End )
405 data->end = ev.endDateTime().time(); 405 data->end = ev.endDateTime().time();
406 else 406 else
407 data->end = QTime( 23, 59, 59 ); 407 data->end = QTime( 23, 59, 59 );
408 408
409 data->dates = false; 409 data->dates = false;
410} 410}
411OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev) { 411OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev) {
412 data = ev.data; 412 data = ev.data;
413 data->ref(); 413 data->ref();
414} 414}
415OEffectiveEvent::~OEffectiveEvent() { 415OEffectiveEvent::~OEffectiveEvent() {
416 if ( data->deref() ) { 416 if ( data->deref() ) {
417 delete data; 417 delete data;
418 data = 0; 418 data = 0;
419 } 419 }
420} 420}
421OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev ) { 421OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev ) {
422 if ( *this == ev ) return *this; 422 if ( *this == ev ) return *this;
423 423
424 ev.data->ref(); 424 ev.data->ref();
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp
index 2b138c0..83b191f 100644
--- a/libopie2/opiepim/oevent.cpp
+++ b/libopie2/opiepim/oevent.cpp
@@ -24,401 +24,401 @@ int OCalendarHelper::week( const QDate& date) {
24} 24}
25int OCalendarHelper::ocurrence( const QDate& date) { 25int OCalendarHelper::ocurrence( const QDate& date) {
26 // calculates the number of occurrances of this day of the 26 // calculates the number of occurrances of this day of the
27 // week till the given date (e.g 3rd Wednesday of the month) 27 // week till the given date (e.g 3rd Wednesday of the month)
28 return ( date.day() - 1 ) / 7 + 1; 28 return ( date.day() - 1 ) / 7 + 1;
29} 29}
30int OCalendarHelper::dayOfWeek( char day ) { 30int OCalendarHelper::dayOfWeek( char day ) {
31 int dayOfWeek = 1; 31 int dayOfWeek = 1;
32 char i = ORecur::MON; 32 char i = ORecur::MON;
33 while ( !( i & day ) && i <= ORecur::SUN ) { 33 while ( !( i & day ) && i <= ORecur::SUN ) {
34 i <<= 1; 34 i <<= 1;
35 ++dayOfWeek; 35 ++dayOfWeek;
36 } 36 }
37 return dayOfWeek; 37 return dayOfWeek;
38} 38}
39int OCalendarHelper::monthDiff( const QDate& first, const QDate& second ) { 39int OCalendarHelper::monthDiff( const QDate& first, const QDate& second ) {
40 return ( second.year() - first.year() ) * 12 + 40 return ( second.year() - first.year() ) * 12 +
41 second.month() - first.month(); 41 second.month() - first.month();
42} 42}
43 43
44struct OEvent::Data : public QShared { 44struct OEvent::Data : public QShared {
45 Data() : QShared() { 45 Data() : QShared() {
46 child = 0; 46 child = 0;
47 recur = 0; 47 recur = 0;
48 manager = 0; 48 manager = 0;
49 isAllDay = false; 49 isAllDay = false;
50 parent = 0; 50 parent = 0;
51 } 51 }
52 ~Data() { 52 ~Data() {
53 delete manager; 53 delete manager;
54 delete recur; 54 delete recur;
55 } 55 }
56 QString description; 56 QString description;
57 QString location; 57 QString location;
58 OPimNotifyManager* manager; 58 OPimNotifyManager* manager;
59 ORecur* recur; 59 ORecur* recur;
60 QString note; 60 QString note;
61 QDateTime created; 61 QDateTime created;
62 QDateTime start; 62 QDateTime start;
63 QDateTime end; 63 QDateTime end;
64 bool isAllDay : 1; 64 bool isAllDay : 1;
65 QString timezone; 65 QString timezone;
66 QArray<int>* child; 66 QArray<int>* child;
67 int parent; 67 int parent;
68}; 68};
69 69
70OEvent::OEvent( int uid ) 70OEvent::OEvent( int uid )
71 : OPimRecord( uid ) { 71 : OPimRecord( uid ) {
72 data = new Data; 72 data = new Data;
73} 73}
74OEvent::OEvent( const OEvent& ev) 74OEvent::OEvent( const OEvent& ev)
75 : OPimRecord( ev ), data( ev.data ) 75 : OPimRecord( ev ), data( ev.data )
76{ 76{
77 data->ref(); 77 data->ref();
78} 78}
79OEvent::~OEvent() { 79OEvent::~OEvent() {
80 if ( data->deref() ) { 80 if ( data->deref() ) {
81 delete data; 81 delete data;
82 data = 0; 82 data = 0;
83 } 83 }
84} 84}
85OEvent& OEvent::operator=( const OEvent& ev) { 85OEvent& OEvent::operator=( const OEvent& ev) {
86 if ( this == &ev ) return *this; 86 if ( this == &ev ) return *this;
87 87
88 OPimRecord::operator=( ev ); 88 OPimRecord::operator=( ev );
89 ev.data->ref(); 89 ev.data->ref();
90 deref(); 90 deref();
91 data = ev.data; 91 data = ev.data;
92 92
93 93
94 return *this; 94 return *this;
95} 95}
96QString OEvent::description()const { 96QString OEvent::description()const {
97 return data->description; 97 return data->description;
98} 98}
99void OEvent::setDescription( const QString& description ) { 99void OEvent::setDescription( const QString& description ) {
100 changeOrModify(); 100 changeOrModify();
101 data->description = description; 101 data->description = description;
102} 102}
103void OEvent::setLocation( const QString& loc ) { 103void OEvent::setLocation( const QString& loc ) {
104 changeOrModify(); 104 changeOrModify();
105 data->location = loc; 105 data->location = loc;
106} 106}
107QString OEvent::location()const { 107QString OEvent::location()const {
108 return data->location; 108 return data->location;
109} 109}
110OPimNotifyManager &OEvent::notifiers()const { 110OPimNotifyManager &OEvent::notifiers()const {
111 // I hope we can skip the changeOrModify here 111 // I hope we can skip the changeOrModify here
112 // the notifier should take care of it 112 // the notifier should take care of it
113 // and OPimNotify is shared too 113 // and OPimNotify is shared too
114 if (!data->manager ) 114 if (!data->manager )
115 data->manager = new OPimNotifyManager; 115 data->manager = new OPimNotifyManager;
116 116
117 return *data->manager; 117 return *data->manager;
118} 118}
119bool OEvent::hasNotifiers()const { 119bool OEvent::hasNotifiers()const {
120 if (!data->manager ) 120 if (!data->manager )
121 return false; 121 return false;
122 if (data->manager->reminders().isEmpty() && 122 if (data->manager->reminders().isEmpty() &&
123 data->manager->alarms().isEmpty() ) 123 data->manager->alarms().isEmpty() )
124 return false; 124 return false;
125 125
126 return true; 126 return true;
127} 127}
128ORecur OEvent::recurrence()const { 128ORecur OEvent::recurrence()const {
129 if (!data->recur) 129 if (!data->recur)
130 data->recur = new ORecur; 130 data->recur = new ORecur;
131 131
132 return *data->recur; 132 return *data->recur;
133} 133}
134void OEvent::setRecurrence( const ORecur& rec) { 134void OEvent::setRecurrence( const ORecur& rec) {
135 changeOrModify(); 135 changeOrModify();
136 if (data->recur ) 136 if (data->recur )
137 (*data->recur) = rec; 137 (*data->recur) = rec;
138 else 138 else
139 data->recur = new ORecur( rec ); 139 data->recur = new ORecur( rec );
140} 140}
141bool OEvent::hasRecurrence()const { 141bool OEvent::hasRecurrence()const {
142 if (!data->recur ) return false; 142 if (!data->recur ) return false;
143 return data->recur->doesRecur(); 143 return data->recur->doesRecur();
144} 144}
145QString OEvent::note()const { 145QString OEvent::note()const {
146 return data->note; 146 return data->note;
147} 147}
148void OEvent::setNote( const QString& note ) { 148void OEvent::setNote( const QString& note ) {
149 changeOrModify(); 149 changeOrModify();
150 data->note = note; 150 data->note = note;
151} 151}
152QDateTime OEvent::createdDateTime()const { 152QDateTime OEvent::createdDateTime()const {
153 return data->created; 153 return data->created;
154} 154}
155void OEvent::setCreatedDateTime( const QDateTime& time ) { 155void OEvent::setCreatedDateTime( const QDateTime& time ) {
156 changeOrModify(); 156 changeOrModify();
157 data->created = time; 157 data->created = time;
158} 158}
159QDateTime OEvent::startDateTime()const { 159QDateTime OEvent::startDateTime()const {
160 if ( data->isAllDay ) 160 if ( data->isAllDay )
161 return QDateTime( data->start.date(), QTime(0, 0, 0 ) ); 161 return QDateTime( data->start.date(), QTime(0, 0, 0 ) );
162 return data->start; 162 return data->start;
163} 163}
164QDateTime OEvent::startDateTimeInZone()const { 164QDateTime OEvent::startDateTimeInZone()const {
165 /* if no timezone, or all day event or if the current and this timeZone match... */ 165 /* if no timezone, or all day event or if the current and this timeZone match... */
166 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime(); 166 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return startDateTime();
167 167
168 OTimeZone zone(data->timezone ); 168 OTimeZone zone(data->timezone );
169 return zone.toDateTime( data->start, OTimeZone::current() ); 169 return zone.toDateTime( data->start, OTimeZone::current() );
170} 170}
171void OEvent::setStartDateTime( const QDateTime& dt ) { 171void OEvent::setStartDateTime( const QDateTime& dt ) {
172 changeOrModify(); 172 changeOrModify();
173 data->start = dt; 173 data->start = dt;
174} 174}
175QDateTime OEvent::endDateTime()const { 175QDateTime OEvent::endDateTime()const {
176 /* 176 /*
177 * if all Day event the end time needs 177 * if all Day event the end time needs
178 * to be on the same day as the start 178 * to be on the same day as the start
179 */ 179 */
180 if ( data->isAllDay ) 180 if ( data->isAllDay )
181 return QDateTime( data->start.date(), QTime(23, 59, 59 ) ); 181 return QDateTime( data->start.date(), QTime(23, 59, 59 ) );
182 return data->end; 182 return data->end;
183} 183}
184QDateTime OEvent::endDateTimeInZone()const { 184QDateTime OEvent::endDateTimeInZone()const {
185 /* if no timezone, or all day event or if the current and this timeZone match... */ 185 /* if no timezone, or all day event or if the current and this timeZone match... */
186 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime(); 186 if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime();
187 187
188 OTimeZone zone(data->timezone ); 188 OTimeZone zone(data->timezone );
189 return zone.toDateTime( data->end, OTimeZone::current() ); 189 return zone.toDateTime( data->end, OTimeZone::current() );
190} 190}
191void OEvent::setEndDateTime( const QDateTime& dt ) { 191void OEvent::setEndDateTime( const QDateTime& dt ) {
192 changeOrModify(); 192 changeOrModify();
193 data->end = dt; 193 data->end = dt;
194} 194}
195bool OEvent::isMultipleDay()const { 195bool OEvent::isMultipleDay()const {
196 return data->end.date().day() - data->start.date().day(); 196 return data->end.date().day() - data->start.date().day();
197} 197}
198bool OEvent::isAllDay()const { 198bool OEvent::isAllDay()const {
199 return data->isAllDay; 199 return data->isAllDay;
200} 200}
201void OEvent::setAllDay( bool allDay ) { 201void OEvent::setAllDay( bool allDay ) {
202 changeOrModify(); 202 changeOrModify();
203 data->isAllDay = allDay; 203 data->isAllDay = allDay;
204 if (allDay ) data->timezone = "UTC"; 204 if (allDay ) data->timezone = "UTC";
205} 205}
206void OEvent::setTimeZone( const QString& tz ) { 206void OEvent::setTimeZone( const QString& tz ) {
207 changeOrModify(); 207 changeOrModify();
208 data->timezone = tz; 208 data->timezone = tz;
209} 209}
210QString OEvent::timeZone()const { 210QString OEvent::timeZone()const {
211 if (data->isAllDay ) return QString::fromLatin1("UTC"); 211 if (data->isAllDay ) return QString::fromLatin1("UTC");
212 return data->timezone; 212 return data->timezone;
213} 213}
214bool OEvent::match( const QRegExp& re )const { 214bool OEvent::match( const QRegExp& re )const {
215 if ( re.match( data->description ) != -1 ){ 215 if ( re.match( data->description ) != -1 ){
216 setLastHitField( DatebookDescription ); 216 setLastHitField( Qtopia::DatebookDescription );
217 return true; 217 return true;
218 } 218 }
219 if ( re.match( data->note ) != -1 ){ 219 if ( re.match( data->note ) != -1 ){
220 setLastHitField( Note ); 220 setLastHitField( Qtopia::Note );
221 return true; 221 return true;
222 } 222 }
223 if ( re.match( data->location ) != -1 ){ 223 if ( re.match( data->location ) != -1 ){
224 setLastHitField( Location ); 224 setLastHitField( Qtopia::Location );
225 return true; 225 return true;
226 } 226 }
227 if ( re.match( data->start.toString() ) != -1 ){ 227 if ( re.match( data->start.toString() ) != -1 ){
228 setLastHitField( StartDateTime ); 228 setLastHitField( Qtopia::StartDateTime );
229 return true; 229 return true;
230 } 230 }
231 if ( re.match( data->end.toString() ) != -1 ){ 231 if ( re.match( data->end.toString() ) != -1 ){
232 setLastHitField( EndDateTime ); 232 setLastHitField( Qtopia::EndDateTime );
233 return true; 233 return true;
234 } 234 }
235 return false; 235 return false;
236} 236}
237QString OEvent::toRichText()const { 237QString OEvent::toRichText()const {
238 QString text; 238 QString text;
239 if ( !description().isEmpty() ) { 239 if ( !description().isEmpty() ) {
240 text += "<b>" + QObject::tr( "Description:") + "</b><br>"; 240 text += "<b>" + QObject::tr( "Description:") + "</b><br>";
241 text += Qtopia::escapeString(description() ). 241 text += Qtopia::escapeString(description() ).
242 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 242 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
243 } 243 }
244 if ( startDateTime().isValid() ) { 244 if ( startDateTime().isValid() ) {
245 text += "<b>" + QObject::tr( "Start:") + "</b> "; 245 text += "<b>" + QObject::tr( "Start:") + "</b> ";
246 text += Qtopia::escapeString(startDateTime().toString() ). 246 text += Qtopia::escapeString(startDateTime().toString() ).
247 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 247 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
248 } 248 }
249 if ( endDateTime().isValid() ) { 249 if ( endDateTime().isValid() ) {
250 text += "<b>" + QObject::tr( "End:") + "</b> "; 250 text += "<b>" + QObject::tr( "End:") + "</b> ";
251 text += Qtopia::escapeString(endDateTime().toString() ). 251 text += Qtopia::escapeString(endDateTime().toString() ).
252 replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 252 replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
253 } 253 }
254 if ( !note().isEmpty() ) { 254 if ( !note().isEmpty() ) {
255 text += "<b>" + QObject::tr( "Note:") + "</b><br>"; 255 text += "<b>" + QObject::tr( "Note:") + "</b><br>";
256 text += note(); 256 text += note();
257// text += Qtopia::escapeString(note() ). 257// text += Qtopia::escapeString(note() ).
258// replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 258// replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
259 } 259 }
260 return text; 260 return text;
261} 261}
262QString OEvent::toShortText()const { 262QString OEvent::toShortText()const {
263 QString text; 263 QString text;
264 text += QString::number( startDateTime().date().day() ); 264 text += QString::number( startDateTime().date().day() );
265 text += "."; 265 text += ".";
266 text += QString::number( startDateTime().date().month() ); 266 text += QString::number( startDateTime().date().month() );
267 text += "."; 267 text += ".";
268 text += QString::number( startDateTime().date().year() ); 268 text += QString::number( startDateTime().date().year() );
269 text += " "; 269 text += " ";
270 text += QString::number( startDateTime().time().hour() ); 270 text += QString::number( startDateTime().time().hour() );
271 text += ":"; 271 text += ":";
272 text += QString::number( startDateTime().time().minute() ); 272 text += QString::number( startDateTime().time().minute() );
273 text += " - "; 273 text += " - ";
274 text += description(); 274 text += description();
275 return text; 275 return text;
276} 276}
277QString OEvent::type()const { 277QString OEvent::type()const {
278 return QString::fromLatin1("OEvent"); 278 return QString::fromLatin1("OEvent");
279} 279}
280QString OEvent::recordField( int /*id */ )const { 280QString OEvent::recordField( int /*id */ )const {
281 return QString::null; 281 return QString::null;
282} 282}
283int OEvent::rtti() { 283int OEvent::rtti() {
284 return OPimResolver::DateBook; 284 return OPimResolver::DateBook;
285} 285}
286bool OEvent::loadFromStream( QDataStream& ) { 286bool OEvent::loadFromStream( QDataStream& ) {
287 return true; 287 return true;
288} 288}
289bool OEvent::saveToStream( QDataStream& )const { 289bool OEvent::saveToStream( QDataStream& )const {
290 return true; 290 return true;
291} 291}
292void OEvent::changeOrModify() { 292void OEvent::changeOrModify() {
293 if ( data->count != 1 ) { 293 if ( data->count != 1 ) {
294 data->deref(); 294 data->deref();
295 Data* d2 = new Data; 295 Data* d2 = new Data;
296 d2->description = data->description; 296 d2->description = data->description;
297 d2->location = data->location; 297 d2->location = data->location;
298 298
299 if (data->manager ) 299 if (data->manager )
300 d2->manager = new OPimNotifyManager( *data->manager ); 300 d2->manager = new OPimNotifyManager( *data->manager );
301 301
302 if ( data->recur ) 302 if ( data->recur )
303 d2->recur = new ORecur( *data->recur ); 303 d2->recur = new ORecur( *data->recur );
304 304
305 d2->note = data->note; 305 d2->note = data->note;
306 d2->created = data->created; 306 d2->created = data->created;
307 d2->start = data->start; 307 d2->start = data->start;
308 d2->end = data->end; 308 d2->end = data->end;
309 d2->isAllDay = data->isAllDay; 309 d2->isAllDay = data->isAllDay;
310 d2->timezone = data->timezone; 310 d2->timezone = data->timezone;
311 d2->parent = data->parent; 311 d2->parent = data->parent;
312 312
313 if ( data->child ) { 313 if ( data->child ) {
314 d2->child = new QArray<int>( *data->child ); 314 d2->child = new QArray<int>( *data->child );
315 d2->child->detach(); 315 d2->child->detach();
316 } 316 }
317 317
318 data = d2; 318 data = d2;
319 } 319 }
320} 320}
321void OEvent::deref() { 321void OEvent::deref() {
322 if ( data->deref() ) { 322 if ( data->deref() ) {
323 delete data; 323 delete data;
324 data = 0; 324 data = 0;
325 } 325 }
326} 326}
327// FIXME 327// FIXME
328QMap<int, QString> OEvent::toMap()const { 328QMap<int, QString> OEvent::toMap()const {
329 return QMap<int, QString>(); 329 return QMap<int, QString>();
330} 330}
331QMap<QString, QString> OEvent::toExtraMap()const { 331QMap<QString, QString> OEvent::toExtraMap()const {
332 return QMap<QString, QString>(); 332 return QMap<QString, QString>();
333} 333}
334int OEvent::parent()const { 334int OEvent::parent()const {
335 return data->parent; 335 return data->parent;
336} 336}
337void OEvent::setParent( int uid ) { 337void OEvent::setParent( int uid ) {
338 changeOrModify(); 338 changeOrModify();
339 data->parent = uid; 339 data->parent = uid;
340} 340}
341QArray<int> OEvent::children() const{ 341QArray<int> OEvent::children() const{
342 if (!data->child) return QArray<int>(); 342 if (!data->child) return QArray<int>();
343 else 343 else
344 return data->child->copy(); 344 return data->child->copy();
345} 345}
346void OEvent::setChildren( const QArray<int>& arr ) { 346void OEvent::setChildren( const QArray<int>& arr ) {
347 changeOrModify(); 347 changeOrModify();
348 if (data->child) delete data->child; 348 if (data->child) delete data->child;
349 349
350 data->child = new QArray<int>( arr ); 350 data->child = new QArray<int>( arr );
351 data->child->detach(); 351 data->child->detach();
352} 352}
353void OEvent::addChild( int uid ) { 353void OEvent::addChild( int uid ) {
354 changeOrModify(); 354 changeOrModify();
355 if (!data->child ) { 355 if (!data->child ) {
356 data->child = new QArray<int>(1); 356 data->child = new QArray<int>(1);
357 (*data->child)[0] = uid; 357 (*data->child)[0] = uid;
358 }else{ 358 }else{
359 int count = data->child->count(); 359 int count = data->child->count();
360 data->child->resize( count + 1 ); 360 data->child->resize( count + 1 );
361 (*data->child)[count] = uid; 361 (*data->child)[count] = uid;
362 } 362 }
363} 363}
364void OEvent::removeChild( int uid ) { 364void OEvent::removeChild( int uid ) {
365 if (!data->child || !data->child->contains( uid ) ) return; 365 if (!data->child || !data->child->contains( uid ) ) return;
366 changeOrModify(); 366 changeOrModify();
367 QArray<int> newAr( data->child->count() - 1 ); 367 QArray<int> newAr( data->child->count() - 1 );
368 int j = 0; 368 int j = 0;
369 uint count = data->child->count(); 369 uint count = data->child->count();
370 for ( uint i = 0; i < count; i++ ) { 370 for ( uint i = 0; i < count; i++ ) {
371 if ( (*data->child)[i] != uid ) { 371 if ( (*data->child)[i] != uid ) {
372 newAr[j] = (*data->child)[i]; 372 newAr[j] = (*data->child)[i];
373 j++; 373 j++;
374 } 374 }
375 } 375 }
376 (*data->child) = newAr; 376 (*data->child) = newAr;
377} 377}
378struct OEffectiveEvent::Data : public QShared { 378struct OEffectiveEvent::Data : public QShared {
379 Data() : QShared() { 379 Data() : QShared() {
380 } 380 }
381 OEvent event; 381 OEvent event;
382 QDate date; 382 QDate date;
383 QTime start, end; 383 QTime start, end;
384 QDate startDate, endDate; 384 QDate startDate, endDate;
385 bool dates : 1; 385 bool dates : 1;
386}; 386};
387 387
388OEffectiveEvent::OEffectiveEvent() { 388OEffectiveEvent::OEffectiveEvent() {
389 data = new Data; 389 data = new Data;
390 data->date = QDate::currentDate(); 390 data->date = QDate::currentDate();
391 data->start = data->end = QTime::currentTime(); 391 data->start = data->end = QTime::currentTime();
392 data->dates = false; 392 data->dates = false;
393} 393}
394OEffectiveEvent::OEffectiveEvent( const OEvent& ev, const QDate& startDate, 394OEffectiveEvent::OEffectiveEvent( const OEvent& ev, const QDate& startDate,
395 Position pos ) { 395 Position pos ) {
396 data = new Data; 396 data = new Data;
397 data->event = ev; 397 data->event = ev;
398 data->date = startDate; 398 data->date = startDate;
399 if ( pos & Start ) 399 if ( pos & Start )
400 data->start = ev.startDateTime().time(); 400 data->start = ev.startDateTime().time();
401 else 401 else
402 data->start = QTime( 0, 0, 0 ); 402 data->start = QTime( 0, 0, 0 );
403 403
404 if ( pos & End ) 404 if ( pos & End )
405 data->end = ev.endDateTime().time(); 405 data->end = ev.endDateTime().time();
406 else 406 else
407 data->end = QTime( 23, 59, 59 ); 407 data->end = QTime( 23, 59, 59 );
408 408
409 data->dates = false; 409 data->dates = false;
410} 410}
411OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev) { 411OEffectiveEvent::OEffectiveEvent( const OEffectiveEvent& ev) {
412 data = ev.data; 412 data = ev.data;
413 data->ref(); 413 data->ref();
414} 414}
415OEffectiveEvent::~OEffectiveEvent() { 415OEffectiveEvent::~OEffectiveEvent() {
416 if ( data->deref() ) { 416 if ( data->deref() ) {
417 delete data; 417 delete data;
418 data = 0; 418 data = 0;
419 } 419 }
420} 420}
421OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev ) { 421OEffectiveEvent& OEffectiveEvent::operator=( const OEffectiveEvent& ev ) {
422 if ( *this == ev ) return *this; 422 if ( *this == ev ) return *this;
423 423
424 ev.data->ref(); 424 ev.data->ref();