summaryrefslogtreecommitdiffabout
path: root/libkcal/incidencebase.cpp
Unidiff
Diffstat (limited to 'libkcal/incidencebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidencebase.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 1a19f3e..022dead 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -1,478 +1,482 @@
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()
195{
194 196
197}
195void IncidenceBase::setLastModified(const QDateTime &lm) 198void IncidenceBase::setLastModified(const QDateTime &lm)
196{ 199{
197 if ( blockLastModified ) return; 200 if ( blockLastModified ) return;
198 // DON'T! updated() because we call this from 201 // DON'T! updated() because we call this from
199 // Calendar::updateEvent(). 202 // Calendar::updateEvent().
200 mLastModified = getEvenTime(lm); 203 mLastModified = getEvenTime(lm);
204 setLastModifiedSubInvalid();
201 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); 205 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1());
202} 206}
203 207
204QDateTime IncidenceBase::lastModified() const 208QDateTime IncidenceBase::lastModified() const
205{ 209{
206 return mLastModified; 210 return mLastModified;
207} 211}
208 212
209void IncidenceBase::setOrganizer(const QString &o) 213void IncidenceBase::setOrganizer(const QString &o)
210{ 214{
211 // we don't check for readonly here, because it is 215 // we don't check for readonly here, because it is
212 // possible that by setting the organizer we are changing 216 // possible that by setting the organizer we are changing
213 // the event's readonly status... 217 // the event's readonly status...
214 mOrganizer = o; 218 mOrganizer = o;
215 if (mOrganizer.left(7).upper() == "MAILTO:") 219 if (mOrganizer.left(7).upper() == "MAILTO:")
216 mOrganizer = mOrganizer.remove(0,7); 220 mOrganizer = mOrganizer.remove(0,7);
217 221
218 updated(); 222 updated();
219} 223}
220 224
221QString IncidenceBase::organizer() const 225QString IncidenceBase::organizer() const
222{ 226{
223 return mOrganizer; 227 return mOrganizer;
224} 228}
225 229
226void IncidenceBase::setReadOnly( bool readOnly ) 230void IncidenceBase::setReadOnly( bool readOnly )
227{ 231{
228 mReadOnly = readOnly; 232 mReadOnly = readOnly;
229} 233}
230 234
231void IncidenceBase::setDtStart(const QDateTime &dtStart) 235void IncidenceBase::setDtStart(const QDateTime &dtStart)
232{ 236{
233// if (mReadOnly) return; 237// if (mReadOnly) return;
234 mDtStart = getEvenTime(dtStart); 238 mDtStart = getEvenTime(dtStart);
235 updated(); 239 updated();
236} 240}
237 241
238 242
239QDateTime IncidenceBase::dtStart() const 243QDateTime IncidenceBase::dtStart() const
240{ 244{
241 return mDtStart; 245 return mDtStart;
242} 246}
243 247
244QString IncidenceBase::dtStartTimeStr() const 248QString IncidenceBase::dtStartTimeStr() const
245{ 249{
246 return KGlobal::locale()->formatTime(dtStart().time()); 250 return KGlobal::locale()->formatTime(dtStart().time());
247} 251}
248 252
249QString IncidenceBase::dtStartDateStr(bool shortfmt) const 253QString IncidenceBase::dtStartDateStr(bool shortfmt) const
250{ 254{
251 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); 255 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);
252} 256}
253 257
254QString IncidenceBase::dtStartStr(bool shortfmt) const 258QString IncidenceBase::dtStartStr(bool shortfmt) const
255{ 259{
256 if ( doesFloat() ) 260 if ( doesFloat() )
257 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); 261 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);
258 return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); 262 return KGlobal::locale()->formatDateTime(dtStart(), shortfmt);
259} 263}
260 264
261 265
262bool IncidenceBase::doesFloat() const 266bool IncidenceBase::doesFloat() const
263{ 267{
264 return mFloats; 268 return mFloats;
265} 269}
266 270
267void IncidenceBase::setFloats(bool f) 271void IncidenceBase::setFloats(bool f)
268{ 272{
269 if (mReadOnly) return; 273 if (mReadOnly) return;
270 mFloats = f; 274 mFloats = f;
271 updated(); 275 updated();
272} 276}
273 277
274 278
275bool IncidenceBase::addAttendee(Attendee *a, bool doupdate) 279bool IncidenceBase::addAttendee(Attendee *a, bool doupdate)
276{ 280{
277 if (mReadOnly) return false; 281 if (mReadOnly) return false;
278 if (a->name().left(7).upper() == "MAILTO:") 282 if (a->name().left(7).upper() == "MAILTO:")
279 a->setName(a->name().remove(0,7)); 283 a->setName(a->name().remove(0,7));
280 284
281 QPtrListIterator<Attendee> qli(mAttendees); 285 QPtrListIterator<Attendee> qli(mAttendees);
282 286
283 qli.toFirst(); 287 qli.toFirst();
284 while (qli) { 288 while (qli) {
285 if (*qli.current() == *a) 289 if (*qli.current() == *a)
286 return false; 290 return false;
287 ++qli; 291 ++qli;
288 } 292 }
289 mAttendees.append(a); 293 mAttendees.append(a);
290 if (doupdate) updated(); 294 if (doupdate) updated();
291 return true; 295 return true;
292} 296}
293 297
294#if 0 298#if 0
295void IncidenceBase::removeAttendee(Attendee *a) 299void IncidenceBase::removeAttendee(Attendee *a)
296{ 300{
297 if (mReadOnly) return; 301 if (mReadOnly) return;
298 mAttendees.removeRef(a); 302 mAttendees.removeRef(a);
299 updated(); 303 updated();
300} 304}
301 305
302void IncidenceBase::removeAttendee(const char *n) 306void IncidenceBase::removeAttendee(const char *n)
303{ 307{
304 Attendee *a; 308 Attendee *a;
305 309
306 if (mReadOnly) return; 310 if (mReadOnly) return;
307 for (a = mAttendees.first(); a; a = mAttendees.next()) 311 for (a = mAttendees.first(); a; a = mAttendees.next())
308 if (a->getName() == n) { 312 if (a->getName() == n) {
309 mAttendees.remove(); 313 mAttendees.remove();
310 break; 314 break;
311 } 315 }
312} 316}
313#endif 317#endif
314 318
315void IncidenceBase::clearAttendees() 319void IncidenceBase::clearAttendees()
316{ 320{
317 if (mReadOnly) return; 321 if (mReadOnly) return;
318 mAttendees.clear(); 322 mAttendees.clear();
319} 323}
320 324
321#if 0 325#if 0
322Attendee *IncidenceBase::getAttendee(const char *n) const 326Attendee *IncidenceBase::getAttendee(const char *n) const
323{ 327{
324 QPtrListIterator<Attendee> qli(mAttendees); 328 QPtrListIterator<Attendee> qli(mAttendees);
325 329
326 qli.toFirst(); 330 qli.toFirst();
327 while (qli) { 331 while (qli) {
328 if (qli.current()->getName() == n) 332 if (qli.current()->getName() == n)
329 return qli.current(); 333 return qli.current();
330 ++qli; 334 ++qli;
331 } 335 }
332 return 0L; 336 return 0L;
333} 337}
334#endif 338#endif
335 339
336Attendee *IncidenceBase::attendeeByMail(const QString &email) 340Attendee *IncidenceBase::attendeeByMail(const QString &email)
337{ 341{
338 QPtrListIterator<Attendee> qli(mAttendees); 342 QPtrListIterator<Attendee> qli(mAttendees);
339 343
340 qli.toFirst(); 344 qli.toFirst();
341 while (qli) { 345 while (qli) {
342 if (qli.current()->email().lower() == email.lower()) 346 if (qli.current()->email().lower() == email.lower())
343 return qli.current(); 347 return qli.current();
344 ++qli; 348 ++qli;
345 } 349 }
346 return 0L; 350 return 0L;
347} 351}
348 352
349Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) 353Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email)
350{ 354{
351 QPtrListIterator<Attendee> qli(mAttendees); 355 QPtrListIterator<Attendee> qli(mAttendees);
352 356
353 QStringList mails = emails; 357 QStringList mails = emails;
354 if (!email.isEmpty()) { 358 if (!email.isEmpty()) {
355 mails.append(email); 359 mails.append(email);
356 } 360 }
357 qli.toFirst(); 361 qli.toFirst();
358 while (qli) { 362 while (qli) {
359 for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { 363 for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) {
360 if (qli.current()->email().lower() == (*it).lower()) 364 if (qli.current()->email().lower() == (*it).lower())
361 return qli.current(); 365 return qli.current();
362 } 366 }
363 367
364 ++qli; 368 ++qli;
365 } 369 }
366 return 0L; 370 return 0L;
367} 371}
368 372
369void IncidenceBase::setDuration(int seconds) 373void IncidenceBase::setDuration(int seconds)
370{ 374{
371 mDuration = seconds; 375 mDuration = seconds;
372 setHasDuration(true); 376 setHasDuration(true);
373} 377}
374 378
375int IncidenceBase::duration() const 379int IncidenceBase::duration() const
376{ 380{
377 return mDuration; 381 return mDuration;
378} 382}
379 383
380void IncidenceBase::setHasDuration(bool b) 384void IncidenceBase::setHasDuration(bool b)
381{ 385{
382 mHasDuration = b; 386 mHasDuration = b;
383} 387}
384 388
385bool IncidenceBase::hasDuration() const 389bool IncidenceBase::hasDuration() const
386{ 390{
387 return mHasDuration; 391 return mHasDuration;
388} 392}
389 393
390void IncidenceBase::setSyncStatus(int stat) 394void IncidenceBase::setSyncStatus(int stat)
391{ 395{
392 if (mReadOnly) return; 396 if (mReadOnly) return;
393 mSyncStatus = stat; 397 mSyncStatus = stat;
394} 398}
395 399
396int IncidenceBase::syncStatus() const 400int IncidenceBase::syncStatus() const
397{ 401{
398 return mSyncStatus; 402 return mSyncStatus;
399} 403}
400 404
401void IncidenceBase::setPilotId( int id ) 405void IncidenceBase::setPilotId( int id )
402{ 406{
403 if (mReadOnly) return; 407 if (mReadOnly) return;
404 mPilotId = id; 408 mPilotId = id;
405} 409}
406 410
407int IncidenceBase::pilotId() const 411int IncidenceBase::pilotId() const
408{ 412{
409 return mPilotId; 413 return mPilotId;
410} 414}
411 415
412int IncidenceBase::tempSyncStat() const 416int IncidenceBase::tempSyncStat() const
413{ 417{
414 return mTempSyncStat; 418 return mTempSyncStat;
415} 419}
416void IncidenceBase::setTempSyncStat( int id ) 420void IncidenceBase::setTempSyncStat( int id )
417{ 421{
418 if (mReadOnly) return; 422 if (mReadOnly) return;
419 mTempSyncStat = id; 423 mTempSyncStat = id;
420} 424}
421 425
422void IncidenceBase::removeID(const QString &prof) 426void IncidenceBase::removeID(const QString &prof)
423{ 427{
424 if ( prof.isEmpty() ) 428 if ( prof.isEmpty() )
425 mExternalId = ":"; 429 mExternalId = ":";
426 else 430 else
427 mExternalId = KIdManager::removeId ( mExternalId, prof); 431 mExternalId = KIdManager::removeId ( mExternalId, prof);
428 432
429} 433}
430void IncidenceBase::setID( const QString & prof , const QString & id ) 434void IncidenceBase::setID( const QString & prof , const QString & id )
431{ 435{
432 mExternalId = KIdManager::setId ( mExternalId, prof, id ); 436 mExternalId = KIdManager::setId ( mExternalId, prof, id );
433} 437}
434QString IncidenceBase::getID( const QString & prof) 438QString IncidenceBase::getID( const QString & prof)
435{ 439{
436 return KIdManager::getId ( mExternalId, prof ); 440 return KIdManager::getId ( mExternalId, prof );
437} 441}
438 442
439// example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: 443// example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0:
440// format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 444// format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0
441void IncidenceBase::setCsum( const QString & prof , const QString & id ) 445void IncidenceBase::setCsum( const QString & prof , const QString & id )
442{ 446{
443 mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); 447 mExternalId = KIdManager::setCsum ( mExternalId, prof, id );
444} 448}
445QString IncidenceBase::getCsum( const QString & prof) 449QString IncidenceBase::getCsum( const QString & prof)
446{ 450{
447 return KIdManager::getCsum ( mExternalId, prof ); 451 return KIdManager::getCsum ( mExternalId, prof );
448} 452}
449 453
450void IncidenceBase::setIDStr( const QString & s ) 454void IncidenceBase::setIDStr( const QString & s )
451{ 455{
452 if (mReadOnly) return; 456 if (mReadOnly) return;
453 mExternalId = s; 457 mExternalId = s;
454} 458}
455 459
456QString IncidenceBase::IDStr() const 460QString IncidenceBase::IDStr() const
457{ 461{
458 return mExternalId ; 462 return mExternalId ;
459} 463}
460void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) 464void IncidenceBase::registerObserver( IncidenceBase::Observer *observer )
461{ 465{
462 if( !mObservers.contains(observer) ) mObservers.append( observer ); 466 if( !mObservers.contains(observer) ) mObservers.append( observer );
463} 467}
464 468
465void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) 469void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer )
466{ 470{
467 mObservers.remove( observer ); 471 mObservers.remove( observer );
468} 472}
469 473
470void IncidenceBase::updated() 474void IncidenceBase::updated()
471{ 475{
472 QPtrListIterator<Observer> it(mObservers); 476 QPtrListIterator<Observer> it(mObservers);
473 while( it.current() ) { 477 while( it.current() ) {
474 Observer *o = it.current(); 478 Observer *o = it.current();
475 ++it; 479 ++it;
476 o->incidenceUpdated( this ); 480 o->incidenceUpdated( this );
477 } 481 }
478} 482}