-rw-r--r-- | libkcal/incidencebase.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 9aa517c..7525a4a 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -192,56 +192,65 @@ QString IncidenceBase::dtStartTimeStr() const QString IncidenceBase::dtStartDateStr(bool shortfmt) const { return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); } QString IncidenceBase::dtStartStr(bool shortfmt) const { return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); } bool IncidenceBase::doesFloat() const { return mFloats; } void IncidenceBase::setFloats(bool f) { if (mReadOnly) return; mFloats = f; updated(); } -void IncidenceBase::addAttendee(Attendee *a, bool doupdate) +bool IncidenceBase::addAttendee(Attendee *a, bool doupdate) { - if (mReadOnly) return; + if (mReadOnly) return false; if (a->name().left(7).upper() == "MAILTO:") a->setName(a->name().remove(0,7)); + QPtrListIterator<Attendee> qli(mAttendees); + + qli.toFirst(); + while (qli) { + if (*qli.current() == *a) + return false; + ++qli; + } mAttendees.append(a); if (doupdate) updated(); + return true; } #if 0 void IncidenceBase::removeAttendee(Attendee *a) { if (mReadOnly) return; mAttendees.removeRef(a); updated(); } void IncidenceBase::removeAttendee(const char *n) { Attendee *a; if (mReadOnly) return; for (a = mAttendees.first(); a; a = mAttendees.next()) if (a->getName() == n) { mAttendees.remove(); break; } } #endif void IncidenceBase::clearAttendees() |