Changeset View
Changeset View
Standalone View
Standalone View
calendaring/event.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | foreach (const Kolab::ContactReference &ref, list) { | ||||
} | } | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
void Event::delegate(const std::vector< Attendee >& delegators, const std::vector< Attendee >& delegatees) | void Event::delegate(const std::vector< Attendee >& delegators, const std::vector< Attendee >& delegatees) | ||||
{ | { | ||||
//First build a list of attendee references, and insert any missing attendees | //First insert any missing attendees | ||||
std::vector<Kolab::Attendee*> delegateesRef; | |||||
foreach(const Attendee &a, delegatees) { | foreach(const Attendee &a, delegatees) { | ||||
if (Attendee *attendee = getAttendee(a.contact())) { | if (!getAttendee(a.contact())) { | ||||
delegateesRef.push_back(attendee); | |||||
} else { | |||||
d->attendees.push_back(a); | d->attendees.push_back(a); | ||||
delegateesRef.push_back(&d->attendees.back()); | |||||
} | } | ||||
} | } | ||||
//Build a list of attendee references | |||||
//These are pointers into d->attendees, so we MUST NOT modify that vector after this point! | |||||
std::vector<Kolab::Attendee*> delegateesRef; | |||||
foreach(const Attendee &a, delegatees) { | |||||
Attendee *attendee = getAttendee(a.contact()); | |||||
Q_ASSERT(attendee); | |||||
delegateesRef.push_back(attendee); | |||||
} | |||||
std::vector<Kolab::Attendee*> delegatorsRef; | std::vector<Kolab::Attendee*> delegatorsRef; | ||||
foreach(const Attendee& a, delegators) { | foreach(const Attendee& a, delegators) { | ||||
if (Attendee *attendee = getAttendee(a.contact())) { | if (Attendee *attendee = getAttendee(a.contact())) { | ||||
delegatorsRef.push_back(attendee); | delegatorsRef.push_back(attendee); | ||||
} else { | } else { | ||||
std::cout << "missing delegator"; | std::cout << "missing delegator"; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |