summaryrefslogtreecommitdiffabout
path: root/libkcal/incidencebase.cpp
Unidiff
Diffstat (limited to 'libkcal/incidencebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidencebase.cpp14
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
@@ -18,24 +18,26 @@
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
31using namespace KCal; 33using namespace KCal;
32 34
33IncidenceBase::IncidenceBase() : 35IncidenceBase::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;
@@ -55,25 +57,25 @@ IncidenceBase::IncidenceBase(const IncidenceBase &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();
@@ -291,25 +293,25 @@ void IncidenceBase::setFloats(bool f)
291 if (mReadOnly) return; 293 if (mReadOnly) return;
292 mFloats = f; 294 mFloats = f;
293 updated(); 295 updated();
294} 296}
295 297
296 298
297bool IncidenceBase::addAttendee(Attendee *a, bool doupdate) 299bool 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
@@ -334,52 +336,52 @@ void IncidenceBase::removeAttendee(const char *n)
334} 336}
335#endif 337#endif
336 338
337void IncidenceBase::clearAttendees() 339void 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
344Attendee *IncidenceBase::getAttendee(const char *n) const 346Attendee *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
358Attendee *IncidenceBase::attendeeByMail(const QString &email) 360Attendee *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
371Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) 373Attendee *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
@@ -482,19 +484,19 @@ QString IncidenceBase::IDStr() const
482void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) 484void 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
487void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) 489void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer )
488{ 490{
489 mObservers.remove( observer ); 491 mObservers.remove( observer );
490} 492}
491 493
492void IncidenceBase::updated() 494void 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}