author | zautrix <zautrix> | 2005-07-09 23:58:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-09 23:58:28 (UTC) |
commit | 2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b (patch) (unidiff) | |
tree | e57782981707d6932940d0489fc942bfeab40dd6 /libkcal | |
parent | 47370b5d0dea0f29bb929ba13cf45186095c762d (diff) | |
download | kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.zip kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.tar.gz kdepimpi-2aabde6c21d6dc4f9de8cf3ac17b98053961cc6b.tar.bz2 |
fixxx
-rw-r--r-- | libkcal/incidence.cpp | 28 | ||||
-rw-r--r-- | libkcal/incidence.h | 3 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 4 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 1 |
4 files changed, 32 insertions, 4 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 11f7ecc..e4bcc5e 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -236,97 +236,117 @@ Incidence* Incidence::recreateCloneException( QDate d ) | |||
236 | if ( doesRecur() ) { | 236 | if ( doesRecur() ) { |
237 | addExDate( d ); | 237 | addExDate( d ); |
238 | newInc->recurrence()->unsetRecurs(); | 238 | newInc->recurrence()->unsetRecurs(); |
239 | if ( typeID() == eventID ) { | 239 | if ( typeID() == eventID ) { |
240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
241 | QTime tim = dtStart().time(); | 241 | QTime tim = dtStart().time(); |
242 | newInc->setDtStart( QDateTime(d, tim) ); | 242 | newInc->setDtStart( QDateTime(d, tim) ); |
243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
244 | } else { | 244 | } else { |
245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); | 245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); |
246 | QTime tim = ((Todo*)this)->dtDue().time(); | 246 | QTime tim = ((Todo*)this)->dtDue().time(); |
247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); | 247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); |
248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); | 248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); |
249 | ((Todo*)this)->setRecurDates(); | 249 | ((Todo*)this)->setRecurDates(); |
250 | } | 250 | } |
251 | newInc->setExDates( DateList () ); | 251 | newInc->setExDates( DateList () ); |
252 | } | 252 | } |
253 | return newInc; | 253 | return newInc; |
254 | } | 254 | } |
255 | 255 | ||
256 | void Incidence::recreate() | 256 | void Incidence::recreate() |
257 | { | 257 | { |
258 | setCreated(QDateTime::currentDateTime()); | 258 | setCreated(QDateTime::currentDateTime()); |
259 | 259 | ||
260 | setUid(CalFormat::createUniqueId()); | 260 | setUid(CalFormat::createUniqueId()); |
261 | 261 | ||
262 | setRevision(0); | 262 | setRevision(0); |
263 | setIDStr( ":" ); | 263 | setIDStr( ":" ); |
264 | setLastModified(QDateTime::currentDateTime()); | 264 | setLastModified(QDateTime::currentDateTime()); |
265 | } | 265 | } |
266 | void Incidence::cloneRelations( Incidence * newInc ) | 266 | void Incidence::cloneRelations( Incidence * newInc ) |
267 | { | 267 | { |
268 | // newInc is already a clone of this incidence | 268 | // newInc is already a clone of this incidence |
269 | Incidence * inc; | 269 | Incidence * inc; |
270 | Incidence * cloneInc; | 270 | Incidence * cloneInc; |
271 | QPtrList<Incidence> Relations = relations(); | 271 | QPtrList<Incidence> Relations = relations(); |
272 | for (inc=Relations.first();inc;inc=Relations.next()) { | 272 | for (inc=Relations.first();inc;inc=Relations.next()) { |
273 | cloneInc = inc->clone(); | 273 | cloneInc = inc->clone(); |
274 | cloneInc->recreate(); | 274 | cloneInc->recreate(); |
275 | cloneInc->setRelatedTo( newInc ); | 275 | cloneInc->setRelatedTo( newInc ); |
276 | inc->cloneRelations( cloneInc ); | 276 | inc->cloneRelations( cloneInc ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | void Incidence::setReadOnly( bool readOnly ) | 279 | void Incidence::setReadOnly( bool readOnly ) |
280 | { | 280 | { |
281 | IncidenceBase::setReadOnly( readOnly ); | 281 | IncidenceBase::setReadOnly( readOnly ); |
282 | recurrence()->setRecurReadOnly( readOnly); | 282 | recurrence()->setRecurReadOnly( readOnly); |
283 | } | 283 | } |
284 | 284 | void Incidence::setLastModifiedSubInvalid() | |
285 | { | ||
286 | mLastModifiedSub = QDateTime(); | ||
287 | if ( mRelatedTo ) | ||
288 | mRelatedTo->setLastModifiedSubInvalid(); | ||
289 | } | ||
290 | QDateTime Incidence::lastModifiedSub() | ||
291 | { | ||
292 | if ( !mRelations.count() ) | ||
293 | return lastModified(); | ||
294 | if ( mLastModifiedSub.isValid() ) | ||
295 | return mLastModifiedSub; | ||
296 | mLastModifiedSub = lastModified(); | ||
297 | Incidence * inc; | ||
298 | QPtrList<Incidence> Relations = relations(); | ||
299 | for (inc=Relations.first();inc;inc=Relations.next()) { | ||
300 | if ( inc->lastModifiedSub() > mLastModifiedSub ) | ||
301 | mLastModifiedSub = inc->lastModifiedSub(); | ||
302 | } | ||
303 | return mLastModifiedSub; | ||
304 | } | ||
285 | void Incidence::setCreated(QDateTime created) | 305 | void Incidence::setCreated(QDateTime created) |
286 | { | 306 | { |
287 | if (mReadOnly) return; | 307 | if (mReadOnly) return; |
288 | mCreated = getEvenTime(created); | 308 | mCreated = getEvenTime(created); |
289 | } | 309 | } |
290 | 310 | ||
291 | QDateTime Incidence::created() const | 311 | QDateTime Incidence::created() const |
292 | { | 312 | { |
293 | return mCreated; | 313 | return mCreated; |
294 | } | 314 | } |
295 | 315 | ||
296 | void Incidence::setRevision(int rev) | 316 | void Incidence::setRevision(int rev) |
297 | { | 317 | { |
298 | if (mReadOnly) return; | 318 | if (mReadOnly) return; |
299 | mRevision = rev; | 319 | mRevision = rev; |
300 | 320 | ||
301 | updated(); | 321 | updated(); |
302 | } | 322 | } |
303 | 323 | ||
304 | int Incidence::revision() const | 324 | int Incidence::revision() const |
305 | { | 325 | { |
306 | return mRevision; | 326 | return mRevision; |
307 | } | 327 | } |
308 | 328 | ||
309 | void Incidence::setDtStart(const QDateTime &dtStart) | 329 | void Incidence::setDtStart(const QDateTime &dtStart) |
310 | { | 330 | { |
311 | 331 | ||
312 | QDateTime dt = getEvenTime(dtStart); | 332 | QDateTime dt = getEvenTime(dtStart); |
313 | recurrence()->setRecurStart( dt); | 333 | recurrence()->setRecurStart( dt); |
314 | IncidenceBase::setDtStart( dt ); | 334 | IncidenceBase::setDtStart( dt ); |
315 | } | 335 | } |
316 | 336 | ||
317 | void Incidence::setDescription(const QString &description) | 337 | void Incidence::setDescription(const QString &description) |
318 | { | 338 | { |
319 | if (mReadOnly) return; | 339 | if (mReadOnly) return; |
320 | mDescription = description; | 340 | mDescription = description; |
321 | updated(); | 341 | updated(); |
322 | } | 342 | } |
323 | 343 | ||
324 | QString Incidence::description() const | 344 | QString Incidence::description() const |
325 | { | 345 | { |
326 | return mDescription; | 346 | return mDescription; |
327 | } | 347 | } |
328 | 348 | ||
329 | 349 | ||
330 | void Incidence::setSummary(const QString &summary) | 350 | void Incidence::setSummary(const QString &summary) |
331 | { | 351 | { |
332 | if (mReadOnly) return; | 352 | if (mReadOnly) return; |
@@ -423,107 +443,107 @@ void Incidence::setRelatedToUid(const QString &relatedToUid) | |||
423 | } | 443 | } |
424 | 444 | ||
425 | QString Incidence::relatedToUid() const | 445 | QString Incidence::relatedToUid() const |
426 | { | 446 | { |
427 | return mRelatedToUid; | 447 | return mRelatedToUid; |
428 | } | 448 | } |
429 | 449 | ||
430 | void Incidence::setRelatedTo(Incidence *relatedTo) | 450 | void Incidence::setRelatedTo(Incidence *relatedTo) |
431 | { | 451 | { |
432 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); | 452 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); |
433 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); | 453 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); |
434 | if (mReadOnly || mRelatedTo == relatedTo) return; | 454 | if (mReadOnly || mRelatedTo == relatedTo) return; |
435 | if(mRelatedTo) { | 455 | if(mRelatedTo) { |
436 | // updated(); | 456 | // updated(); |
437 | mRelatedTo->removeRelation(this); | 457 | mRelatedTo->removeRelation(this); |
438 | } | 458 | } |
439 | mRelatedTo = relatedTo; | 459 | mRelatedTo = relatedTo; |
440 | if (mRelatedTo) { | 460 | if (mRelatedTo) { |
441 | mRelatedTo->addRelation(this); | 461 | mRelatedTo->addRelation(this); |
442 | mRelatedToUid = mRelatedTo->uid(); | 462 | mRelatedToUid = mRelatedTo->uid(); |
443 | } else { | 463 | } else { |
444 | mRelatedToUid = ""; | 464 | mRelatedToUid = ""; |
445 | } | 465 | } |
446 | } | 466 | } |
447 | 467 | ||
448 | Incidence *Incidence::relatedTo() const | 468 | Incidence *Incidence::relatedTo() const |
449 | { | 469 | { |
450 | return mRelatedTo; | 470 | return mRelatedTo; |
451 | } | 471 | } |
452 | 472 | ||
453 | QPtrList<Incidence> Incidence::relations() const | 473 | QPtrList<Incidence> Incidence::relations() const |
454 | { | 474 | { |
455 | return mRelations; | 475 | return mRelations; |
456 | } | 476 | } |
457 | 477 | ||
458 | void Incidence::addRelationsToList(QPtrList<Incidence> *rel) | 478 | void Incidence::addRelationsToList(QPtrList<Incidence> *rel) |
459 | { | 479 | { |
460 | Incidence* inc; | 480 | Incidence* inc; |
461 | QPtrList<Incidence> Relations = relations(); | 481 | QPtrList<Incidence> Relations = relations(); |
462 | for (inc=Relations.first();inc;inc=Relations.next()) { | 482 | for (inc=Relations.first();inc;inc=Relations.next()) { |
463 | inc->addRelationsToList( rel ); | 483 | inc->addRelationsToList( rel ); |
464 | } | 484 | } |
465 | if ( rel->findRef( this ) == -1 ) | 485 | if ( rel->findRef( this ) == -1 ) |
466 | rel->append( this ); | 486 | rel->append( this ); |
467 | } | 487 | } |
468 | 488 | ||
469 | void Incidence::addRelation(Incidence *event) | 489 | void Incidence::addRelation(Incidence *event) |
470 | { | 490 | { |
491 | setLastModifiedSubInvalid(); | ||
471 | if( mRelations.findRef( event ) == -1 ) { | 492 | if( mRelations.findRef( event ) == -1 ) { |
472 | mRelations.append(event); | 493 | mRelations.append(event); |
473 | //updated(); | 494 | //updated(); |
474 | } | 495 | } |
475 | } | 496 | } |
476 | 497 | ||
477 | void Incidence::removeRelation(Incidence *event) | 498 | void Incidence::removeRelation(Incidence *event) |
478 | { | 499 | { |
479 | 500 | setLastModifiedSubInvalid(); | |
480 | mRelations.removeRef(event); | 501 | mRelations.removeRef(event); |
481 | |||
482 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); | 502 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); |
483 | } | 503 | } |
484 | 504 | ||
485 | bool Incidence::recursOn(const QDate &qd) const | 505 | bool Incidence::recursOn(const QDate &qd) const |
486 | { | 506 | { |
487 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; | 507 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; |
488 | else return false; | 508 | else return false; |
489 | } | 509 | } |
490 | 510 | ||
491 | void Incidence::setExDates(const DateList &exDates) | 511 | void Incidence::setExDates(const DateList &exDates) |
492 | { | 512 | { |
493 | if (mReadOnly) return; | 513 | if (mReadOnly) return; |
494 | mExDates = exDates; | 514 | mExDates = exDates; |
495 | 515 | ||
496 | recurrence()->setRecurExDatesCount(mExDates.count()); | 516 | recurrence()->setRecurExDatesCount(mExDates.count()); |
497 | 517 | ||
498 | updated(); | 518 | updated(); |
499 | } | 519 | } |
500 | 520 | ||
501 | void Incidence::addExDate(const QDate &date) | 521 | void Incidence::addExDate(const QDate &date) |
502 | { | 522 | { |
503 | if (mReadOnly) return; | 523 | if (mReadOnly) return; |
504 | mExDates.append(date); | 524 | mExDates.append(date); |
505 | 525 | ||
506 | recurrence()->setRecurExDatesCount(mExDates.count()); | 526 | recurrence()->setRecurExDatesCount(mExDates.count()); |
507 | 527 | ||
508 | updated(); | 528 | updated(); |
509 | } | 529 | } |
510 | 530 | ||
511 | DateList Incidence::exDates() const | 531 | DateList Incidence::exDates() const |
512 | { | 532 | { |
513 | return mExDates; | 533 | return mExDates; |
514 | } | 534 | } |
515 | 535 | ||
516 | bool Incidence::isException(const QDate &date) const | 536 | bool Incidence::isException(const QDate &date) const |
517 | { | 537 | { |
518 | DateList::ConstIterator it; | 538 | DateList::ConstIterator it; |
519 | for( it = mExDates.begin(); it != mExDates.end(); ++it ) { | 539 | for( it = mExDates.begin(); it != mExDates.end(); ++it ) { |
520 | if ( (*it) == date ) { | 540 | if ( (*it) == date ) { |
521 | return true; | 541 | return true; |
522 | } | 542 | } |
523 | } | 543 | } |
524 | 544 | ||
525 | return false; | 545 | return false; |
526 | } | 546 | } |
527 | 547 | ||
528 | void Incidence::addAttachment(Attachment *attachment) | 548 | void Incidence::addAttachment(Attachment *attachment) |
529 | { | 549 | { |
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index c88ba2f..d4af9f0 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -232,87 +232,90 @@ class Incidence : public IncidenceBase | |||
232 | /** get the event's priority */ | 232 | /** get the event's priority */ |
233 | int priority() const; | 233 | int priority() const; |
234 | 234 | ||
235 | /** All alarms that are associated with this incidence */ | 235 | /** All alarms that are associated with this incidence */ |
236 | QPtrList<Alarm> alarms() const; | 236 | QPtrList<Alarm> alarms() const; |
237 | /** Create a new alarm which is associated with this incidence */ | 237 | /** Create a new alarm which is associated with this incidence */ |
238 | Alarm* newAlarm(); | 238 | Alarm* newAlarm(); |
239 | /** Add an alarm which is associated with this incidence */ | 239 | /** Add an alarm which is associated with this incidence */ |
240 | void addAlarm(Alarm*); | 240 | void addAlarm(Alarm*); |
241 | /** Remove an alarm that is associated with this incidence */ | 241 | /** Remove an alarm that is associated with this incidence */ |
242 | void removeAlarm(Alarm*); | 242 | void removeAlarm(Alarm*); |
243 | /** Remove all alarms that are associated with this incidence */ | 243 | /** Remove all alarms that are associated with this incidence */ |
244 | void clearAlarms(); | 244 | void clearAlarms(); |
245 | /** return whether any alarm associated with this incidence is enabled */ | 245 | /** return whether any alarm associated with this incidence is enabled */ |
246 | bool isAlarmEnabled() const; | 246 | bool isAlarmEnabled() const; |
247 | 247 | ||
248 | /** | 248 | /** |
249 | Return the recurrence rule associated with this incidence. If there is | 249 | Return the recurrence rule associated with this incidence. If there is |
250 | none, returns an appropriate (non-0) object. | 250 | none, returns an appropriate (non-0) object. |
251 | */ | 251 | */ |
252 | Recurrence *recurrence() const; | 252 | Recurrence *recurrence() const; |
253 | void setRecurrence(Recurrence * r); | 253 | void setRecurrence(Recurrence * r); |
254 | /** | 254 | /** |
255 | Forward to Recurrence::doesRecur(). | 255 | Forward to Recurrence::doesRecur(). |
256 | */ | 256 | */ |
257 | ushort doesRecur() const; | 257 | ushort doesRecur() const; |
258 | 258 | ||
259 | /** set the event's/todo's location. Do _not_ use it with journal */ | 259 | /** set the event's/todo's location. Do _not_ use it with journal */ |
260 | void setLocation(const QString &location); | 260 | void setLocation(const QString &location); |
261 | /** return the event's/todo's location. Do _not_ use it with journal */ | 261 | /** return the event's/todo's location. Do _not_ use it with journal */ |
262 | QString location() const; | 262 | QString location() const; |
263 | /** returns TRUE or FALSE depending on whether the todo has a start date */ | 263 | /** returns TRUE or FALSE depending on whether the todo has a start date */ |
264 | bool hasStartDate() const; | 264 | bool hasStartDate() const; |
265 | /** sets the event's hasStartDate value. */ | 265 | /** sets the event's hasStartDate value. */ |
266 | void setHasStartDate(bool f); | 266 | void setHasStartDate(bool f); |
267 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; | 267 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; |
268 | bool cancelled() const; | 268 | bool cancelled() const; |
269 | void setCancelled( bool b ); | 269 | void setCancelled( bool b ); |
270 | 270 | ||
271 | bool hasRecurrenceID() const; | 271 | bool hasRecurrenceID() const; |
272 | void setHasRecurrenceID( bool b ); | 272 | void setHasRecurrenceID( bool b ); |
273 | 273 | ||
274 | void setRecurrenceID(QDateTime); | 274 | void setRecurrenceID(QDateTime); |
275 | QDateTime recurrenceID () const; | 275 | QDateTime recurrenceID () const; |
276 | QDateTime dtStart() const; | 276 | QDateTime dtStart() const; |
277 | bool isHoliday() const; | 277 | bool isHoliday() const; |
278 | bool isBirthday() const; | 278 | bool isBirthday() const; |
279 | bool isAnniversary() const; | 279 | bool isAnniversary() const; |
280 | QDateTime lastModifiedSub(); | ||
281 | void setLastModifiedSubInvalid(); | ||
280 | 282 | ||
281 | 283 | ||
282 | protected: | 284 | protected: |
283 | QPtrList<Alarm> mAlarms; | 285 | QPtrList<Alarm> mAlarms; |
284 | QPtrList<Incidence> mRelations; | 286 | QPtrList<Incidence> mRelations; |
285 | QDateTime mRecurrenceID; | 287 | QDateTime mRecurrenceID; |
286 | bool mHasRecurrenceID; | 288 | bool mHasRecurrenceID; |
287 | private: | 289 | private: |
288 | void checkCategories(); | 290 | void checkCategories(); |
289 | bool mHoliday, mBirthday, mAnniversary; | 291 | bool mHoliday, mBirthday, mAnniversary; |
290 | int mRevision; | 292 | int mRevision; |
291 | bool mCancelled; | 293 | bool mCancelled; |
292 | 294 | ||
293 | // base components of jounal, event and todo | 295 | // base components of jounal, event and todo |
294 | QDateTime mCreated; | 296 | QDateTime mCreated; |
297 | QDateTime mLastModifiedSub; | ||
295 | QString mDescription; | 298 | QString mDescription; |
296 | QString mSummary; | 299 | QString mSummary; |
297 | QStringList mCategories; | 300 | QStringList mCategories; |
298 | Incidence *mRelatedTo; | 301 | Incidence *mRelatedTo; |
299 | QString mRelatedToUid; | 302 | QString mRelatedToUid; |
300 | DateList mExDates; | 303 | DateList mExDates; |
301 | QPtrList<Attachment> mAttachments; | 304 | QPtrList<Attachment> mAttachments; |
302 | QStringList mResources; | 305 | QStringList mResources; |
303 | bool mHasStartDate; // if todo has associated start date | 306 | bool mHasStartDate; // if todo has associated start date |
304 | 307 | ||
305 | int mSecrecy; | 308 | int mSecrecy; |
306 | int mPriority; // 1 = highest, 2 = less, etc. | 309 | int mPriority; // 1 = highest, 2 = less, etc. |
307 | 310 | ||
308 | //QPtrList<Alarm> mAlarms; | 311 | //QPtrList<Alarm> mAlarms; |
309 | Recurrence *mRecurrence; | 312 | Recurrence *mRecurrence; |
310 | 313 | ||
311 | QString mLocation; | 314 | QString mLocation; |
312 | }; | 315 | }; |
313 | 316 | ||
314 | bool operator==( const Incidence&, const Incidence& ); | 317 | bool operator==( const Incidence&, const Incidence& ); |
315 | 318 | ||
316 | } | 319 | } |
317 | 320 | ||
318 | #endif | 321 | #endif |
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 1a19f3e..022dead 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -146,103 +146,107 @@ bool IncidenceBase::isTagged() const | |||
146 | return mIsTagged; | 146 | return mIsTagged; |
147 | } | 147 | } |
148 | void IncidenceBase::setTagged( bool b) | 148 | void IncidenceBase::setTagged( bool b) |
149 | { | 149 | { |
150 | mIsTagged = b; | 150 | mIsTagged = b; |
151 | } | 151 | } |
152 | void IncidenceBase::setCalID( int id ) | 152 | void IncidenceBase::setCalID( int id ) |
153 | { | 153 | { |
154 | if ( mCalID > 0 ) { | 154 | if ( mCalID > 0 ) { |
155 | blockLastModified = true; | 155 | blockLastModified = true; |
156 | updated(); | 156 | updated(); |
157 | blockLastModified = false; | 157 | blockLastModified = false; |
158 | } | 158 | } |
159 | mCalID = id; | 159 | mCalID = id; |
160 | } | 160 | } |
161 | int IncidenceBase::calID() const | 161 | int IncidenceBase::calID() const |
162 | { | 162 | { |
163 | return mCalID; | 163 | return mCalID; |
164 | } | 164 | } |
165 | void IncidenceBase::setCalEnabled( bool b ) | 165 | void IncidenceBase::setCalEnabled( bool b ) |
166 | { | 166 | { |
167 | mCalEnabled = b; | 167 | mCalEnabled = b; |
168 | } | 168 | } |
169 | bool IncidenceBase::calEnabled() const | 169 | bool IncidenceBase::calEnabled() const |
170 | { | 170 | { |
171 | return mCalEnabled; | 171 | return mCalEnabled; |
172 | } | 172 | } |
173 | 173 | ||
174 | void IncidenceBase::setAlarmEnabled( bool b ) | 174 | void IncidenceBase::setAlarmEnabled( bool b ) |
175 | { | 175 | { |
176 | mAlarmEnabled = b; | 176 | mAlarmEnabled = b; |
177 | } | 177 | } |
178 | bool IncidenceBase::alarmEnabled() const | 178 | bool IncidenceBase::alarmEnabled() const |
179 | { | 179 | { |
180 | return mAlarmEnabled; | 180 | return mAlarmEnabled; |
181 | } | 181 | } |
182 | 182 | ||
183 | 183 | ||
184 | void IncidenceBase::setUid(const QString &uid) | 184 | void IncidenceBase::setUid(const QString &uid) |
185 | { | 185 | { |
186 | mUid = uid; | 186 | mUid = uid; |
187 | updated(); | 187 | updated(); |
188 | } | 188 | } |
189 | 189 | ||
190 | QString IncidenceBase::uid() const | 190 | QString IncidenceBase::uid() const |
191 | { | 191 | { |
192 | return mUid; | 192 | return mUid; |
193 | } | 193 | } |
194 | void IncidenceBase::setLastModifiedSubInvalid() | ||
195 | { | ||
194 | 196 | ||
197 | } | ||
195 | void IncidenceBase::setLastModified(const QDateTime &lm) | 198 | void IncidenceBase::setLastModified(const QDateTime &lm) |
196 | { | 199 | { |
197 | if ( blockLastModified ) return; | 200 | if ( blockLastModified ) return; |
198 | // DON'T! updated() because we call this from | 201 | // DON'T! updated() because we call this from |
199 | // Calendar::updateEvent(). | 202 | // Calendar::updateEvent(). |
200 | mLastModified = getEvenTime(lm); | 203 | mLastModified = getEvenTime(lm); |
204 | setLastModifiedSubInvalid(); | ||
201 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); | 205 | //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); |
202 | } | 206 | } |
203 | 207 | ||
204 | QDateTime IncidenceBase::lastModified() const | 208 | QDateTime IncidenceBase::lastModified() const |
205 | { | 209 | { |
206 | return mLastModified; | 210 | return mLastModified; |
207 | } | 211 | } |
208 | 212 | ||
209 | void IncidenceBase::setOrganizer(const QString &o) | 213 | void IncidenceBase::setOrganizer(const QString &o) |
210 | { | 214 | { |
211 | // we don't check for readonly here, because it is | 215 | // we don't check for readonly here, because it is |
212 | // possible that by setting the organizer we are changing | 216 | // possible that by setting the organizer we are changing |
213 | // the event's readonly status... | 217 | // the event's readonly status... |
214 | mOrganizer = o; | 218 | mOrganizer = o; |
215 | if (mOrganizer.left(7).upper() == "MAILTO:") | 219 | if (mOrganizer.left(7).upper() == "MAILTO:") |
216 | mOrganizer = mOrganizer.remove(0,7); | 220 | mOrganizer = mOrganizer.remove(0,7); |
217 | 221 | ||
218 | updated(); | 222 | updated(); |
219 | } | 223 | } |
220 | 224 | ||
221 | QString IncidenceBase::organizer() const | 225 | QString IncidenceBase::organizer() const |
222 | { | 226 | { |
223 | return mOrganizer; | 227 | return mOrganizer; |
224 | } | 228 | } |
225 | 229 | ||
226 | void IncidenceBase::setReadOnly( bool readOnly ) | 230 | void IncidenceBase::setReadOnly( bool readOnly ) |
227 | { | 231 | { |
228 | mReadOnly = readOnly; | 232 | mReadOnly = readOnly; |
229 | } | 233 | } |
230 | 234 | ||
231 | void IncidenceBase::setDtStart(const QDateTime &dtStart) | 235 | void IncidenceBase::setDtStart(const QDateTime &dtStart) |
232 | { | 236 | { |
233 | // if (mReadOnly) return; | 237 | // if (mReadOnly) return; |
234 | mDtStart = getEvenTime(dtStart); | 238 | mDtStart = getEvenTime(dtStart); |
235 | updated(); | 239 | updated(); |
236 | } | 240 | } |
237 | 241 | ||
238 | 242 | ||
239 | QDateTime IncidenceBase::dtStart() const | 243 | QDateTime IncidenceBase::dtStart() const |
240 | { | 244 | { |
241 | return mDtStart; | 245 | return mDtStart; |
242 | } | 246 | } |
243 | 247 | ||
244 | QString IncidenceBase::dtStartTimeStr() const | 248 | QString IncidenceBase::dtStartTimeStr() const |
245 | { | 249 | { |
246 | return KGlobal::locale()->formatTime(dtStart().time()); | 250 | return KGlobal::locale()->formatTime(dtStart().time()); |
247 | } | 251 | } |
248 | 252 | ||
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index bed73db..665c1f6 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h | |||
@@ -104,83 +104,84 @@ class IncidenceBase : public CustomProperties | |||
104 | */ | 104 | */ |
105 | bool addAttendee(Attendee *a, bool doupdate=true ); | 105 | bool addAttendee(Attendee *a, bool doupdate=true ); |
106 | // void removeAttendee(Attendee *a); | 106 | // void removeAttendee(Attendee *a); |
107 | // void removeAttendee(const char *n); | 107 | // void removeAttendee(const char *n); |
108 | /** Remove all Attendees. */ | 108 | /** Remove all Attendees. */ |
109 | void clearAttendees(); | 109 | void clearAttendees(); |
110 | /** Return list of attendees. */ | 110 | /** Return list of attendees. */ |
111 | QPtrList<Attendee> attendees() const { return mAttendees; }; | 111 | QPtrList<Attendee> attendees() const { return mAttendees; }; |
112 | /** Return number of attendees. */ | 112 | /** Return number of attendees. */ |
113 | int attendeeCount() const { return mAttendees.count(); }; | 113 | int attendeeCount() const { return mAttendees.count(); }; |
114 | /** Return the Attendee with this email */ | 114 | /** Return the Attendee with this email */ |
115 | Attendee* attendeeByMail(const QString &); | 115 | Attendee* attendeeByMail(const QString &); |
116 | /** Return first Attendee with one of this emails */ | 116 | /** Return first Attendee with one of this emails */ |
117 | Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); | 117 | Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null); |
118 | 118 | ||
119 | /** pilot syncronization states */ | 119 | /** pilot syncronization states */ |
120 | enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; | 120 | enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 }; |
121 | /** Set synchronisation satus. */ | 121 | /** Set synchronisation satus. */ |
122 | void setSyncStatus(int stat); | 122 | void setSyncStatus(int stat); |
123 | /** Return synchronisation status. */ | 123 | /** Return synchronisation status. */ |
124 | int syncStatus() const; | 124 | int syncStatus() const; |
125 | 125 | ||
126 | /** Set Pilot Id. */ | 126 | /** Set Pilot Id. */ |
127 | void setPilotId(int id); | 127 | void setPilotId(int id); |
128 | /** Return Pilot Id. */ | 128 | /** Return Pilot Id. */ |
129 | int pilotId() const; | 129 | int pilotId() const; |
130 | 130 | ||
131 | void setTempSyncStat(int id); | 131 | void setTempSyncStat(int id); |
132 | int tempSyncStat() const; | 132 | int tempSyncStat() const; |
133 | void setIDStr( const QString & ); | 133 | void setIDStr( const QString & ); |
134 | QString IDStr() const; | 134 | QString IDStr() const; |
135 | void setID( const QString &, const QString & ); | 135 | void setID( const QString &, const QString & ); |
136 | QString getID( const QString & ); | 136 | QString getID( const QString & ); |
137 | void setCsum( const QString &, const QString & ); | 137 | void setCsum( const QString &, const QString & ); |
138 | QString getCsum( const QString & ); | 138 | QString getCsum( const QString & ); |
139 | void removeID(const QString &); | 139 | void removeID(const QString &); |
140 | 140 | ||
141 | void registerObserver( Observer * ); | 141 | void registerObserver( Observer * ); |
142 | void unRegisterObserver( Observer * ); | 142 | void unRegisterObserver( Observer * ); |
143 | void updated(); | 143 | void updated(); |
144 | void setCalID( int id ); | 144 | void setCalID( int id ); |
145 | int calID() const; | 145 | int calID() const; |
146 | void setCalEnabled( bool ); | 146 | void setCalEnabled( bool ); |
147 | bool calEnabled() const; | 147 | bool calEnabled() const; |
148 | void setAlarmEnabled( bool ); | 148 | void setAlarmEnabled( bool ); |
149 | bool alarmEnabled() const; | 149 | bool alarmEnabled() const; |
150 | bool isTagged() const; | 150 | bool isTagged() const; |
151 | void setTagged( bool ); | 151 | void setTagged( bool ); |
152 | virtual void setLastModifiedSubInvalid(); | ||
152 | protected: | 153 | protected: |
153 | bool blockLastModified; | 154 | bool blockLastModified; |
154 | bool mIsTagged; | 155 | bool mIsTagged; |
155 | QDateTime mDtStart; | 156 | QDateTime mDtStart; |
156 | bool mReadOnly; | 157 | bool mReadOnly; |
157 | QDateTime getEvenTime( QDateTime ); | 158 | QDateTime getEvenTime( QDateTime ); |
158 | 159 | ||
159 | private: | 160 | private: |
160 | // base components | 161 | // base components |
161 | QString mOrganizer; | 162 | QString mOrganizer; |
162 | QString mUid; | 163 | QString mUid; |
163 | int mCalID; | 164 | int mCalID; |
164 | bool mCalEnabled; | 165 | bool mCalEnabled; |
165 | bool mAlarmEnabled; | 166 | bool mAlarmEnabled; |
166 | QDateTime mLastModified; | 167 | QDateTime mLastModified; |
167 | QPtrList<Attendee> mAttendees; | 168 | QPtrList<Attendee> mAttendees; |
168 | 169 | ||
169 | bool mFloats; | 170 | bool mFloats; |
170 | 171 | ||
171 | int mDuration; | 172 | int mDuration; |
172 | bool mHasDuration; | 173 | bool mHasDuration; |
173 | QString mExternalId; | 174 | QString mExternalId; |
174 | int mTempSyncStat; | 175 | int mTempSyncStat; |
175 | 176 | ||
176 | // PILOT SYNCHRONIZATION STUFF | 177 | // PILOT SYNCHRONIZATION STUFF |
177 | int mPilotId; // unique id for pilot sync | 178 | int mPilotId; // unique id for pilot sync |
178 | int mSyncStatus; // status (for sync) | 179 | int mSyncStatus; // status (for sync) |
179 | 180 | ||
180 | QPtrList<Observer> mObservers; | 181 | QPtrList<Observer> mObservers; |
181 | }; | 182 | }; |
182 | 183 | ||
183 | bool operator==( const IncidenceBase&, const IncidenceBase& ); | 184 | bool operator==( const IncidenceBase&, const IncidenceBase& ); |
184 | } | 185 | } |
185 | 186 | ||
186 | #endif | 187 | #endif |