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