-rw-r--r-- | libkcal/incidencebase.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 56c0560..f11ec54 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -14,32 +14,34 @@ | |||
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 | #include <kidmanager.h> | 24 | #include <kidmanager.h> |
25 | 25 | ||
26 | #include "calformat.h" | 26 | #include "calformat.h" |
27 | #include "syncdefines.h" | 27 | #include "syncdefines.h" |
28 | 28 | ||
29 | #include "incidencebase.h" | 29 | #include "incidencebase.h" |
30 | //Added by qt3to4: | ||
31 | #include <Q3PtrList> | ||
30 | 32 | ||
31 | using namespace KCal; | 33 | using namespace KCal; |
32 | 34 | ||
33 | IncidenceBase::IncidenceBase() : | 35 | IncidenceBase::IncidenceBase() : |
34 | mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false), | 36 | mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false), |
35 | mPilotId(0), mSyncStatus(SYNCMOD) | 37 | mPilotId(0), mSyncStatus(SYNCMOD) |
36 | { | 38 | { |
37 | blockLastModified = false; | 39 | blockLastModified = false; |
38 | setUid(CalFormat::createUniqueId()); | 40 | setUid(CalFormat::createUniqueId()); |
39 | mOrganizer = ""; | 41 | mOrganizer = ""; |
40 | mFloats = false; | 42 | mFloats = false; |
41 | mDuration = 0; | 43 | mDuration = 0; |
42 | mHasDuration = false; | 44 | mHasDuration = false; |
43 | mPilotId = 0; | 45 | mPilotId = 0; |
44 | mExternalId = ":"; | 46 | mExternalId = ":"; |
45 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 47 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
@@ -51,33 +53,33 @@ IncidenceBase::IncidenceBase() : | |||
51 | } | 53 | } |
52 | 54 | ||
53 | IncidenceBase::IncidenceBase(const IncidenceBase &i) : | 55 | IncidenceBase::IncidenceBase(const IncidenceBase &i) : |
54 | CustomProperties( i ) | 56 | CustomProperties( i ) |
55 | { | 57 | { |
56 | 58 | ||
57 | blockLastModified = false; | 59 | blockLastModified = false; |
58 | mReadOnly = i.mReadOnly; | 60 | mReadOnly = i.mReadOnly; |
59 | mDtStart = i.mDtStart; | 61 | mDtStart = i.mDtStart; |
60 | mDuration = i.mDuration; | 62 | mDuration = i.mDuration; |
61 | mHasDuration = i.mHasDuration; | 63 | mHasDuration = i.mHasDuration; |
62 | mOrganizer = i.mOrganizer; | 64 | mOrganizer = i.mOrganizer; |
63 | mUid = i.mUid; | 65 | mUid = i.mUid; |
64 | mCalEnabled = i.mCalEnabled; | 66 | mCalEnabled = i.mCalEnabled; |
65 | mAlarmEnabled = i.mAlarmEnabled; | 67 | mAlarmEnabled = i.mAlarmEnabled; |
66 | mCalID = i.mCalID; | 68 | mCalID = i.mCalID; |
67 | QPtrList<Attendee> attendees = i.attendees(); | 69 | Q3PtrList<Attendee> attendees = i.attendees(); |
68 | for( Attendee *a = attendees.first(); a; a = attendees.next() ) { | 70 | for( Attendee *a = attendees.first(); a; a = attendees.next() ) { |
69 | mAttendees.append( new Attendee( *a ) ); | 71 | mAttendees.append( new Attendee( *a ) ); |
70 | } | 72 | } |
71 | mFloats = i.mFloats; | 73 | mFloats = i.mFloats; |
72 | mLastModified = i.mLastModified; | 74 | mLastModified = i.mLastModified; |
73 | mPilotId = i.mPilotId; | 75 | mPilotId = i.mPilotId; |
74 | mTempSyncStat = i.mTempSyncStat; | 76 | mTempSyncStat = i.mTempSyncStat; |
75 | mSyncStatus = i.mSyncStatus; | 77 | mSyncStatus = i.mSyncStatus; |
76 | mExternalId = i.mExternalId; | 78 | mExternalId = i.mExternalId; |
77 | // The copied object is a new one, so it isn't observed by the observer | 79 | // The copied object is a new one, so it isn't observed by the observer |
78 | // of the original object. | 80 | // of the original object. |
79 | mObservers.clear(); | 81 | mObservers.clear(); |
80 | 82 | ||
81 | mAttendees.setAutoDelete( true ); | 83 | mAttendees.setAutoDelete( true ); |
82 | } | 84 | } |
83 | 85 | ||
@@ -287,33 +289,33 @@ bool IncidenceBase::doesFloat() const | |||
287 | } | 289 | } |
288 | 290 | ||
289 | void IncidenceBase::setFloats(bool f) | 291 | void IncidenceBase::setFloats(bool f) |
290 | { | 292 | { |
291 | if (mReadOnly) return; | 293 | if (mReadOnly) return; |
292 | mFloats = f; | 294 | mFloats = f; |
293 | updated(); | 295 | updated(); |
294 | } | 296 | } |
295 | 297 | ||
296 | 298 | ||
297 | bool IncidenceBase::addAttendee(Attendee *a, bool doupdate) | 299 | bool IncidenceBase::addAttendee(Attendee *a, bool doupdate) |
298 | { | 300 | { |
299 | if (mReadOnly) return false; | 301 | if (mReadOnly) return false; |
300 | if (a->name().left(7).upper() == "MAILTO:") | 302 | if (a->name().left(7).upper() == "MAILTO:") |
301 | a->setName(a->name().remove(0,7)); | 303 | a->setName(a->name().remove(0,7)); |
302 | 304 | ||
303 | QPtrListIterator<Attendee> qli(mAttendees); | 305 | Q3PtrListIterator<Attendee> qli(mAttendees); |
304 | 306 | ||
305 | qli.toFirst(); | 307 | qli.toFirst(); |
306 | while (qli) { | 308 | while (qli) { |
307 | if (*qli.current() == *a) | 309 | if (*qli.current() == *a) |
308 | return false; | 310 | return false; |
309 | ++qli; | 311 | ++qli; |
310 | } | 312 | } |
311 | mAttendees.append(a); | 313 | mAttendees.append(a); |
312 | if (doupdate) updated(); | 314 | if (doupdate) updated(); |
313 | return true; | 315 | return true; |
314 | } | 316 | } |
315 | 317 | ||
316 | #if 0 | 318 | #if 0 |
317 | void IncidenceBase::removeAttendee(Attendee *a) | 319 | void IncidenceBase::removeAttendee(Attendee *a) |
318 | { | 320 | { |
319 | if (mReadOnly) return; | 321 | if (mReadOnly) return; |
@@ -330,60 +332,60 @@ void IncidenceBase::removeAttendee(const char *n) | |||
330 | if (a->getName() == n) { | 332 | if (a->getName() == n) { |
331 | mAttendees.remove(); | 333 | mAttendees.remove(); |
332 | break; | 334 | break; |
333 | } | 335 | } |
334 | } | 336 | } |
335 | #endif | 337 | #endif |
336 | 338 | ||
337 | void IncidenceBase::clearAttendees() | 339 | void IncidenceBase::clearAttendees() |
338 | { | 340 | { |
339 | if (mReadOnly) return; | 341 | if (mReadOnly) return; |
340 | mAttendees.clear(); | 342 | mAttendees.clear(); |
341 | } | 343 | } |
342 | 344 | ||
343 | #if 0 | 345 | #if 0 |
344 | Attendee *IncidenceBase::getAttendee(const char *n) const | 346 | Attendee *IncidenceBase::getAttendee(const char *n) const |
345 | { | 347 | { |
346 | QPtrListIterator<Attendee> qli(mAttendees); | 348 | Q3PtrListIterator<Attendee> qli(mAttendees); |
347 | 349 | ||
348 | qli.toFirst(); | 350 | qli.toFirst(); |
349 | while (qli) { | 351 | while (qli) { |
350 | if (qli.current()->getName() == n) | 352 | if (qli.current()->getName() == n) |
351 | return qli.current(); | 353 | return qli.current(); |
352 | ++qli; | 354 | ++qli; |
353 | } | 355 | } |
354 | return 0L; | 356 | return 0L; |
355 | } | 357 | } |
356 | #endif | 358 | #endif |
357 | 359 | ||
358 | Attendee *IncidenceBase::attendeeByMail(const QString &email) | 360 | Attendee *IncidenceBase::attendeeByMail(const QString &email) |
359 | { | 361 | { |
360 | QPtrListIterator<Attendee> qli(mAttendees); | 362 | Q3PtrListIterator<Attendee> qli(mAttendees); |
361 | 363 | ||
362 | qli.toFirst(); | 364 | qli.toFirst(); |
363 | while (qli) { | 365 | while (qli) { |
364 | if (qli.current()->email().lower() == email.lower()) | 366 | if (qli.current()->email().lower() == email.lower()) |
365 | return qli.current(); | 367 | return qli.current(); |
366 | ++qli; | 368 | ++qli; |
367 | } | 369 | } |
368 | return 0L; | 370 | return 0L; |
369 | } | 371 | } |
370 | 372 | ||
371 | Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) | 373 | Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) |
372 | { | 374 | { |
373 | QPtrListIterator<Attendee> qli(mAttendees); | 375 | Q3PtrListIterator<Attendee> qli(mAttendees); |
374 | 376 | ||
375 | QStringList mails = emails; | 377 | QStringList mails = emails; |
376 | if (!email.isEmpty()) { | 378 | if (!email.isEmpty()) { |
377 | mails.append(email); | 379 | mails.append(email); |
378 | } | 380 | } |
379 | qli.toFirst(); | 381 | qli.toFirst(); |
380 | while (qli) { | 382 | while (qli) { |
381 | for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { | 383 | for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { |
382 | if (qli.current()->email().lower() == (*it).lower()) | 384 | if (qli.current()->email().lower() == (*it).lower()) |
383 | return qli.current(); | 385 | return qli.current(); |
384 | } | 386 | } |
385 | 387 | ||
386 | ++qli; | 388 | ++qli; |
387 | } | 389 | } |
388 | return 0L; | 390 | return 0L; |
389 | } | 391 | } |
@@ -478,23 +480,23 @@ void IncidenceBase::setIDStr( const QString & s ) | |||
478 | QString IncidenceBase::IDStr() const | 480 | QString IncidenceBase::IDStr() const |
479 | { | 481 | { |
480 | return mExternalId ; | 482 | return mExternalId ; |
481 | } | 483 | } |
482 | void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) | 484 | void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) |
483 | { | 485 | { |
484 | if( !mObservers.contains(observer) ) mObservers.append( observer ); | 486 | if( !mObservers.contains(observer) ) mObservers.append( observer ); |
485 | } | 487 | } |
486 | 488 | ||
487 | void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) | 489 | void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) |
488 | { | 490 | { |
489 | mObservers.remove( observer ); | 491 | mObservers.remove( observer ); |
490 | } | 492 | } |
491 | 493 | ||
492 | void IncidenceBase::updated() | 494 | void IncidenceBase::updated() |
493 | { | 495 | { |
494 | QPtrListIterator<Observer> it(mObservers); | 496 | Q3PtrListIterator<Observer> it(mObservers); |
495 | while( it.current() ) { | 497 | while( it.current() ) { |
496 | Observer *o = it.current(); | 498 | Observer *o = it.current(); |
497 | ++it; | 499 | ++it; |
498 | o->incidenceUpdated( this ); | 500 | o->incidenceUpdated( this ); |
499 | } | 501 | } |
500 | } | 502 | } |