-rw-r--r-- | libkcal/incidencebase.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index b36dc1a..9aa517c 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -260,148 +260,151 @@ Attendee *IncidenceBase::getAttendee(const char *n) const | |||
260 | if (qli.current()->getName() == n) | 260 | if (qli.current()->getName() == n) |
261 | return qli.current(); | 261 | return qli.current(); |
262 | ++qli; | 262 | ++qli; |
263 | } | 263 | } |
264 | return 0L; | 264 | return 0L; |
265 | } | 265 | } |
266 | #endif | 266 | #endif |
267 | 267 | ||
268 | Attendee *IncidenceBase::attendeeByMail(const QString &email) | 268 | Attendee *IncidenceBase::attendeeByMail(const QString &email) |
269 | { | 269 | { |
270 | QPtrListIterator<Attendee> qli(mAttendees); | 270 | QPtrListIterator<Attendee> qli(mAttendees); |
271 | 271 | ||
272 | qli.toFirst(); | 272 | qli.toFirst(); |
273 | while (qli) { | 273 | while (qli) { |
274 | if (qli.current()->email().lower() == email.lower()) | 274 | if (qli.current()->email().lower() == email.lower()) |
275 | return qli.current(); | 275 | return qli.current(); |
276 | ++qli; | 276 | ++qli; |
277 | } | 277 | } |
278 | return 0L; | 278 | return 0L; |
279 | } | 279 | } |
280 | 280 | ||
281 | Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) | 281 | Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email) |
282 | { | 282 | { |
283 | QPtrListIterator<Attendee> qli(mAttendees); | 283 | QPtrListIterator<Attendee> qli(mAttendees); |
284 | 284 | ||
285 | QStringList mails = emails; | 285 | QStringList mails = emails; |
286 | if (!email.isEmpty()) { | 286 | if (!email.isEmpty()) { |
287 | mails.append(email); | 287 | mails.append(email); |
288 | } | 288 | } |
289 | qli.toFirst(); | 289 | qli.toFirst(); |
290 | while (qli) { | 290 | while (qli) { |
291 | for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { | 291 | for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { |
292 | if (qli.current()->email().lower() == (*it).lower()) | 292 | if (qli.current()->email().lower() == (*it).lower()) |
293 | return qli.current(); | 293 | return qli.current(); |
294 | } | 294 | } |
295 | 295 | ||
296 | ++qli; | 296 | ++qli; |
297 | } | 297 | } |
298 | return 0L; | 298 | return 0L; |
299 | } | 299 | } |
300 | 300 | ||
301 | void IncidenceBase::setDuration(int seconds) | 301 | void IncidenceBase::setDuration(int seconds) |
302 | { | 302 | { |
303 | mDuration = seconds; | 303 | mDuration = seconds; |
304 | setHasDuration(true); | 304 | setHasDuration(true); |
305 | } | 305 | } |
306 | 306 | ||
307 | int IncidenceBase::duration() const | 307 | int IncidenceBase::duration() const |
308 | { | 308 | { |
309 | return mDuration; | 309 | return mDuration; |
310 | } | 310 | } |
311 | 311 | ||
312 | void IncidenceBase::setHasDuration(bool b) | 312 | void IncidenceBase::setHasDuration(bool b) |
313 | { | 313 | { |
314 | mHasDuration = b; | 314 | mHasDuration = b; |
315 | } | 315 | } |
316 | 316 | ||
317 | bool IncidenceBase::hasDuration() const | 317 | bool IncidenceBase::hasDuration() const |
318 | { | 318 | { |
319 | return mHasDuration; | 319 | return mHasDuration; |
320 | } | 320 | } |
321 | 321 | ||
322 | void IncidenceBase::setSyncStatus(int stat) | 322 | void IncidenceBase::setSyncStatus(int stat) |
323 | { | 323 | { |
324 | if (mReadOnly) return; | 324 | if (mReadOnly) return; |
325 | mSyncStatus = stat; | 325 | mSyncStatus = stat; |
326 | } | 326 | } |
327 | 327 | ||
328 | int IncidenceBase::syncStatus() const | 328 | int IncidenceBase::syncStatus() const |
329 | { | 329 | { |
330 | return mSyncStatus; | 330 | return mSyncStatus; |
331 | } | 331 | } |
332 | 332 | ||
333 | void IncidenceBase::setPilotId( int id ) | 333 | void IncidenceBase::setPilotId( int id ) |
334 | { | 334 | { |
335 | if (mReadOnly) return; | 335 | if (mReadOnly) return; |
336 | mPilotId = id; | 336 | mPilotId = id; |
337 | } | 337 | } |
338 | 338 | ||
339 | int IncidenceBase::pilotId() const | 339 | int IncidenceBase::pilotId() const |
340 | { | 340 | { |
341 | return mPilotId; | 341 | return mPilotId; |
342 | } | 342 | } |
343 | 343 | ||
344 | int IncidenceBase::tempSyncStat() const | 344 | int IncidenceBase::tempSyncStat() const |
345 | { | 345 | { |
346 | return mTempSyncStat; | 346 | return mTempSyncStat; |
347 | } | 347 | } |
348 | void IncidenceBase::setTempSyncStat( int id ) | 348 | void IncidenceBase::setTempSyncStat( int id ) |
349 | { | 349 | { |
350 | if (mReadOnly) return; | 350 | if (mReadOnly) return; |
351 | mTempSyncStat = id; | 351 | mTempSyncStat = id; |
352 | } | 352 | } |
353 | 353 | ||
354 | void IncidenceBase::removeID(const QString &prof) | 354 | void IncidenceBase::removeID(const QString &prof) |
355 | { | 355 | { |
356 | mExternalId = KIdManager::removeId ( mExternalId, prof); | 356 | if ( prof.isEmpty() ) |
357 | mExternalId = ":"; | ||
358 | else | ||
359 | mExternalId = KIdManager::removeId ( mExternalId, prof); | ||
357 | 360 | ||
358 | } | 361 | } |
359 | void IncidenceBase::setID( const QString & prof , const QString & id ) | 362 | void IncidenceBase::setID( const QString & prof , const QString & id ) |
360 | { | 363 | { |
361 | mExternalId = KIdManager::setId ( mExternalId, prof, id ); | 364 | mExternalId = KIdManager::setId ( mExternalId, prof, id ); |
362 | } | 365 | } |
363 | QString IncidenceBase::getID( const QString & prof) | 366 | QString IncidenceBase::getID( const QString & prof) |
364 | { | 367 | { |
365 | return KIdManager::getId ( mExternalId, prof ); | 368 | return KIdManager::getId ( mExternalId, prof ); |
366 | } | 369 | } |
367 | 370 | ||
368 | // example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: | 371 | // example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: |
369 | // format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 | 372 | // format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 |
370 | void IncidenceBase::setCsum( const QString & prof , const QString & id ) | 373 | void IncidenceBase::setCsum( const QString & prof , const QString & id ) |
371 | { | 374 | { |
372 | mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); | 375 | mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); |
373 | } | 376 | } |
374 | QString IncidenceBase::getCsum( const QString & prof) | 377 | QString IncidenceBase::getCsum( const QString & prof) |
375 | { | 378 | { |
376 | return KIdManager::getCsum ( mExternalId, prof ); | 379 | return KIdManager::getCsum ( mExternalId, prof ); |
377 | } | 380 | } |
378 | 381 | ||
379 | void IncidenceBase::setIDStr( const QString & s ) | 382 | void IncidenceBase::setIDStr( const QString & s ) |
380 | { | 383 | { |
381 | if (mReadOnly) return; | 384 | if (mReadOnly) return; |
382 | mExternalId = s; | 385 | mExternalId = s; |
383 | } | 386 | } |
384 | 387 | ||
385 | QString IncidenceBase::IDStr() const | 388 | QString IncidenceBase::IDStr() const |
386 | { | 389 | { |
387 | return mExternalId ; | 390 | return mExternalId ; |
388 | } | 391 | } |
389 | void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) | 392 | void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) |
390 | { | 393 | { |
391 | if( !mObservers.contains(observer) ) mObservers.append( observer ); | 394 | if( !mObservers.contains(observer) ) mObservers.append( observer ); |
392 | } | 395 | } |
393 | 396 | ||
394 | void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) | 397 | void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) |
395 | { | 398 | { |
396 | mObservers.remove( observer ); | 399 | mObservers.remove( observer ); |
397 | } | 400 | } |
398 | 401 | ||
399 | void IncidenceBase::updated() | 402 | void IncidenceBase::updated() |
400 | { | 403 | { |
401 | QPtrListIterator<Observer> it(mObservers); | 404 | QPtrListIterator<Observer> it(mObservers); |
402 | while( it.current() ) { | 405 | while( it.current() ) { |
403 | Observer *o = it.current(); | 406 | Observer *o = it.current(); |
404 | ++it; | 407 | ++it; |
405 | o->incidenceUpdated( this ); | 408 | o->incidenceUpdated( this ); |
406 | } | 409 | } |
407 | } | 410 | } |