summaryrefslogtreecommitdiffabout
path: root/libkcal/incidencebase.cpp
authorzautrix <zautrix>2005-08-19 12:08:05 (UTC)
committer zautrix <zautrix>2005-08-19 12:08:05 (UTC)
commit9014049779be6cfec02d73e19596439f0f4f9bed (patch) (unidiff)
tree3983282e83183cc15dd615ba4ac5a800da21efe0 /libkcal/incidencebase.cpp
parent81891a49afc2f7cd89db4e2770c3b7831644428d (diff)
downloadkdepimpi-9014049779be6cfec02d73e19596439f0f4f9bed.zip
kdepimpi-9014049779be6cfec02d73e19596439f0f4f9bed.tar.gz
kdepimpi-9014049779be6cfec02d73e19596439f0f4f9bed.tar.bz2
list sort fix
Diffstat (limited to 'libkcal/incidencebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidencebase.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 022dead..cfef973 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -1,482 +1,493 @@
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 30
31using namespace KCal; 31using namespace KCal;
32 32
33IncidenceBase::IncidenceBase() : 33IncidenceBase::IncidenceBase() :
34 mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false), 34 mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false),
35 mPilotId(0), mSyncStatus(SYNCMOD) 35 mPilotId(0), mSyncStatus(SYNCMOD)
36{ 36{
37 blockLastModified = false; 37 blockLastModified = false;
38 setUid(CalFormat::createUniqueId()); 38 setUid(CalFormat::createUniqueId());
39 mOrganizer = ""; 39 mOrganizer = "";
40 mFloats = false; 40 mFloats = false;
41 mDuration = 0; 41 mDuration = 0;
42 mHasDuration = false; 42 mHasDuration = false;
43 mPilotId = 0; 43 mPilotId = 0;
44 mExternalId = ":"; 44 mExternalId = ":";
45 mTempSyncStat = SYNC_TEMPSTATE_INITIAL; 45 mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
46 mSyncStatus = 0; 46 mSyncStatus = 0;
47 mAttendees.setAutoDelete( true ); 47 mAttendees.setAutoDelete( true );
48 mCalEnabled = true; 48 mCalEnabled = true;
49 mAlarmEnabled = true; 49 mAlarmEnabled = true;
50 mCalID = 0; 50 mCalID = 0;
51} 51}
52 52
53IncidenceBase::IncidenceBase(const IncidenceBase &i) : 53IncidenceBase::IncidenceBase(const IncidenceBase &i) :
54 CustomProperties( i ) 54 CustomProperties( i )
55{ 55{
56 56
57 blockLastModified = false; 57 blockLastModified = false;
58 mReadOnly = i.mReadOnly; 58 mReadOnly = i.mReadOnly;
59 mDtStart = i.mDtStart; 59 mDtStart = i.mDtStart;
60 mDuration = i.mDuration; 60 mDuration = i.mDuration;
61 mHasDuration = i.mHasDuration; 61 mHasDuration = i.mHasDuration;
62 mOrganizer = i.mOrganizer; 62 mOrganizer = i.mOrganizer;
63 mUid = i.mUid; 63 mUid = i.mUid;
64 mCalEnabled = i.mCalEnabled; 64 mCalEnabled = i.mCalEnabled;
65 mAlarmEnabled = i.mAlarmEnabled; 65 mAlarmEnabled = i.mAlarmEnabled;
66 mCalID = i.mCalID; 66 mCalID = i.mCalID;
67 QPtrList<Attendee> attendees = i.attendees(); 67 QPtrList<Attendee> attendees = i.attendees();
68 for( Attendee *a = attendees.first(); a; a = attendees.next() ) { 68 for( Attendee *a = attendees.first(); a; a = attendees.next() ) {
69 mAttendees.append( new Attendee( *a ) ); 69 mAttendees.append( new Attendee( *a ) );
70 } 70 }
71 mFloats = i.mFloats; 71 mFloats = i.mFloats;
72 mLastModified = i.mLastModified; 72 mLastModified = i.mLastModified;
73 mPilotId = i.mPilotId; 73 mPilotId = i.mPilotId;
74 mTempSyncStat = i.mTempSyncStat; 74 mTempSyncStat = i.mTempSyncStat;
75 mSyncStatus = i.mSyncStatus; 75 mSyncStatus = i.mSyncStatus;
76 mExternalId = i.mExternalId; 76 mExternalId = i.mExternalId;
77 // The copied object is a new one, so it isn't observed by the observer 77 // The copied object is a new one, so it isn't observed by the observer
78 // of the original object. 78 // of the original object.
79 mObservers.clear(); 79 mObservers.clear();
80 80
81 mAttendees.setAutoDelete( true ); 81 mAttendees.setAutoDelete( true );
82} 82}
83 83
84IncidenceBase::~IncidenceBase() 84IncidenceBase::~IncidenceBase()
85{ 85{
86} 86}
87 87
88 88
89bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) 89bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 )
90{ 90{
91 // do not compare mSyncStatus and mExternalId 91 // do not compare mSyncStatus and mExternalId
92 if( i1.attendees().count() != i2.attendees().count() ) { 92 if( i1.attendees().count() != i2.attendees().count() ) {
93 return false; // no need to check further 93 return false; // no need to check further
94 } 94 }
95 if ( i1.attendees().count() > 0 ) { 95 if ( i1.attendees().count() > 0 ) {
96 Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; 96 Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ;
97 while ( a1 ) { 97 while ( a1 ) {
98 if ( !( (*a1) == (*a2)) ) 98 if ( !( (*a1) == (*a2)) )
99 { 99 {
100 //qDebug("Attendee not equal "); 100 //qDebug("Attendee not equal ");
101 return false; 101 return false;
102 } 102 }
103 a1 = i1.attendees().next(); 103 a1 = i1.attendees().next();
104 a2 = i2.attendees().next(); 104 a2 = i2.attendees().next();
105 } 105 }
106 } 106 }
107 //if ( i1.dtStart() != i2.dtStart() ) 107 //if ( i1.dtStart() != i2.dtStart() )
108 // return false; 108 // return false;
109#if 0 109#if 0
110 qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); 110 qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() );
111 qDebug("1 %d ",i1.duration() == i2.duration() ); 111 qDebug("1 %d ",i1.duration() == i2.duration() );
112 qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); 112 qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() );
113 qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); 113 qDebug("1 %d ",i1.pilotId() == i2.pilotId() );
114 qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); 114 qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() );
115 qDebug("6 %d ",i1.organizer() == i2.organizer() ); 115 qDebug("6 %d ",i1.organizer() == i2.organizer() );
116 116
117#endif 117#endif
118 if ( i1.hasDuration() == i2.hasDuration() ) { 118 if ( i1.hasDuration() == i2.hasDuration() ) {
119 if ( i1.hasDuration() ) { 119 if ( i1.hasDuration() ) {
120 if ( i1.duration() != i2.duration() ) 120 if ( i1.duration() != i2.duration() )
121 return false; 121 return false;
122 } 122 }
123 } else { 123 } else {
124 return false; 124 return false;
125 } 125 }
126 126
127 return ( i1.organizer() == i2.organizer() && 127 return ( i1.organizer() == i2.organizer() &&
128 // i1.uid() == i2.uid() && 128 // i1.uid() == i2.uid() &&
129 // Don't compare lastModified, otherwise the operator is not 129 // Don't compare lastModified, otherwise the operator is not
130 // of much use. We are not comparing for identity, after all. 130 // of much use. We are not comparing for identity, after all.
131 i1.doesFloat() == i2.doesFloat() && 131 i1.doesFloat() == i2.doesFloat() &&
132 i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); 132 i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() );
133 // no need to compare mObserver 133 // no need to compare mObserver
134} 134}
135 135
136 136
137QDateTime IncidenceBase::getEvenTime( QDateTime dt ) 137QDateTime IncidenceBase::getEvenTime( QDateTime dt )
138{ 138{
139 QTime t = dt.time(); 139 QTime t = dt.time();
140 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 140 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) );
141 return dt; 141 return dt;
142} 142}
143 143
144bool IncidenceBase::isTagged() const 144bool IncidenceBase::isTagged() const
145{ 145{
146 return mIsTagged; 146 return mIsTagged;
147} 147}
148void IncidenceBase::setTagged( bool b) 148void IncidenceBase::setTagged( bool b)
149{ 149{
150 mIsTagged = b; 150 mIsTagged = b;
151} 151}
152void IncidenceBase::setCalID( int id ) 152void 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}
161int IncidenceBase::calID() const 161int IncidenceBase::calID() const
162{ 162{
163 return mCalID; 163 return mCalID;
164} 164}
165void IncidenceBase::setCalEnabled( bool b ) 165void IncidenceBase::setCalEnabled( bool b )
166{ 166{
167 mCalEnabled = b; 167 mCalEnabled = b;
168} 168}
169bool IncidenceBase::calEnabled() const 169bool IncidenceBase::calEnabled() const
170{ 170{
171 return mCalEnabled; 171 return mCalEnabled;
172} 172}
173 173
174void IncidenceBase::setAlarmEnabled( bool b ) 174void IncidenceBase::setAlarmEnabled( bool b )
175{ 175{
176 mAlarmEnabled = b; 176 mAlarmEnabled = b;
177} 177}
178bool IncidenceBase::alarmEnabled() const 178bool IncidenceBase::alarmEnabled() const
179{ 179{
180 return mAlarmEnabled; 180 return mAlarmEnabled;
181} 181}
182 182
183 183
184void IncidenceBase::setUid(const QString &uid) 184void IncidenceBase::setUid(const QString &uid)
185{ 185{
186 mUid = uid; 186 mUid = uid;
187 updated(); 187 updated();
188} 188}
189 189
190QString IncidenceBase::uid() const 190QString IncidenceBase::uid() const
191{ 191{
192 return mUid; 192 return mUid;
193} 193}
194void IncidenceBase::setLastModifiedSubInvalid() 194void IncidenceBase::setLastModifiedSubInvalid()
195{ 195{
196 196 // virtual method
197} 197}
198void IncidenceBase::setLastModified(const QDateTime &lm) 198void IncidenceBase::setLastModified(const QDateTime &lm)
199{ 199{
200 if ( blockLastModified ) return; 200 if ( blockLastModified ) return;
201 // DON'T! updated() because we call this from 201 // DON'T! updated() because we call this from
202 // Calendar::updateEvent(). 202 // Calendar::updateEvent().
203 mLastModified = getEvenTime(lm); 203 mLastModified = getEvenTime(lm);
204 mLastModifiedKey.sprintf("%04d%02d%02d%02d%02d%02d",
205 mLastModified.date().year(),
206 mLastModified.date().month(),
207 mLastModified.date().day(),
208 mLastModified.time().hour(),
209 mLastModified.time().minute(),
210 mLastModified.time().second() );
204 setLastModifiedSubInvalid(); 211 setLastModifiedSubInvalid();
205 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); 212 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1());
206} 213}
214QString IncidenceBase::lastModifiedSortKey() const
215{
216 return mLastModifiedKey;
217}
207 218
208QDateTime IncidenceBase::lastModified() const 219QDateTime IncidenceBase::lastModified() const
209{ 220{
210 return mLastModified; 221 return mLastModified;
211} 222}
212 223
213void IncidenceBase::setOrganizer(const QString &o) 224void IncidenceBase::setOrganizer(const QString &o)
214{ 225{
215 // we don't check for readonly here, because it is 226 // we don't check for readonly here, because it is
216 // possible that by setting the organizer we are changing 227 // possible that by setting the organizer we are changing
217 // the event's readonly status... 228 // the event's readonly status...
218 mOrganizer = o; 229 mOrganizer = o;
219 if (mOrganizer.left(7).upper() == "MAILTO:") 230 if (mOrganizer.left(7).upper() == "MAILTO:")
220 mOrganizer = mOrganizer.remove(0,7); 231 mOrganizer = mOrganizer.remove(0,7);
221 232
222 updated(); 233 updated();
223} 234}
224 235
225QString IncidenceBase::organizer() const 236QString IncidenceBase::organizer() const
226{ 237{
227 return mOrganizer; 238 return mOrganizer;
228} 239}
229 240
230void IncidenceBase::setReadOnly( bool readOnly ) 241void IncidenceBase::setReadOnly( bool readOnly )
231{ 242{
232 mReadOnly = readOnly; 243 mReadOnly = readOnly;
233} 244}
234 245
235void IncidenceBase::setDtStart(const QDateTime &dtStart) 246void IncidenceBase::setDtStart(const QDateTime &dtStart)
236{ 247{
237// if (mReadOnly) return; 248// if (mReadOnly) return;
238 mDtStart = getEvenTime(dtStart); 249 mDtStart = getEvenTime(dtStart);
239 updated(); 250 updated();
240} 251}
241 252
242 253
243QDateTime IncidenceBase::dtStart() const 254QDateTime IncidenceBase::dtStart() const
244{ 255{
245 return mDtStart; 256 return mDtStart;
246} 257}
247 258
248QString IncidenceBase::dtStartTimeStr() const 259QString IncidenceBase::dtStartTimeStr() const
249{ 260{
250 return KGlobal::locale()->formatTime(dtStart().time()); 261 return KGlobal::locale()->formatTime(dtStart().time());
251} 262}
252 263
253QString IncidenceBase::dtStartDateStr(bool shortfmt) const 264QString IncidenceBase::dtStartDateStr(bool shortfmt) const
254{ 265{
255 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); 266 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);
256} 267}
257 268
258QString IncidenceBase::dtStartStr(bool shortfmt) const 269QString IncidenceBase::dtStartStr(bool shortfmt) const
259{ 270{
260 if ( doesFloat() ) 271 if ( doesFloat() )
261 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); 272 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);
262 return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); 273 return KGlobal::locale()->formatDateTime(dtStart(), shortfmt);
263} 274}
264 275
265 276
266bool IncidenceBase::doesFloat() const 277bool IncidenceBase::doesFloat() const
267{ 278{
268 return mFloats; 279 return mFloats;
269} 280}
270 281
271void IncidenceBase::setFloats(bool f) 282void IncidenceBase::setFloats(bool f)
272{ 283{
273 if (mReadOnly) return; 284 if (mReadOnly) return;
274 mFloats = f; 285 mFloats = f;
275 updated(); 286 updated();
276} 287}
277 288
278 289
279bool IncidenceBase::addAttendee(Attendee *a, bool doupdate) 290bool IncidenceBase::addAttendee(Attendee *a, bool doupdate)
280{ 291{
281 if (mReadOnly) return false; 292 if (mReadOnly) return false;
282 if (a->name().left(7).upper() == "MAILTO:") 293 if (a->name().left(7).upper() == "MAILTO:")
283 a->setName(a->name().remove(0,7)); 294 a->setName(a->name().remove(0,7));
284 295
285 QPtrListIterator<Attendee> qli(mAttendees); 296 QPtrListIterator<Attendee> qli(mAttendees);
286 297
287 qli.toFirst(); 298 qli.toFirst();
288 while (qli) { 299 while (qli) {
289 if (*qli.current() == *a) 300 if (*qli.current() == *a)
290 return false; 301 return false;
291 ++qli; 302 ++qli;
292 } 303 }
293 mAttendees.append(a); 304 mAttendees.append(a);
294 if (doupdate) updated(); 305 if (doupdate) updated();
295 return true; 306 return true;
296} 307}
297 308
298#if 0 309#if 0
299void IncidenceBase::removeAttendee(Attendee *a) 310void IncidenceBase::removeAttendee(Attendee *a)
300{ 311{
301 if (mReadOnly) return; 312 if (mReadOnly) return;
302 mAttendees.removeRef(a); 313 mAttendees.removeRef(a);
303 updated(); 314 updated();
304} 315}
305 316
306void IncidenceBase::removeAttendee(const char *n) 317void IncidenceBase::removeAttendee(const char *n)
307{ 318{
308 Attendee *a; 319 Attendee *a;
309 320
310 if (mReadOnly) return; 321 if (mReadOnly) return;
311 for (a = mAttendees.first(); a; a = mAttendees.next()) 322 for (a = mAttendees.first(); a; a = mAttendees.next())
312 if (a->getName() == n) { 323 if (a->getName() == n) {
313 mAttendees.remove(); 324 mAttendees.remove();
314 break; 325 break;
315 } 326 }
316} 327}
317#endif 328#endif
318 329
319void IncidenceBase::clearAttendees() 330void IncidenceBase::clearAttendees()
320{ 331{
321 if (mReadOnly) return; 332 if (mReadOnly) return;
322 mAttendees.clear(); 333 mAttendees.clear();
323} 334}
324 335
325#if 0 336#if 0
326Attendee *IncidenceBase::getAttendee(const char *n) const 337Attendee *IncidenceBase::getAttendee(const char *n) const
327{ 338{
328 QPtrListIterator<Attendee> qli(mAttendees); 339 QPtrListIterator<Attendee> qli(mAttendees);
329 340
330 qli.toFirst(); 341 qli.toFirst();
331 while (qli) { 342 while (qli) {
332 if (qli.current()->getName() == n) 343 if (qli.current()->getName() == n)
333 return qli.current(); 344 return qli.current();
334 ++qli; 345 ++qli;
335 } 346 }
336 return 0L; 347 return 0L;
337} 348}
338#endif 349#endif
339 350
340Attendee *IncidenceBase::attendeeByMail(const QString &email) 351Attendee *IncidenceBase::attendeeByMail(const QString &email)
341{ 352{
342 QPtrListIterator<Attendee> qli(mAttendees); 353 QPtrListIterator<Attendee> qli(mAttendees);
343 354
344 qli.toFirst(); 355 qli.toFirst();
345 while (qli) { 356 while (qli) {
346 if (qli.current()->email().lower() == email.lower()) 357 if (qli.current()->email().lower() == email.lower())
347 return qli.current(); 358 return qli.current();
348 ++qli; 359 ++qli;
349 } 360 }
350 return 0L; 361 return 0L;
351} 362}
352 363
353Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) 364Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email)
354{ 365{
355 QPtrListIterator<Attendee> qli(mAttendees); 366 QPtrListIterator<Attendee> qli(mAttendees);
356 367
357 QStringList mails = emails; 368 QStringList mails = emails;
358 if (!email.isEmpty()) { 369 if (!email.isEmpty()) {
359 mails.append(email); 370 mails.append(email);
360 } 371 }
361 qli.toFirst(); 372 qli.toFirst();
362 while (qli) { 373 while (qli) {
363 for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { 374 for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) {
364 if (qli.current()->email().lower() == (*it).lower()) 375 if (qli.current()->email().lower() == (*it).lower())
365 return qli.current(); 376 return qli.current();
366 } 377 }
367 378
368 ++qli; 379 ++qli;
369 } 380 }
370 return 0L; 381 return 0L;
371} 382}
372 383
373void IncidenceBase::setDuration(int seconds) 384void IncidenceBase::setDuration(int seconds)
374{ 385{
375 mDuration = seconds; 386 mDuration = seconds;
376 setHasDuration(true); 387 setHasDuration(true);
377} 388}
378 389
379int IncidenceBase::duration() const 390int IncidenceBase::duration() const
380{ 391{
381 return mDuration; 392 return mDuration;
382} 393}
383 394
384void IncidenceBase::setHasDuration(bool b) 395void IncidenceBase::setHasDuration(bool b)
385{ 396{
386 mHasDuration = b; 397 mHasDuration = b;
387} 398}
388 399
389bool IncidenceBase::hasDuration() const 400bool IncidenceBase::hasDuration() const
390{ 401{
391 return mHasDuration; 402 return mHasDuration;
392} 403}
393 404
394void IncidenceBase::setSyncStatus(int stat) 405void IncidenceBase::setSyncStatus(int stat)
395{ 406{
396 if (mReadOnly) return; 407 if (mReadOnly) return;
397 mSyncStatus = stat; 408 mSyncStatus = stat;
398} 409}
399 410
400int IncidenceBase::syncStatus() const 411int IncidenceBase::syncStatus() const
401{ 412{
402 return mSyncStatus; 413 return mSyncStatus;
403} 414}
404 415
405void IncidenceBase::setPilotId( int id ) 416void IncidenceBase::setPilotId( int id )
406{ 417{
407 if (mReadOnly) return; 418 if (mReadOnly) return;
408 mPilotId = id; 419 mPilotId = id;
409} 420}
410 421
411int IncidenceBase::pilotId() const 422int IncidenceBase::pilotId() const
412{ 423{
413 return mPilotId; 424 return mPilotId;
414} 425}
415 426
416int IncidenceBase::tempSyncStat() const 427int IncidenceBase::tempSyncStat() const
417{ 428{
418 return mTempSyncStat; 429 return mTempSyncStat;
419} 430}
420void IncidenceBase::setTempSyncStat( int id ) 431void IncidenceBase::setTempSyncStat( int id )
421{ 432{
422 if (mReadOnly) return; 433 if (mReadOnly) return;
423 mTempSyncStat = id; 434 mTempSyncStat = id;
424} 435}
425 436
426void IncidenceBase::removeID(const QString &prof) 437void IncidenceBase::removeID(const QString &prof)
427{ 438{
428 if ( prof.isEmpty() ) 439 if ( prof.isEmpty() )
429 mExternalId = ":"; 440 mExternalId = ":";
430 else 441 else
431 mExternalId = KIdManager::removeId ( mExternalId, prof); 442 mExternalId = KIdManager::removeId ( mExternalId, prof);
432 443
433} 444}
434void IncidenceBase::setID( const QString & prof , const QString & id ) 445void IncidenceBase::setID( const QString & prof , const QString & id )
435{ 446{
436 mExternalId = KIdManager::setId ( mExternalId, prof, id ); 447 mExternalId = KIdManager::setId ( mExternalId, prof, id );
437} 448}
438QString IncidenceBase::getID( const QString & prof) 449QString IncidenceBase::getID( const QString & prof)
439{ 450{
440 return KIdManager::getId ( mExternalId, prof ); 451 return KIdManager::getId ( mExternalId, prof );
441} 452}
442 453
443// example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: 454// example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0:
444// format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 455// format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0
445void IncidenceBase::setCsum( const QString & prof , const QString & id ) 456void IncidenceBase::setCsum( const QString & prof , const QString & id )
446{ 457{
447 mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); 458 mExternalId = KIdManager::setCsum ( mExternalId, prof, id );
448} 459}
449QString IncidenceBase::getCsum( const QString & prof) 460QString IncidenceBase::getCsum( const QString & prof)
450{ 461{
451 return KIdManager::getCsum ( mExternalId, prof ); 462 return KIdManager::getCsum ( mExternalId, prof );
452} 463}
453 464
454void IncidenceBase::setIDStr( const QString & s ) 465void IncidenceBase::setIDStr( const QString & s )
455{ 466{
456 if (mReadOnly) return; 467 if (mReadOnly) return;
457 mExternalId = s; 468 mExternalId = s;
458} 469}
459 470
460QString IncidenceBase::IDStr() const 471QString IncidenceBase::IDStr() const
461{ 472{
462 return mExternalId ; 473 return mExternalId ;
463} 474}
464void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) 475void IncidenceBase::registerObserver( IncidenceBase::Observer *observer )
465{ 476{
466 if( !mObservers.contains(observer) ) mObservers.append( observer ); 477 if( !mObservers.contains(observer) ) mObservers.append( observer );
467} 478}
468 479
469void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) 480void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer )
470{ 481{
471 mObservers.remove( observer ); 482 mObservers.remove( observer );
472} 483}
473 484
474void IncidenceBase::updated() 485void IncidenceBase::updated()
475{ 486{
476 QPtrListIterator<Observer> it(mObservers); 487 QPtrListIterator<Observer> it(mObservers);
477 while( it.current() ) { 488 while( it.current() ) {
478 Observer *o = it.current(); 489 Observer *o = it.current();
479 ++it; 490 ++it;
480 o->incidenceUpdated( this ); 491 o->incidenceUpdated( this );
481 } 492 }
482} 493}