summaryrefslogtreecommitdiffabout
path: root/libkcal/incidencebase.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /libkcal/incidencebase.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
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
@@ -1,500 +1,502 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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#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;
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;
46 mSyncStatus = 0; 48 mSyncStatus = 0;
47 mAttendees.setAutoDelete( true ); 49 mAttendees.setAutoDelete( true );
48 mCalEnabled = true; 50 mCalEnabled = true;
49 mAlarmEnabled = true; 51 mAlarmEnabled = true;
50 mCalID = 0; 52 mCalID = 0;
51} 53}
52 54
53IncidenceBase::IncidenceBase(const IncidenceBase &i) : 55IncidenceBase::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
84IncidenceBase::~IncidenceBase() 86IncidenceBase::~IncidenceBase()
85{ 87{
86} 88}
87 89
88 90
89bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) 91bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 )
90{ 92{
91 // do not compare mSyncStatus and mExternalId 93 // do not compare mSyncStatus and mExternalId
92 if( i1.attendees().count() != i2.attendees().count() ) { 94 if( i1.attendees().count() != i2.attendees().count() ) {
93 return false; // no need to check further 95 return false; // no need to check further
94 } 96 }
95 if ( i1.attendees().count() > 0 ) { 97 if ( i1.attendees().count() > 0 ) {
96 Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; 98 Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ;
97 while ( a1 ) { 99 while ( a1 ) {
98 if ( !( (*a1) == (*a2)) ) 100 if ( !( (*a1) == (*a2)) )
99 { 101 {
100 //qDebug("Attendee not equal "); 102 //qDebug("Attendee not equal ");
101 return false; 103 return false;
102 } 104 }
103 a1 = i1.attendees().next(); 105 a1 = i1.attendees().next();
104 a2 = i2.attendees().next(); 106 a2 = i2.attendees().next();
105 } 107 }
106 } 108 }
107 //if ( i1.dtStart() != i2.dtStart() ) 109 //if ( i1.dtStart() != i2.dtStart() )
108 // return false; 110 // return false;
109#if 0 111#if 0
110 qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); 112 qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() );
111 qDebug("1 %d ",i1.duration() == i2.duration() ); 113 qDebug("1 %d ",i1.duration() == i2.duration() );
112 qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); 114 qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() );
113 qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); 115 qDebug("1 %d ",i1.pilotId() == i2.pilotId() );
114 qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); 116 qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() );
115 qDebug("6 %d ",i1.organizer() == i2.organizer() ); 117 qDebug("6 %d ",i1.organizer() == i2.organizer() );
116 118
117#endif 119#endif
118 if ( i1.hasDuration() == i2.hasDuration() ) { 120 if ( i1.hasDuration() == i2.hasDuration() ) {
119 if ( i1.hasDuration() ) { 121 if ( i1.hasDuration() ) {
120 if ( i1.duration() != i2.duration() ) 122 if ( i1.duration() != i2.duration() )
121 return false; 123 return false;
122 } 124 }
123 } else { 125 } else {
124 return false; 126 return false;
125 } 127 }
126 128
127 return ( i1.organizer() == i2.organizer() && 129 return ( i1.organizer() == i2.organizer() &&
128 // i1.uid() == i2.uid() && 130 // i1.uid() == i2.uid() &&
129 // Don't compare lastModified, otherwise the operator is not 131 // Don't compare lastModified, otherwise the operator is not
130 // of much use. We are not comparing for identity, after all. 132 // of much use. We are not comparing for identity, after all.
131 i1.doesFloat() == i2.doesFloat() && 133 i1.doesFloat() == i2.doesFloat() &&
132 i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); 134 i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() );
133 // no need to compare mObserver 135 // no need to compare mObserver
134} 136}
135 137
136 138
137QDateTime IncidenceBase::getEvenTime( QDateTime dt ) 139QDateTime IncidenceBase::getEvenTime( QDateTime dt )
138{ 140{
139 QTime t = dt.time(); 141 QTime t = dt.time();
140 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 142 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) );
141 return dt; 143 return dt;
142} 144}
143 145
144bool IncidenceBase::isTagged() const 146bool IncidenceBase::isTagged() const
145{ 147{
146 return mIsTagged; 148 return mIsTagged;
147} 149}
148void IncidenceBase::setTagged( bool b) 150void IncidenceBase::setTagged( bool b)
149{ 151{
150 mIsTagged = b; 152 mIsTagged = b;
151} 153}
152void IncidenceBase::setCalID( int id ) 154void IncidenceBase::setCalID( int id )
153{ 155{
154 if ( mCalID > 0 ) { 156 if ( mCalID > 0 ) {
155 updated(); 157 updated();
156 } 158 }
157 mCalID = id; 159 mCalID = id;
158} 160}
159void IncidenceBase::setCalID_block( int id ) 161void IncidenceBase::setCalID_block( int id )
160{ 162{
161 if ( mCalID > 0 ) { 163 if ( mCalID > 0 ) {
162 blockLastModified = true; 164 blockLastModified = true;
163 updated(); 165 updated();
164 blockLastModified = false; 166 blockLastModified = false;
165 } 167 }
166 mCalID = id; 168 mCalID = id;
167} 169}
168int IncidenceBase::calID() const 170int IncidenceBase::calID() const
169{ 171{
170 return mCalID; 172 return mCalID;
171} 173}
172void IncidenceBase::setCalEnabled( bool b ) 174void IncidenceBase::setCalEnabled( bool b )
173{ 175{
174 mCalEnabled = b; 176 mCalEnabled = b;
175} 177}
176bool IncidenceBase::calEnabled() const 178bool IncidenceBase::calEnabled() const
177{ 179{
178 return mCalEnabled; 180 return mCalEnabled;
179} 181}
180 182
181void IncidenceBase::setAlarmEnabled( bool b ) 183void IncidenceBase::setAlarmEnabled( bool b )
182{ 184{
183 mAlarmEnabled = b; 185 mAlarmEnabled = b;
184} 186}
185bool IncidenceBase::alarmEnabled() const 187bool IncidenceBase::alarmEnabled() const
186{ 188{
187 return mAlarmEnabled; 189 return mAlarmEnabled;
188} 190}
189 191
190 192
191void IncidenceBase::setUid(const QString &uid) 193void IncidenceBase::setUid(const QString &uid)
192{ 194{
193 mUid = uid; 195 mUid = uid;
194 updated(); 196 updated();
195} 197}
196 198
197QString IncidenceBase::uid() const 199QString IncidenceBase::uid() const
198{ 200{
199 return mUid; 201 return mUid;
200} 202}
201void IncidenceBase::setLastModifiedSubInvalid() 203void IncidenceBase::setLastModifiedSubInvalid()
202{ 204{
203 // virtual method 205 // virtual method
204} 206}
205void IncidenceBase::setLastModified(const QDateTime &lm) 207void IncidenceBase::setLastModified(const QDateTime &lm)
206{ 208{
207 if ( blockLastModified ) return; 209 if ( blockLastModified ) return;
208 // DON'T! updated() because we call this from 210 // DON'T! updated() because we call this from
209 // Calendar::updateEvent(). 211 // Calendar::updateEvent().
210 mLastModified = getEvenTime(lm); 212 mLastModified = getEvenTime(lm);
211 mLastModifiedKey.sprintf("%04d%02d%02d%02d%02d%02d", 213 mLastModifiedKey.sprintf("%04d%02d%02d%02d%02d%02d",
212 mLastModified.date().year(), 214 mLastModified.date().year(),
213 mLastModified.date().month(), 215 mLastModified.date().month(),
214 mLastModified.date().day(), 216 mLastModified.date().day(),
215 mLastModified.time().hour(), 217 mLastModified.time().hour(),
216 mLastModified.time().minute(), 218 mLastModified.time().minute(),
217 mLastModified.time().second() ); 219 mLastModified.time().second() );
218 setLastModifiedSubInvalid(); 220 setLastModifiedSubInvalid();
219 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); 221 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1());
220} 222}
221QString IncidenceBase::lastModifiedSortKey() const 223QString IncidenceBase::lastModifiedSortKey() const
222{ 224{
223 return mLastModifiedKey; 225 return mLastModifiedKey;
224} 226}
225 227
226QDateTime IncidenceBase::lastModified() const 228QDateTime IncidenceBase::lastModified() const
227{ 229{
228 return mLastModified; 230 return mLastModified;
229} 231}
230 232
231void IncidenceBase::setOrganizer(const QString &o) 233void IncidenceBase::setOrganizer(const QString &o)
232{ 234{
233 // we don't check for readonly here, because it is 235 // we don't check for readonly here, because it is
234 // possible that by setting the organizer we are changing 236 // possible that by setting the organizer we are changing
235 // the event's readonly status... 237 // the event's readonly status...
236 mOrganizer = o; 238 mOrganizer = o;
237 if (mOrganizer.left(7).upper() == "MAILTO:") 239 if (mOrganizer.left(7).upper() == "MAILTO:")
238 mOrganizer = mOrganizer.remove(0,7); 240 mOrganizer = mOrganizer.remove(0,7);
239 241
240 updated(); 242 updated();
241} 243}
242 244
243QString IncidenceBase::organizer() const 245QString IncidenceBase::organizer() const
244{ 246{
245 return mOrganizer; 247 return mOrganizer;
246} 248}
247 249
248void IncidenceBase::setReadOnly( bool readOnly ) 250void IncidenceBase::setReadOnly( bool readOnly )
249{ 251{
250 mReadOnly = readOnly; 252 mReadOnly = readOnly;
251} 253}
252 254
253void IncidenceBase::setDtStart(const QDateTime &dtStart) 255void IncidenceBase::setDtStart(const QDateTime &dtStart)
254{ 256{
255// if (mReadOnly) return; 257// if (mReadOnly) return;
256 mDtStart = getEvenTime(dtStart); 258 mDtStart = getEvenTime(dtStart);
257 updated(); 259 updated();
258} 260}
259 261
260 262
261QDateTime IncidenceBase::dtStart() const 263QDateTime IncidenceBase::dtStart() const
262{ 264{
263 return mDtStart; 265 return mDtStart;
264} 266}
265 267
266QString IncidenceBase::dtStartTimeStr() const 268QString IncidenceBase::dtStartTimeStr() const
267{ 269{
268 return KGlobal::locale()->formatTime(dtStart().time()); 270 return KGlobal::locale()->formatTime(dtStart().time());
269} 271}
270 272
271QString IncidenceBase::dtStartDateStr(bool shortfmt) const 273QString IncidenceBase::dtStartDateStr(bool shortfmt) const
272{ 274{
273 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); 275 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);
274} 276}
275 277
276QString IncidenceBase::dtStartStr(bool shortfmt) const 278QString IncidenceBase::dtStartStr(bool shortfmt) const
277{ 279{
278 if ( doesFloat() ) 280 if ( doesFloat() )
279 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); 281 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);
280 return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); 282 return KGlobal::locale()->formatDateTime(dtStart(), shortfmt);
281} 283}
282 284
283 285
284bool IncidenceBase::doesFloat() const 286bool IncidenceBase::doesFloat() const
285{ 287{
286 return mFloats; 288 return mFloats;
287} 289}
288 290
289void IncidenceBase::setFloats(bool f) 291void 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
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
316#if 0 318#if 0
317void IncidenceBase::removeAttendee(Attendee *a) 319void IncidenceBase::removeAttendee(Attendee *a)
318{ 320{
319 if (mReadOnly) return; 321 if (mReadOnly) return;
320 mAttendees.removeRef(a); 322 mAttendees.removeRef(a);
321 updated(); 323 updated();
322} 324}
323 325
324void IncidenceBase::removeAttendee(const char *n) 326void IncidenceBase::removeAttendee(const char *n)
325{ 327{
326 Attendee *a; 328 Attendee *a;
327 329
328 if (mReadOnly) return; 330 if (mReadOnly) return;
329 for (a = mAttendees.first(); a; a = mAttendees.next()) 331 for (a = mAttendees.first(); a; a = mAttendees.next())
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
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
386 ++qli; 388 ++qli;
387 } 389 }
388 return 0L; 390 return 0L;
389} 391}
390 392
391void IncidenceBase::setDuration(int seconds) 393void IncidenceBase::setDuration(int seconds)
392{ 394{
393 mDuration = seconds; 395 mDuration = seconds;
394 setHasDuration(true); 396 setHasDuration(true);
395} 397}
396 398
397int IncidenceBase::duration() const 399int IncidenceBase::duration() const
398{ 400{
399 return mDuration; 401 return mDuration;
400} 402}
401 403
402void IncidenceBase::setHasDuration(bool b) 404void IncidenceBase::setHasDuration(bool b)
403{ 405{
404 mHasDuration = b; 406 mHasDuration = b;
405} 407}
406 408
407bool IncidenceBase::hasDuration() const 409bool IncidenceBase::hasDuration() const
408{ 410{
409 return mHasDuration; 411 return mHasDuration;
410} 412}
411 413
412void IncidenceBase::setSyncStatus(int stat) 414void IncidenceBase::setSyncStatus(int stat)
413{ 415{
414 if (mReadOnly) return; 416 if (mReadOnly) return;
415 mSyncStatus = stat; 417 mSyncStatus = stat;
416} 418}
417 419
418int IncidenceBase::syncStatus() const 420int IncidenceBase::syncStatus() const
419{ 421{
420 return mSyncStatus; 422 return mSyncStatus;
421} 423}
422 424
423void IncidenceBase::setPilotId( int id ) 425void IncidenceBase::setPilotId( int id )
424{ 426{
425 if (mReadOnly) return; 427 if (mReadOnly) return;
426 mPilotId = id; 428 mPilotId = id;
427} 429}
428 430
429int IncidenceBase::pilotId() const 431int IncidenceBase::pilotId() const
430{ 432{
431 return mPilotId; 433 return mPilotId;
432} 434}
433 435
434int IncidenceBase::tempSyncStat() const 436int IncidenceBase::tempSyncStat() const
435{ 437{
436 return mTempSyncStat; 438 return mTempSyncStat;
437} 439}
438void IncidenceBase::setTempSyncStat( int id ) 440void IncidenceBase::setTempSyncStat( int id )
439{ 441{
440 if (mReadOnly) return; 442 if (mReadOnly) return;
441 mTempSyncStat = id; 443 mTempSyncStat = id;
442} 444}
443 445
444void IncidenceBase::removeID(const QString &prof) 446void IncidenceBase::removeID(const QString &prof)
445{ 447{
446 if ( prof.isEmpty() ) 448 if ( prof.isEmpty() )
447 mExternalId = ":"; 449 mExternalId = ":";
448 else 450 else
449 mExternalId = KIdManager::removeId ( mExternalId, prof); 451 mExternalId = KIdManager::removeId ( mExternalId, prof);
450 452
451} 453}
452void IncidenceBase::setID( const QString & prof , const QString & id ) 454void IncidenceBase::setID( const QString & prof , const QString & id )
453{ 455{
454 mExternalId = KIdManager::setId ( mExternalId, prof, id ); 456 mExternalId = KIdManager::setId ( mExternalId, prof, id );
455} 457}
456QString IncidenceBase::getID( const QString & prof) 458QString IncidenceBase::getID( const QString & prof)
457{ 459{
458 return KIdManager::getId ( mExternalId, prof ); 460 return KIdManager::getId ( mExternalId, prof );
459} 461}
460 462
461// example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: 463// example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0:
462// format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 464// format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0
463void IncidenceBase::setCsum( const QString & prof , const QString & id ) 465void IncidenceBase::setCsum( const QString & prof , const QString & id )
464{ 466{
465 mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); 467 mExternalId = KIdManager::setCsum ( mExternalId, prof, id );
466} 468}
467QString IncidenceBase::getCsum( const QString & prof) 469QString IncidenceBase::getCsum( const QString & prof)
468{ 470{
469 return KIdManager::getCsum ( mExternalId, prof ); 471 return KIdManager::getCsum ( mExternalId, prof );
470} 472}
471 473
472void IncidenceBase::setIDStr( const QString & s ) 474void IncidenceBase::setIDStr( const QString & s )
473{ 475{
474 if (mReadOnly) return; 476 if (mReadOnly) return;
475 mExternalId = s; 477 mExternalId = s;
476} 478}
477 479
478QString IncidenceBase::IDStr() const 480QString IncidenceBase::IDStr() const
479{ 481{
480 return mExternalId ; 482 return mExternalId ;
481} 483}
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}