author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /libkcal/incidence.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | libkcal/incidence.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 7dd9bd2..8fcdc69 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -13,32 +13,34 @@ | |||
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 | //Added by qt3to4: | ||
30 | #include <Q3PtrList> | ||
29 | 31 | ||
30 | using namespace KCal; | 32 | using namespace KCal; |
31 | 33 | ||
32 | Incidence::Incidence() : | 34 | Incidence::Incidence() : |
33 | IncidenceBase(), | 35 | IncidenceBase(), |
34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) | 36 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) |
35 | { | 37 | { |
36 | mRecurrence = 0;//new Recurrence(this); | 38 | mRecurrence = 0;//new Recurrence(this); |
37 | mCancelled = false; | 39 | mCancelled = false; |
38 | recreate(); | 40 | recreate(); |
39 | mHasStartDate = true; | 41 | mHasStartDate = true; |
40 | mAlarms.setAutoDelete(true); | 42 | mAlarms.setAutoDelete(true); |
41 | mAttachments.setAutoDelete(true); | 43 | mAttachments.setAutoDelete(true); |
42 | mHasRecurrenceID = false; | 44 | mHasRecurrenceID = false; |
43 | mHoliday = false; | 45 | mHoliday = false; |
44 | mBirthday = false; | 46 | mBirthday = false; |
@@ -46,72 +48,72 @@ Incidence::Incidence() : | |||
46 | 48 | ||
47 | } | 49 | } |
48 | 50 | ||
49 | Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) | 51 | Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) |
50 | { | 52 | { |
51 | // TODO: reenable attributes currently commented out. | 53 | // TODO: reenable attributes currently commented out. |
52 | mRevision = i.mRevision; | 54 | mRevision = i.mRevision; |
53 | mCreated = i.mCreated; | 55 | mCreated = i.mCreated; |
54 | mDescription = i.mDescription; | 56 | mDescription = i.mDescription; |
55 | mSummary = i.mSummary; | 57 | mSummary = i.mSummary; |
56 | mCategories = i.mCategories; | 58 | mCategories = i.mCategories; |
57 | // Incidence *mRelatedTo; Incidence *mRelatedTo; | 59 | // Incidence *mRelatedTo; Incidence *mRelatedTo; |
58 | mRelatedTo = 0; | 60 | mRelatedTo = 0; |
59 | mRelatedToUid = i.mRelatedToUid; | 61 | mRelatedToUid = i.mRelatedToUid; |
60 | // QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; | 62 | // QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; |
61 | mExDates = i.mExDates; | 63 | mExDates = i.mExDates; |
62 | QPtrListIterator<Attachment> itat( i.mAttachments ); | 64 | Q3PtrListIterator<Attachment> itat( i.mAttachments ); |
63 | Attachment *at; | 65 | Attachment *at; |
64 | while( (at = itat.current()) ) { | 66 | while( (at = itat.current()) ) { |
65 | Attachment *a = new Attachment( *at ); | 67 | Attachment *a = new Attachment( *at ); |
66 | mAttachments.append( a ); | 68 | mAttachments.append( a ); |
67 | ++itat; | 69 | ++itat; |
68 | } | 70 | } |
69 | mAttachments.setAutoDelete( true ); | 71 | mAttachments.setAutoDelete( true ); |
70 | mResources = i.mResources; | 72 | mResources = i.mResources; |
71 | mSecrecy = i.mSecrecy; | 73 | mSecrecy = i.mSecrecy; |
72 | mPriority = i.mPriority; | 74 | mPriority = i.mPriority; |
73 | mLocation = i.mLocation; | 75 | mLocation = i.mLocation; |
74 | mCancelled = i.mCancelled; | 76 | mCancelled = i.mCancelled; |
75 | mHasStartDate = i.mHasStartDate; | 77 | mHasStartDate = i.mHasStartDate; |
76 | QPtrListIterator<Alarm> it( i.mAlarms ); | 78 | Q3PtrListIterator<Alarm> it( i.mAlarms ); |
77 | const Alarm *a; | 79 | const Alarm *a; |
78 | while( (a = it.current()) ) { | 80 | while( (a = it.current()) ) { |
79 | Alarm *b = new Alarm( *a ); | 81 | Alarm *b = new Alarm( *a ); |
80 | b->setParent( this ); | 82 | b->setParent( this ); |
81 | mAlarms.append( b ); | 83 | mAlarms.append( b ); |
82 | 84 | ||
83 | ++it; | 85 | ++it; |
84 | } | 86 | } |
85 | mAlarms.setAutoDelete(true); | 87 | mAlarms.setAutoDelete(true); |
86 | mHasRecurrenceID = i.mHasRecurrenceID; | 88 | mHasRecurrenceID = i.mHasRecurrenceID; |
87 | mRecurrenceID = i.mRecurrenceID; | 89 | mRecurrenceID = i.mRecurrenceID; |
88 | if ( i.mRecurrence ) | 90 | if ( i.mRecurrence ) |
89 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); | 91 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); |
90 | else | 92 | else |
91 | mRecurrence = 0; | 93 | mRecurrence = 0; |
92 | mHoliday = i.mHoliday ; | 94 | mHoliday = i.mHoliday ; |
93 | mBirthday = i.mBirthday; | 95 | mBirthday = i.mBirthday; |
94 | mAnniversary = i.mAnniversary; | 96 | mAnniversary = i.mAnniversary; |
95 | } | 97 | } |
96 | 98 | ||
97 | Incidence::~Incidence() | 99 | Incidence::~Incidence() |
98 | { | 100 | { |
99 | 101 | ||
100 | Incidence *ev; | 102 | Incidence *ev; |
101 | QPtrList<Incidence> Relations = relations(); | 103 | Q3PtrList<Incidence> Relations = relations(); |
102 | for (ev=Relations.first();ev;ev=Relations.next()) { | 104 | for (ev=Relations.first();ev;ev=Relations.next()) { |
103 | if (ev->relatedTo() == this) ev->setRelatedTo(0); | 105 | if (ev->relatedTo() == this) ev->setRelatedTo(0); |
104 | } | 106 | } |
105 | if (relatedTo()) relatedTo()->removeRelation(this); | 107 | if (relatedTo()) relatedTo()->removeRelation(this); |
106 | if ( mRecurrence ) | 108 | if ( mRecurrence ) |
107 | delete mRecurrence; | 109 | delete mRecurrence; |
108 | 110 | ||
109 | } | 111 | } |
110 | QString Incidence::durationText() | 112 | QString Incidence::durationText() |
111 | { | 113 | { |
112 | return "---"; | 114 | return "---"; |
113 | } | 115 | } |
114 | QString Incidence::durationText4Time( int offset ) | 116 | QString Incidence::durationText4Time( int offset ) |
115 | { | 117 | { |
116 | int min = offset/60; | 118 | int min = offset/60; |
117 | int hours = min /60; | 119 | int hours = min /60; |
@@ -203,34 +205,34 @@ static bool stringCompare( const QString& s1, const QString& s2 ) | |||
203 | } | 205 | } |
204 | 206 | ||
205 | bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | 207 | bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) |
206 | { | 208 | { |
207 | 209 | ||
208 | if( i1.alarms().count() != i2.alarms().count() ) { | 210 | if( i1.alarms().count() != i2.alarms().count() ) { |
209 | return false; // no need to check further | 211 | return false; // no need to check further |
210 | } | 212 | } |
211 | if ( i1.alarms().count() > 0 ) { | 213 | if ( i1.alarms().count() > 0 ) { |
212 | if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) ) | 214 | if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) ) |
213 | { | 215 | { |
214 | qDebug("alarm not equal "); | 216 | qDebug("alarm not equal "); |
215 | return false; | 217 | return false; |
216 | } | 218 | } |
217 | } | 219 | } |
218 | #if 0 | 220 | #if 0 |
219 | QPtrListIterator<Alarm> a1( i1.alarms() ); | 221 | Q3PtrListIterator<Alarm> a1( i1.alarms() ); |
220 | QPtrListIterator<Alarm> a2( i2.alarms() ); | 222 | Q3PtrListIterator<Alarm> a2( i2.alarms() ); |
221 | for( ; a1.current() && a2.current(); ++a1, ++a2 ) { | 223 | for( ; a1.current() && a2.current(); ++a1, ++a2 ) { |
222 | if( *a1.current() == *a2.current() ) { | 224 | if( *a1.current() == *a2.current() ) { |
223 | continue; | 225 | continue; |
224 | } | 226 | } |
225 | else { | 227 | else { |
226 | return false; | 228 | return false; |
227 | } | 229 | } |
228 | } | 230 | } |
229 | #endif | 231 | #endif |
230 | 232 | ||
231 | if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { | 233 | if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { |
232 | if ( i1.hasRecurrenceID() ) { | 234 | if ( i1.hasRecurrenceID() ) { |
233 | if ( i1.recurrenceID() != i2.recurrenceID() ) | 235 | if ( i1.recurrenceID() != i2.recurrenceID() ) |
234 | return false; | 236 | return false; |
235 | } | 237 | } |
236 | 238 | ||
@@ -309,33 +311,33 @@ Incidence* Incidence::recreateCloneException( QDate d ) | |||
309 | 311 | ||
310 | void Incidence::recreate() | 312 | void Incidence::recreate() |
311 | { | 313 | { |
312 | setCreated(QDateTime::currentDateTime()); | 314 | setCreated(QDateTime::currentDateTime()); |
313 | 315 | ||
314 | setUid(CalFormat::createUniqueId()); | 316 | setUid(CalFormat::createUniqueId()); |
315 | 317 | ||
316 | setRevision(0); | 318 | setRevision(0); |
317 | setIDStr( ":" ); | 319 | setIDStr( ":" ); |
318 | setLastModified(QDateTime::currentDateTime()); | 320 | setLastModified(QDateTime::currentDateTime()); |
319 | } | 321 | } |
320 | void Incidence::cloneRelations( Incidence * newInc ) | 322 | void Incidence::cloneRelations( Incidence * newInc ) |
321 | { | 323 | { |
322 | // newInc is already a clone of this incidence | 324 | // newInc is already a clone of this incidence |
323 | Incidence * inc; | 325 | Incidence * inc; |
324 | Incidence * cloneInc; | 326 | Incidence * cloneInc; |
325 | QPtrList<Incidence> Relations = relations(); | 327 | Q3PtrList<Incidence> Relations = relations(); |
326 | for (inc=Relations.first();inc;inc=Relations.next()) { | 328 | for (inc=Relations.first();inc;inc=Relations.next()) { |
327 | cloneInc = inc->clone(); | 329 | cloneInc = inc->clone(); |
328 | cloneInc->recreate(); | 330 | cloneInc->recreate(); |
329 | cloneInc->setRelatedTo( newInc ); | 331 | cloneInc->setRelatedTo( newInc ); |
330 | inc->cloneRelations( cloneInc ); | 332 | inc->cloneRelations( cloneInc ); |
331 | } | 333 | } |
332 | } | 334 | } |
333 | void Incidence::setReadOnly( bool readOnly ) | 335 | void Incidence::setReadOnly( bool readOnly ) |
334 | { | 336 | { |
335 | IncidenceBase::setReadOnly( readOnly ); | 337 | IncidenceBase::setReadOnly( readOnly ); |
336 | if ( mRecurrence ) | 338 | if ( mRecurrence ) |
337 | mRecurrence->setRecurReadOnly( readOnly); | 339 | mRecurrence->setRecurReadOnly( readOnly); |
338 | } | 340 | } |
339 | void Incidence::setLastModifiedSubInvalid() | 341 | void Incidence::setLastModifiedSubInvalid() |
340 | { | 342 | { |
341 | mLastModifiedSub = QDateTime(); | 343 | mLastModifiedSub = QDateTime(); |
@@ -343,33 +345,33 @@ void Incidence::setLastModifiedSubInvalid() | |||
343 | mRelatedTo->setLastModifiedSubInvalid(); | 345 | mRelatedTo->setLastModifiedSubInvalid(); |
344 | } | 346 | } |
345 | QString Incidence::lastModifiedSubSortKey() const | 347 | QString Incidence::lastModifiedSubSortKey() const |
346 | { | 348 | { |
347 | if ( mLastModifiedSubSortKey.isEmpty() ) | 349 | if ( mLastModifiedSubSortKey.isEmpty() ) |
348 | return lastModifiedSortKey(); | 350 | return lastModifiedSortKey(); |
349 | return mLastModifiedSubSortKey; | 351 | return mLastModifiedSubSortKey; |
350 | } | 352 | } |
351 | QDateTime Incidence::lastModifiedSub() | 353 | QDateTime Incidence::lastModifiedSub() |
352 | { | 354 | { |
353 | if ( !mRelations.count() ) | 355 | if ( !mRelations.count() ) |
354 | return lastModified(); | 356 | return lastModified(); |
355 | if ( mLastModifiedSub.isValid() ) | 357 | if ( mLastModifiedSub.isValid() ) |
356 | return mLastModifiedSub; | 358 | return mLastModifiedSub; |
357 | mLastModifiedSub = lastModified(); | 359 | mLastModifiedSub = lastModified(); |
358 | Incidence * inc; | 360 | Incidence * inc; |
359 | QPtrList<Incidence> Relations = relations(); | 361 | Q3PtrList<Incidence> Relations = relations(); |
360 | for (inc=Relations.first();inc;inc=Relations.next()) { | 362 | for (inc=Relations.first();inc;inc=Relations.next()) { |
361 | if ( inc->lastModifiedSub() > mLastModifiedSub ) | 363 | if ( inc->lastModifiedSub() > mLastModifiedSub ) |
362 | mLastModifiedSub = inc->lastModifiedSub(); | 364 | mLastModifiedSub = inc->lastModifiedSub(); |
363 | } | 365 | } |
364 | mLastModifiedSubSortKey.sprintf("%04d%02d%02d%02d%02d%02d", | 366 | mLastModifiedSubSortKey.sprintf("%04d%02d%02d%02d%02d%02d", |
365 | mLastModifiedSub.date().year(), | 367 | mLastModifiedSub.date().year(), |
366 | mLastModifiedSub.date().month(), | 368 | mLastModifiedSub.date().month(), |
367 | mLastModifiedSub.date().day(), | 369 | mLastModifiedSub.date().day(), |
368 | mLastModifiedSub.time().hour(), | 370 | mLastModifiedSub.time().hour(), |
369 | mLastModifiedSub.time().minute(), | 371 | mLastModifiedSub.time().minute(), |
370 | mLastModifiedSub.time().second() ); | 372 | mLastModifiedSub.time().second() ); |
371 | return mLastModifiedSub; | 373 | return mLastModifiedSub; |
372 | } | 374 | } |
373 | void Incidence::setCreated(QDateTime created) | 375 | void Incidence::setCreated(QDateTime created) |
374 | { | 376 | { |
375 | if (mReadOnly) return; | 377 | if (mReadOnly) return; |
@@ -434,48 +436,48 @@ void Incidence::checkCategories() | |||
434 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); | 436 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); |
435 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); | 437 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); |
436 | } | 438 | } |
437 | 439 | ||
438 | void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false | 440 | void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false |
439 | { | 441 | { |
440 | if (mReadOnly) return; | 442 | if (mReadOnly) return; |
441 | int i; | 443 | int i; |
442 | for( i = 0; i < categories.count(); ++i ) { | 444 | for( i = 0; i < categories.count(); ++i ) { |
443 | if ( !mCategories.contains (categories[i])) | 445 | if ( !mCategories.contains (categories[i])) |
444 | mCategories.append( categories[i] ); | 446 | mCategories.append( categories[i] ); |
445 | } | 447 | } |
446 | checkCategories(); | 448 | checkCategories(); |
447 | updated(); | 449 | updated(); |
448 | if ( addToRelations ) { | 450 | if ( addToRelations ) { |
449 | Incidence * inc; | 451 | Incidence * inc; |
450 | QPtrList<Incidence> Relations = relations(); | 452 | Q3PtrList<Incidence> Relations = relations(); |
451 | for (inc=Relations.first();inc;inc=Relations.next()) { | 453 | for (inc=Relations.first();inc;inc=Relations.next()) { |
452 | inc->addCategories( categories, true ); | 454 | inc->addCategories( categories, true ); |
453 | } | 455 | } |
454 | } | 456 | } |
455 | } | 457 | } |
456 | 458 | ||
457 | void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false | 459 | void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false |
458 | { | 460 | { |
459 | if (mReadOnly) return; | 461 | if (mReadOnly) return; |
460 | mCategories = categories; | 462 | mCategories = categories; |
461 | checkCategories(); | 463 | checkCategories(); |
462 | updated(); | 464 | updated(); |
463 | if ( setForRelations ) { | 465 | if ( setForRelations ) { |
464 | Incidence * inc; | 466 | Incidence * inc; |
465 | QPtrList<Incidence> Relations = relations(); | 467 | Q3PtrList<Incidence> Relations = relations(); |
466 | for (inc=Relations.first();inc;inc=Relations.next()) { | 468 | for (inc=Relations.first();inc;inc=Relations.next()) { |
467 | inc->setCategories( categories, true ); | 469 | inc->setCategories( categories, true ); |
468 | } | 470 | } |
469 | } | 471 | } |
470 | } | 472 | } |
471 | 473 | ||
472 | // TODO: remove setCategories(QString) function | 474 | // TODO: remove setCategories(QString) function |
473 | void Incidence::setCategories(const QString &catStr) | 475 | void Incidence::setCategories(const QString &catStr) |
474 | { | 476 | { |
475 | if (mReadOnly) return; | 477 | if (mReadOnly) return; |
476 | mCategories.clear(); | 478 | mCategories.clear(); |
477 | 479 | ||
478 | if (catStr.isEmpty()) return; | 480 | if (catStr.isEmpty()) return; |
479 | 481 | ||
480 | mCategories = QStringList::split(",",catStr); | 482 | mCategories = QStringList::split(",",catStr); |
481 | 483 | ||
@@ -537,41 +539,41 @@ void Incidence::setRelatedTo(Incidence *relatedTo) | |||
537 | mRelatedTo->removeRelation(this); | 539 | mRelatedTo->removeRelation(this); |
538 | } | 540 | } |
539 | mRelatedTo = relatedTo; | 541 | mRelatedTo = relatedTo; |
540 | if (mRelatedTo) { | 542 | if (mRelatedTo) { |
541 | mRelatedTo->addRelation(this); | 543 | mRelatedTo->addRelation(this); |
542 | mRelatedToUid = mRelatedTo->uid(); | 544 | mRelatedToUid = mRelatedTo->uid(); |
543 | } else { | 545 | } else { |
544 | mRelatedToUid = ""; | 546 | mRelatedToUid = ""; |
545 | } | 547 | } |
546 | } | 548 | } |
547 | 549 | ||
548 | Incidence *Incidence::relatedTo() const | 550 | Incidence *Incidence::relatedTo() const |
549 | { | 551 | { |
550 | return mRelatedTo; | 552 | return mRelatedTo; |
551 | } | 553 | } |
552 | 554 | ||
553 | QPtrList<Incidence> Incidence::relations() const | 555 | Q3PtrList<Incidence> Incidence::relations() const |
554 | { | 556 | { |
555 | return mRelations; | 557 | return mRelations; |
556 | } | 558 | } |
557 | 559 | ||
558 | void Incidence::addRelationsToList(QPtrList<Incidence> *rel) | 560 | void Incidence::addRelationsToList(Q3PtrList<Incidence> *rel) |
559 | { | 561 | { |
560 | Incidence* inc; | 562 | Incidence* inc; |
561 | QPtrList<Incidence> Relations = relations(); | 563 | Q3PtrList<Incidence> Relations = relations(); |
562 | for (inc=Relations.first();inc;inc=Relations.next()) { | 564 | for (inc=Relations.first();inc;inc=Relations.next()) { |
563 | inc->addRelationsToList( rel ); | 565 | inc->addRelationsToList( rel ); |
564 | } | 566 | } |
565 | if ( rel->findRef( this ) == -1 ) | 567 | if ( rel->findRef( this ) == -1 ) |
566 | rel->append( this ); | 568 | rel->append( this ); |
567 | } | 569 | } |
568 | 570 | ||
569 | void Incidence::addRelation(Incidence *event) | 571 | void Incidence::addRelation(Incidence *event) |
570 | { | 572 | { |
571 | setLastModifiedSubInvalid(); | 573 | setLastModifiedSubInvalid(); |
572 | if( mRelations.findRef( event ) == -1 ) { | 574 | if( mRelations.findRef( event ) == -1 ) { |
573 | mRelations.append(event); | 575 | mRelations.append(event); |
574 | //updated(); | 576 | //updated(); |
575 | } | 577 | } |
576 | } | 578 | } |
577 | 579 | ||
@@ -634,41 +636,41 @@ void Incidence::addAttachment(Attachment *attachment) | |||
634 | void Incidence::deleteAttachment(Attachment *attachment) | 636 | void Incidence::deleteAttachment(Attachment *attachment) |
635 | { | 637 | { |
636 | mAttachments.removeRef(attachment); | 638 | mAttachments.removeRef(attachment); |
637 | } | 639 | } |
638 | 640 | ||
639 | void Incidence::deleteAttachments(const QString& mime) | 641 | void Incidence::deleteAttachments(const QString& mime) |
640 | { | 642 | { |
641 | Attachment *at = mAttachments.first(); | 643 | Attachment *at = mAttachments.first(); |
642 | while (at) { | 644 | while (at) { |
643 | if (at->mimeType() == mime) | 645 | if (at->mimeType() == mime) |
644 | mAttachments.remove(); | 646 | mAttachments.remove(); |
645 | else | 647 | else |
646 | at = mAttachments.next(); | 648 | at = mAttachments.next(); |
647 | } | 649 | } |
648 | } | 650 | } |
649 | 651 | ||
650 | QPtrList<Attachment> Incidence::attachments() const | 652 | Q3PtrList<Attachment> Incidence::attachments() const |
651 | { | 653 | { |
652 | return mAttachments; | 654 | return mAttachments; |
653 | } | 655 | } |
654 | 656 | ||
655 | QPtrList<Attachment> Incidence::attachments(const QString& mime) const | 657 | Q3PtrList<Attachment> Incidence::attachments(const QString& mime) const |
656 | { | 658 | { |
657 | QPtrList<Attachment> attachments; | 659 | Q3PtrList<Attachment> attachments; |
658 | QPtrListIterator<Attachment> it( mAttachments ); | 660 | Q3PtrListIterator<Attachment> it( mAttachments ); |
659 | Attachment *at; | 661 | Attachment *at; |
660 | while ( (at = it.current()) ) { | 662 | while ( (at = it.current()) ) { |
661 | if (at->mimeType() == mime) | 663 | if (at->mimeType() == mime) |
662 | attachments.append(at); | 664 | attachments.append(at); |
663 | ++it; | 665 | ++it; |
664 | } | 666 | } |
665 | 667 | ||
666 | return attachments; | 668 | return attachments; |
667 | } | 669 | } |
668 | 670 | ||
669 | void Incidence::setResources(const QStringList &resources) | 671 | void Incidence::setResources(const QStringList &resources) |
670 | { | 672 | { |
671 | if (mReadOnly) return; | 673 | if (mReadOnly) return; |
672 | mResources = resources; | 674 | mResources = resources; |
673 | updated(); | 675 | updated(); |
674 | } | 676 | } |
@@ -724,33 +726,33 @@ QString Incidence::secrecyName(int secrecy) | |||
724 | return i18n("Undefined"); | 726 | return i18n("Undefined"); |
725 | break; | 727 | break; |
726 | } | 728 | } |
727 | } | 729 | } |
728 | 730 | ||
729 | QStringList Incidence::secrecyList() | 731 | QStringList Incidence::secrecyList() |
730 | { | 732 | { |
731 | QStringList list; | 733 | QStringList list; |
732 | list << secrecyName(SecrecyPublic); | 734 | list << secrecyName(SecrecyPublic); |
733 | list << secrecyName(SecrecyPrivate); | 735 | list << secrecyName(SecrecyPrivate); |
734 | list << secrecyName(SecrecyConfidential); | 736 | list << secrecyName(SecrecyConfidential); |
735 | 737 | ||
736 | return list; | 738 | return list; |
737 | } | 739 | } |
738 | 740 | ||
739 | 741 | ||
740 | QPtrList<Alarm> Incidence::alarms() const | 742 | Q3PtrList<Alarm> Incidence::alarms() const |
741 | { | 743 | { |
742 | return mAlarms; | 744 | return mAlarms; |
743 | } | 745 | } |
744 | 746 | ||
745 | Alarm* Incidence::newAlarm() | 747 | Alarm* Incidence::newAlarm() |
746 | { | 748 | { |
747 | Alarm* alarm = new Alarm(this); | 749 | Alarm* alarm = new Alarm(this); |
748 | mAlarms.append(alarm); | 750 | mAlarms.append(alarm); |
749 | // updated(); | 751 | // updated(); |
750 | return alarm; | 752 | return alarm; |
751 | } | 753 | } |
752 | 754 | ||
753 | void Incidence::addAlarm(Alarm *alarm) | 755 | void Incidence::addAlarm(Alarm *alarm) |
754 | { | 756 | { |
755 | mAlarms.append(alarm); | 757 | mAlarms.append(alarm); |
756 | updated(); | 758 | updated(); |
@@ -758,33 +760,33 @@ void Incidence::addAlarm(Alarm *alarm) | |||
758 | 760 | ||
759 | void Incidence::removeAlarm(Alarm *alarm) | 761 | void Incidence::removeAlarm(Alarm *alarm) |
760 | { | 762 | { |
761 | mAlarms.removeRef(alarm); | 763 | mAlarms.removeRef(alarm); |
762 | updated(); | 764 | updated(); |
763 | } | 765 | } |
764 | 766 | ||
765 | void Incidence::clearAlarms() | 767 | void Incidence::clearAlarms() |
766 | { | 768 | { |
767 | mAlarms.clear(); | 769 | mAlarms.clear(); |
768 | updated(); | 770 | updated(); |
769 | } | 771 | } |
770 | 772 | ||
771 | bool Incidence::isAlarmEnabled() const | 773 | bool Incidence::isAlarmEnabled() const |
772 | { | 774 | { |
773 | Alarm* alarm; | 775 | Alarm* alarm; |
774 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { | 776 | for (Q3PtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { |
775 | if (alarm->enabled()) | 777 | if (alarm->enabled()) |
776 | return true; | 778 | return true; |
777 | } | 779 | } |
778 | return false; | 780 | return false; |
779 | } | 781 | } |
780 | #include <stdlib.h> | 782 | #include <stdlib.h> |
781 | Recurrence *Incidence::recurrence() | 783 | Recurrence *Incidence::recurrence() |
782 | { | 784 | { |
783 | if ( ! mRecurrence ) { | 785 | if ( ! mRecurrence ) { |
784 | mRecurrence = new Recurrence(this); | 786 | mRecurrence = new Recurrence(this); |
785 | mRecurrence->setRecurStart( dtStart() ); | 787 | mRecurrence->setRecurStart( dtStart() ); |
786 | mRecurrence->setRecurReadOnly( isReadOnly()); | 788 | mRecurrence->setRecurReadOnly( isReadOnly()); |
787 | //qDebug("creating new recurence "); | 789 | //qDebug("creating new recurence "); |
788 | //abort(); | 790 | //abort(); |
789 | } | 791 | } |
790 | return mRecurrence; | 792 | return mRecurrence; |