author | zautrix <zautrix> | 2005-06-14 08:23:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-14 08:23:19 (UTC) |
commit | 1dccb9dd9ea32989ecec33c72a3ebd873dce048e (patch) (unidiff) | |
tree | 6b7dd7e4696c91a3afaba89225dd4f31f376a30b /libkcal/incidence.cpp | |
parent | b3743f5abe0a95c9ffeadf6701c9943f604febd6 (diff) | |
download | kdepimpi-1dccb9dd9ea32989ecec33c72a3ebd873dce048e.zip kdepimpi-1dccb9dd9ea32989ecec33c72a3ebd873dce048e.tar.gz kdepimpi-1dccb9dd9ea32989ecec33c72a3ebd873dce048e.tar.bz2 |
faster filter
-rw-r--r-- | libkcal/incidence.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 4382416..11f7ecc 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -207,384 +207,389 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | |||
207 | } | 207 | } |
208 | } else { | 208 | } else { |
209 | return false; | 209 | return false; |
210 | } | 210 | } |
211 | if (!( *i1.recurrence() == *i2.recurrence()) ) { | 211 | if (!( *i1.recurrence() == *i2.recurrence()) ) { |
212 | qDebug("recurrence is NOT equal "); | 212 | qDebug("recurrence is NOT equal "); |
213 | return false; | 213 | return false; |
214 | } | 214 | } |
215 | return | 215 | return |
216 | // i1.created() == i2.created() && | 216 | // i1.created() == i2.created() && |
217 | stringCompare( i1.description(), i2.description() ) && | 217 | stringCompare( i1.description(), i2.description() ) && |
218 | stringCompare( i1.summary(), i2.summary() ) && | 218 | stringCompare( i1.summary(), i2.summary() ) && |
219 | i1.categories() == i2.categories() && | 219 | i1.categories() == i2.categories() && |
220 | // no need to compare mRelatedTo | 220 | // no need to compare mRelatedTo |
221 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && | 221 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && |
222 | // i1.relations() == i2.relations() && | 222 | // i1.relations() == i2.relations() && |
223 | i1.exDates() == i2.exDates() && | 223 | i1.exDates() == i2.exDates() && |
224 | i1.attachments() == i2.attachments() && | 224 | i1.attachments() == i2.attachments() && |
225 | i1.resources() == i2.resources() && | 225 | i1.resources() == i2.resources() && |
226 | i1.secrecy() == i2.secrecy() && | 226 | i1.secrecy() == i2.secrecy() && |
227 | i1.priority() == i2.priority() && | 227 | i1.priority() == i2.priority() && |
228 | i1.cancelled() == i2.cancelled() && | 228 | i1.cancelled() == i2.cancelled() && |
229 | stringCompare( i1.location(), i2.location() ); | 229 | stringCompare( i1.location(), i2.location() ); |
230 | } | 230 | } |
231 | 231 | ||
232 | Incidence* Incidence::recreateCloneException( QDate d ) | 232 | Incidence* Incidence::recreateCloneException( QDate d ) |
233 | { | 233 | { |
234 | Incidence* newInc = clone(); | 234 | Incidence* newInc = clone(); |
235 | newInc->recreate(); | 235 | newInc->recreate(); |
236 | if ( doesRecur() ) { | 236 | if ( doesRecur() ) { |
237 | addExDate( d ); | 237 | addExDate( d ); |
238 | newInc->recurrence()->unsetRecurs(); | 238 | newInc->recurrence()->unsetRecurs(); |
239 | if ( typeID() == eventID ) { | 239 | if ( typeID() == eventID ) { |
240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
241 | QTime tim = dtStart().time(); | 241 | QTime tim = dtStart().time(); |
242 | newInc->setDtStart( QDateTime(d, tim) ); | 242 | newInc->setDtStart( QDateTime(d, tim) ); |
243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
244 | } else { | 244 | } else { |
245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); | 245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); |
246 | QTime tim = ((Todo*)this)->dtDue().time(); | 246 | QTime tim = ((Todo*)this)->dtDue().time(); |
247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); | 247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); |
248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); | 248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); |
249 | ((Todo*)this)->setRecurDates(); | 249 | ((Todo*)this)->setRecurDates(); |
250 | } | 250 | } |
251 | newInc->setExDates( DateList () ); | 251 | newInc->setExDates( DateList () ); |
252 | } | 252 | } |
253 | return newInc; | 253 | return newInc; |
254 | } | 254 | } |
255 | 255 | ||
256 | void Incidence::recreate() | 256 | void Incidence::recreate() |
257 | { | 257 | { |
258 | setCreated(QDateTime::currentDateTime()); | 258 | setCreated(QDateTime::currentDateTime()); |
259 | 259 | ||
260 | setUid(CalFormat::createUniqueId()); | 260 | setUid(CalFormat::createUniqueId()); |
261 | 261 | ||
262 | setRevision(0); | 262 | setRevision(0); |
263 | setIDStr( ":" ); | 263 | setIDStr( ":" ); |
264 | setLastModified(QDateTime::currentDateTime()); | 264 | setLastModified(QDateTime::currentDateTime()); |
265 | } | 265 | } |
266 | void Incidence::cloneRelations( Incidence * newInc ) | 266 | void Incidence::cloneRelations( Incidence * newInc ) |
267 | { | 267 | { |
268 | // newInc is already a clone of this incidence | 268 | // newInc is already a clone of this incidence |
269 | Incidence * inc; | 269 | Incidence * inc; |
270 | Incidence * cloneInc; | 270 | Incidence * cloneInc; |
271 | QPtrList<Incidence> Relations = relations(); | 271 | QPtrList<Incidence> Relations = relations(); |
272 | for (inc=Relations.first();inc;inc=Relations.next()) { | 272 | for (inc=Relations.first();inc;inc=Relations.next()) { |
273 | cloneInc = inc->clone(); | 273 | cloneInc = inc->clone(); |
274 | cloneInc->recreate(); | 274 | cloneInc->recreate(); |
275 | cloneInc->setRelatedTo( newInc ); | 275 | cloneInc->setRelatedTo( newInc ); |
276 | inc->cloneRelations( cloneInc ); | 276 | inc->cloneRelations( cloneInc ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | void Incidence::setReadOnly( bool readOnly ) | 279 | void Incidence::setReadOnly( bool readOnly ) |
280 | { | 280 | { |
281 | IncidenceBase::setReadOnly( readOnly ); | 281 | IncidenceBase::setReadOnly( readOnly ); |
282 | recurrence()->setRecurReadOnly( readOnly); | 282 | recurrence()->setRecurReadOnly( readOnly); |
283 | } | 283 | } |
284 | 284 | ||
285 | void Incidence::setCreated(QDateTime created) | 285 | void Incidence::setCreated(QDateTime created) |
286 | { | 286 | { |
287 | if (mReadOnly) return; | 287 | if (mReadOnly) return; |
288 | mCreated = getEvenTime(created); | 288 | mCreated = getEvenTime(created); |
289 | } | 289 | } |
290 | 290 | ||
291 | QDateTime Incidence::created() const | 291 | QDateTime Incidence::created() const |
292 | { | 292 | { |
293 | return mCreated; | 293 | return mCreated; |
294 | } | 294 | } |
295 | 295 | ||
296 | void Incidence::setRevision(int rev) | 296 | void Incidence::setRevision(int rev) |
297 | { | 297 | { |
298 | if (mReadOnly) return; | 298 | if (mReadOnly) return; |
299 | mRevision = rev; | 299 | mRevision = rev; |
300 | 300 | ||
301 | updated(); | 301 | updated(); |
302 | } | 302 | } |
303 | 303 | ||
304 | int Incidence::revision() const | 304 | int Incidence::revision() const |
305 | { | 305 | { |
306 | return mRevision; | 306 | return mRevision; |
307 | } | 307 | } |
308 | 308 | ||
309 | void Incidence::setDtStart(const QDateTime &dtStart) | 309 | void Incidence::setDtStart(const QDateTime &dtStart) |
310 | { | 310 | { |
311 | 311 | ||
312 | QDateTime dt = getEvenTime(dtStart); | 312 | QDateTime dt = getEvenTime(dtStart); |
313 | recurrence()->setRecurStart( dt); | 313 | recurrence()->setRecurStart( dt); |
314 | IncidenceBase::setDtStart( dt ); | 314 | IncidenceBase::setDtStart( dt ); |
315 | } | 315 | } |
316 | 316 | ||
317 | void Incidence::setDescription(const QString &description) | 317 | void Incidence::setDescription(const QString &description) |
318 | { | 318 | { |
319 | if (mReadOnly) return; | 319 | if (mReadOnly) return; |
320 | mDescription = description; | 320 | mDescription = description; |
321 | updated(); | 321 | updated(); |
322 | } | 322 | } |
323 | 323 | ||
324 | QString Incidence::description() const | 324 | QString Incidence::description() const |
325 | { | 325 | { |
326 | return mDescription; | 326 | return mDescription; |
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | void Incidence::setSummary(const QString &summary) | 330 | void Incidence::setSummary(const QString &summary) |
331 | { | 331 | { |
332 | if (mReadOnly) return; | 332 | if (mReadOnly) return; |
333 | mSummary = summary; | 333 | mSummary = summary; |
334 | updated(); | 334 | updated(); |
335 | } | 335 | } |
336 | 336 | ||
337 | QString Incidence::summary() const | 337 | QString Incidence::summary() const |
338 | { | 338 | { |
339 | return mSummary; | 339 | return mSummary; |
340 | } | 340 | } |
341 | void Incidence::checkCategories() | 341 | void Incidence::checkCategories() |
342 | { | 342 | { |
343 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); | 343 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); |
344 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); | 344 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); |
345 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); | 345 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); |
346 | } | 346 | } |
347 | 347 | ||
348 | void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false | 348 | void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false |
349 | { | 349 | { |
350 | if (mReadOnly) return; | 350 | if (mReadOnly) return; |
351 | int i; | 351 | int i; |
352 | for( i = 0; i < categories.count(); ++i ) { | 352 | for( i = 0; i < categories.count(); ++i ) { |
353 | if ( !mCategories.contains (categories[i])) | 353 | if ( !mCategories.contains (categories[i])) |
354 | mCategories.append( categories[i] ); | 354 | mCategories.append( categories[i] ); |
355 | } | 355 | } |
356 | checkCategories(); | 356 | checkCategories(); |
357 | updated(); | 357 | updated(); |
358 | if ( addToRelations ) { | 358 | if ( addToRelations ) { |
359 | Incidence * inc; | 359 | Incidence * inc; |
360 | QPtrList<Incidence> Relations = relations(); | 360 | QPtrList<Incidence> Relations = relations(); |
361 | for (inc=Relations.first();inc;inc=Relations.next()) { | 361 | for (inc=Relations.first();inc;inc=Relations.next()) { |
362 | inc->addCategories( categories, true ); | 362 | inc->addCategories( categories, true ); |
363 | } | 363 | } |
364 | } | 364 | } |
365 | } | 365 | } |
366 | 366 | ||
367 | void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false | 367 | void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false |
368 | { | 368 | { |
369 | if (mReadOnly) return; | 369 | if (mReadOnly) return; |
370 | mCategories = categories; | 370 | mCategories = categories; |
371 | checkCategories(); | 371 | checkCategories(); |
372 | updated(); | 372 | updated(); |
373 | if ( setForRelations ) { | 373 | if ( setForRelations ) { |
374 | Incidence * inc; | 374 | Incidence * inc; |
375 | QPtrList<Incidence> Relations = relations(); | 375 | QPtrList<Incidence> Relations = relations(); |
376 | for (inc=Relations.first();inc;inc=Relations.next()) { | 376 | for (inc=Relations.first();inc;inc=Relations.next()) { |
377 | inc->setCategories( categories, true ); | 377 | inc->setCategories( categories, true ); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | } | 380 | } |
381 | 381 | ||
382 | // TODO: remove setCategories(QString) function | 382 | // TODO: remove setCategories(QString) function |
383 | void Incidence::setCategories(const QString &catStr) | 383 | void Incidence::setCategories(const QString &catStr) |
384 | { | 384 | { |
385 | if (mReadOnly) return; | 385 | if (mReadOnly) return; |
386 | mCategories.clear(); | 386 | mCategories.clear(); |
387 | 387 | ||
388 | if (catStr.isEmpty()) return; | 388 | if (catStr.isEmpty()) return; |
389 | 389 | ||
390 | mCategories = QStringList::split(",",catStr); | 390 | mCategories = QStringList::split(",",catStr); |
391 | 391 | ||
392 | QStringList::Iterator it; | 392 | QStringList::Iterator it; |
393 | for(it = mCategories.begin();it != mCategories.end(); ++it) { | 393 | for(it = mCategories.begin();it != mCategories.end(); ++it) { |
394 | *it = (*it).stripWhiteSpace(); | 394 | *it = (*it).stripWhiteSpace(); |
395 | } | 395 | } |
396 | checkCategories(); | 396 | checkCategories(); |
397 | updated(); | 397 | updated(); |
398 | } | 398 | } |
399 | // using this makes filtering 3 times faster | ||
400 | QStringList* Incidence::categoriesP() | ||
401 | { | ||
402 | return &mCategories; | ||
403 | } | ||
399 | 404 | ||
400 | QStringList Incidence::categories() const | 405 | QStringList Incidence::categories() const |
401 | { | 406 | { |
402 | return mCategories; | 407 | return mCategories; |
403 | } | 408 | } |
404 | 409 | ||
405 | QString Incidence::categoriesStr() | 410 | QString Incidence::categoriesStr() |
406 | { | 411 | { |
407 | return mCategories.join(","); | 412 | return mCategories.join(","); |
408 | } | 413 | } |
409 | QString Incidence::categoriesStrWithSpace() | 414 | QString Incidence::categoriesStrWithSpace() |
410 | { | 415 | { |
411 | return mCategories.join(", "); | 416 | return mCategories.join(", "); |
412 | } | 417 | } |
413 | 418 | ||
414 | void Incidence::setRelatedToUid(const QString &relatedToUid) | 419 | void Incidence::setRelatedToUid(const QString &relatedToUid) |
415 | { | 420 | { |
416 | if (mReadOnly) return; | 421 | if (mReadOnly) return; |
417 | mRelatedToUid = relatedToUid; | 422 | mRelatedToUid = relatedToUid; |
418 | } | 423 | } |
419 | 424 | ||
420 | QString Incidence::relatedToUid() const | 425 | QString Incidence::relatedToUid() const |
421 | { | 426 | { |
422 | return mRelatedToUid; | 427 | return mRelatedToUid; |
423 | } | 428 | } |
424 | 429 | ||
425 | void Incidence::setRelatedTo(Incidence *relatedTo) | 430 | void Incidence::setRelatedTo(Incidence *relatedTo) |
426 | { | 431 | { |
427 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); | 432 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); |
428 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); | 433 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); |
429 | if (mReadOnly || mRelatedTo == relatedTo) return; | 434 | if (mReadOnly || mRelatedTo == relatedTo) return; |
430 | if(mRelatedTo) { | 435 | if(mRelatedTo) { |
431 | // updated(); | 436 | // updated(); |
432 | mRelatedTo->removeRelation(this); | 437 | mRelatedTo->removeRelation(this); |
433 | } | 438 | } |
434 | mRelatedTo = relatedTo; | 439 | mRelatedTo = relatedTo; |
435 | if (mRelatedTo) { | 440 | if (mRelatedTo) { |
436 | mRelatedTo->addRelation(this); | 441 | mRelatedTo->addRelation(this); |
437 | mRelatedToUid = mRelatedTo->uid(); | 442 | mRelatedToUid = mRelatedTo->uid(); |
438 | } else { | 443 | } else { |
439 | mRelatedToUid = ""; | 444 | mRelatedToUid = ""; |
440 | } | 445 | } |
441 | } | 446 | } |
442 | 447 | ||
443 | Incidence *Incidence::relatedTo() const | 448 | Incidence *Incidence::relatedTo() const |
444 | { | 449 | { |
445 | return mRelatedTo; | 450 | return mRelatedTo; |
446 | } | 451 | } |
447 | 452 | ||
448 | QPtrList<Incidence> Incidence::relations() const | 453 | QPtrList<Incidence> Incidence::relations() const |
449 | { | 454 | { |
450 | return mRelations; | 455 | return mRelations; |
451 | } | 456 | } |
452 | 457 | ||
453 | void Incidence::addRelationsToList(QPtrList<Incidence> *rel) | 458 | void Incidence::addRelationsToList(QPtrList<Incidence> *rel) |
454 | { | 459 | { |
455 | Incidence* inc; | 460 | Incidence* inc; |
456 | QPtrList<Incidence> Relations = relations(); | 461 | QPtrList<Incidence> Relations = relations(); |
457 | for (inc=Relations.first();inc;inc=Relations.next()) { | 462 | for (inc=Relations.first();inc;inc=Relations.next()) { |
458 | inc->addRelationsToList( rel ); | 463 | inc->addRelationsToList( rel ); |
459 | } | 464 | } |
460 | if ( rel->findRef( this ) == -1 ) | 465 | if ( rel->findRef( this ) == -1 ) |
461 | rel->append( this ); | 466 | rel->append( this ); |
462 | } | 467 | } |
463 | 468 | ||
464 | void Incidence::addRelation(Incidence *event) | 469 | void Incidence::addRelation(Incidence *event) |
465 | { | 470 | { |
466 | if( mRelations.findRef( event ) == -1 ) { | 471 | if( mRelations.findRef( event ) == -1 ) { |
467 | mRelations.append(event); | 472 | mRelations.append(event); |
468 | //updated(); | 473 | //updated(); |
469 | } | 474 | } |
470 | } | 475 | } |
471 | 476 | ||
472 | void Incidence::removeRelation(Incidence *event) | 477 | void Incidence::removeRelation(Incidence *event) |
473 | { | 478 | { |
474 | 479 | ||
475 | mRelations.removeRef(event); | 480 | mRelations.removeRef(event); |
476 | 481 | ||
477 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); | 482 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); |
478 | } | 483 | } |
479 | 484 | ||
480 | bool Incidence::recursOn(const QDate &qd) const | 485 | bool Incidence::recursOn(const QDate &qd) const |
481 | { | 486 | { |
482 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; | 487 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; |
483 | else return false; | 488 | else return false; |
484 | } | 489 | } |
485 | 490 | ||
486 | void Incidence::setExDates(const DateList &exDates) | 491 | void Incidence::setExDates(const DateList &exDates) |
487 | { | 492 | { |
488 | if (mReadOnly) return; | 493 | if (mReadOnly) return; |
489 | mExDates = exDates; | 494 | mExDates = exDates; |
490 | 495 | ||
491 | recurrence()->setRecurExDatesCount(mExDates.count()); | 496 | recurrence()->setRecurExDatesCount(mExDates.count()); |
492 | 497 | ||
493 | updated(); | 498 | updated(); |
494 | } | 499 | } |
495 | 500 | ||
496 | void Incidence::addExDate(const QDate &date) | 501 | void Incidence::addExDate(const QDate &date) |
497 | { | 502 | { |
498 | if (mReadOnly) return; | 503 | if (mReadOnly) return; |
499 | mExDates.append(date); | 504 | mExDates.append(date); |
500 | 505 | ||
501 | recurrence()->setRecurExDatesCount(mExDates.count()); | 506 | recurrence()->setRecurExDatesCount(mExDates.count()); |
502 | 507 | ||
503 | updated(); | 508 | updated(); |
504 | } | 509 | } |
505 | 510 | ||
506 | DateList Incidence::exDates() const | 511 | DateList Incidence::exDates() const |
507 | { | 512 | { |
508 | return mExDates; | 513 | return mExDates; |
509 | } | 514 | } |
510 | 515 | ||
511 | bool Incidence::isException(const QDate &date) const | 516 | bool Incidence::isException(const QDate &date) const |
512 | { | 517 | { |
513 | DateList::ConstIterator it; | 518 | DateList::ConstIterator it; |
514 | for( it = mExDates.begin(); it != mExDates.end(); ++it ) { | 519 | for( it = mExDates.begin(); it != mExDates.end(); ++it ) { |
515 | if ( (*it) == date ) { | 520 | if ( (*it) == date ) { |
516 | return true; | 521 | return true; |
517 | } | 522 | } |
518 | } | 523 | } |
519 | 524 | ||
520 | return false; | 525 | return false; |
521 | } | 526 | } |
522 | 527 | ||
523 | void Incidence::addAttachment(Attachment *attachment) | 528 | void Incidence::addAttachment(Attachment *attachment) |
524 | { | 529 | { |
525 | if (mReadOnly || !attachment) return; | 530 | if (mReadOnly || !attachment) return; |
526 | mAttachments.append(attachment); | 531 | mAttachments.append(attachment); |
527 | updated(); | 532 | updated(); |
528 | } | 533 | } |
529 | 534 | ||
530 | void Incidence::deleteAttachment(Attachment *attachment) | 535 | void Incidence::deleteAttachment(Attachment *attachment) |
531 | { | 536 | { |
532 | mAttachments.removeRef(attachment); | 537 | mAttachments.removeRef(attachment); |
533 | } | 538 | } |
534 | 539 | ||
535 | void Incidence::deleteAttachments(const QString& mime) | 540 | void Incidence::deleteAttachments(const QString& mime) |
536 | { | 541 | { |
537 | Attachment *at = mAttachments.first(); | 542 | Attachment *at = mAttachments.first(); |
538 | while (at) { | 543 | while (at) { |
539 | if (at->mimeType() == mime) | 544 | if (at->mimeType() == mime) |
540 | mAttachments.remove(); | 545 | mAttachments.remove(); |
541 | else | 546 | else |
542 | at = mAttachments.next(); | 547 | at = mAttachments.next(); |
543 | } | 548 | } |
544 | } | 549 | } |
545 | 550 | ||
546 | QPtrList<Attachment> Incidence::attachments() const | 551 | QPtrList<Attachment> Incidence::attachments() const |
547 | { | 552 | { |
548 | return mAttachments; | 553 | return mAttachments; |
549 | } | 554 | } |
550 | 555 | ||
551 | QPtrList<Attachment> Incidence::attachments(const QString& mime) const | 556 | QPtrList<Attachment> Incidence::attachments(const QString& mime) const |
552 | { | 557 | { |
553 | QPtrList<Attachment> attachments; | 558 | QPtrList<Attachment> attachments; |
554 | QPtrListIterator<Attachment> it( mAttachments ); | 559 | QPtrListIterator<Attachment> it( mAttachments ); |
555 | Attachment *at; | 560 | Attachment *at; |
556 | while ( (at = it.current()) ) { | 561 | while ( (at = it.current()) ) { |
557 | if (at->mimeType() == mime) | 562 | if (at->mimeType() == mime) |
558 | attachments.append(at); | 563 | attachments.append(at); |
559 | ++it; | 564 | ++it; |
560 | } | 565 | } |
561 | 566 | ||
562 | return attachments; | 567 | return attachments; |
563 | } | 568 | } |
564 | 569 | ||
565 | void Incidence::setResources(const QStringList &resources) | 570 | void Incidence::setResources(const QStringList &resources) |
566 | { | 571 | { |
567 | if (mReadOnly) return; | 572 | if (mReadOnly) return; |
568 | mResources = resources; | 573 | mResources = resources; |
569 | updated(); | 574 | updated(); |
570 | } | 575 | } |
571 | 576 | ||
572 | QStringList Incidence::resources() const | 577 | QStringList Incidence::resources() const |
573 | { | 578 | { |
574 | return mResources; | 579 | return mResources; |
575 | } | 580 | } |
576 | 581 | ||
577 | 582 | ||
578 | void Incidence::setPriority(int priority) | 583 | void Incidence::setPriority(int priority) |
579 | { | 584 | { |
580 | if (mReadOnly) return; | 585 | if (mReadOnly) return; |
581 | mPriority = priority; | 586 | mPriority = priority; |
582 | updated(); | 587 | updated(); |
583 | } | 588 | } |
584 | 589 | ||
585 | int Incidence::priority() const | 590 | int Incidence::priority() const |
586 | { | 591 | { |
587 | return mPriority; | 592 | return mPriority; |
588 | } | 593 | } |
589 | 594 | ||
590 | void Incidence::setSecrecy(int sec) | 595 | void Incidence::setSecrecy(int sec) |