本文整理汇总了C++中incidence::Ptr::attendees方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::attendees方法的具体用法?C++ Ptr::attendees怎么用?C++ Ptr::attendees使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类incidence::Ptr
的用法示例。
在下文中一共展示了Ptr::attendees方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: formatAttendees
void HtmlExport::formatAttendees(QTextStream *ts,
const Incidence::Ptr &incidence)
{
Attendee::List attendees = incidence->attendees();
if (attendees.count()) {
*ts << "<em>";
*ts << incidence->organizer()->fullName();
*ts << "</em><br />";
Attendee::List::ConstIterator it;
for (it = attendees.constBegin(); it != attendees.constEnd(); ++it) {
Attendee::Ptr a(*it);
if (!a->email().isEmpty()) {
*ts << "<a href=\"mailto:" << a->email();
*ts << "\">" << cleanChars(a->name()) << "</a>";
} else {
*ts << " " << cleanChars(a->name());
}
*ts << "<br />" << endl;
}
} else {
*ts << " " << endl;
}
}
示例2: acceptCancel
CallId Scheduler::acceptCancel( const IncidenceBase::Ptr &incidence,
ScheduleMessage::Status status,
const QString &attendee )
{
Incidence::Ptr inc = incidence.staticCast<Incidence>();
if ( !inc ) {
return -1;
}
const CallId callId = ++d->mLatestCallId;
ResultCode resultCode = ResultCodeSuccess;
QString errorMessage;
if ( inc->type() == IncidenceBase::TypeFreeBusy ) {
// reply to this request is handled in korganizer's incomingdialog
emitOperationFinished( callId, resultCode, errorMessage );
return callId;
}
const Incidence::List existingIncidences = d->mCalendar->incidencesFromSchedulingID( inc->uid() );
kDebug() << "Scheduler::acceptCancel="
<< Stringify::scheduleMessageStatus( status ) //krazy2:exclude=kdebug
<< ": found " << existingIncidences.count()
<< " incidences with schedulingID " << inc->schedulingID();
Incidence::List::ConstIterator incit = existingIncidences.begin();
for ( ; incit != existingIncidences.end() ; ++incit ) {
Incidence::Ptr i = *incit;
kDebug() << "Considering this found event ("
<< ( i->isReadOnly() ? "readonly" : "readwrite" )
<< ") :" << d->mFormat->toString( i );
// If it's readonly, we can't possible remove it.
if ( i->isReadOnly() ) {
continue;
}
// Code for new invitations:
// We cannot check the value of "status" to be RequestNew because
// "status" comes from a similar check inside libical, where the event
// is compared to other events in the calendar. But if we have another
// version of the event around (e.g. shared folder for a group), the
// status could be RequestNew, Obsolete or Updated.
kDebug() << "looking in " << i->uid() << "'s attendees";
// This is supposed to be a new request, not an update - however we want
// to update the existing one to handle the "clicking more than once
// on the invitation" case. So check the attendee status of the attendee.
bool isMine = true;
const Attendee::List attendees = i->attendees();
Attendee::List::ConstIterator ait;
for ( ait = attendees.begin(); ait != attendees.end(); ++ait ) {
if ( (*ait)->email() == attendee &&
(*ait)->status() == Attendee::NeedsAction ) {
// This incidence wasn't created by me - it's probably in a shared
// folder and meant for someone else, ignore it.
kDebug() << "ignoring " << i->uid()
<< " since I'm still NeedsAction there";
isMine = false;
break;
}
}
if ( isMine ) {
//TODO_SERGIO: use ItemDeleteJob and make this async.
kDebug() << "removing existing incidence " << i->uid();
Akonadi::Item item = d->mCalendar->itemForIncidenceUid( i->uid() );
bool emitResult = true;
if ( item.isValid() ) {
const int changeId = d->mChanger->deleteIncidence( item );
if ( changeId >= 0 ) {
d->mCallIdByChangeId.insert( changeId, callId );
d->mDeletedIncidenceByChangeId.insert( changeId, i );
emitResult = false; // will be emitted in the job result's slot.
} else {
resultCode = ResultCodeErrorDeletingIncidence;
errorMessage = QLatin1String( "Error while trying to delete the incidence" );
}
} else {
resultCode = ResultCodeIncidenceNotFound;
errorMessage = QLatin1String( "Couldn't find incidence in calendar" );
}
if ( emitResult ) {
deleteTransaction( incidence->uid() );
errorMessage = QLatin1String( "Error deleting incidence" );
emitOperationFinished( callId, resultCode, errorMessage );
}
return callId;
}
}
// in case we didn't find the to-be-removed incidence
if ( existingIncidences.count() > 0 && inc->revision() > 0 ) {
KMessageBox::error(
0,
i18nc( "@info",
//.........这里部分代码省略.........
示例3: acceptRequest
CallId Scheduler::acceptRequest( const IncidenceBase::Ptr &incidence,
ScheduleMessage::Status status,
const QString &email )
{
Incidence::Ptr inc = incidence.staticCast<Incidence>() ;
if ( !inc ) {
kWarning() << "Accept what?";
return -1;
}
const CallId callId = ++d->mLatestCallId;
ResultCode resultCode = ResultCodeSuccess;
QString errorMessage;
if ( inc->type() == IncidenceBase::TypeFreeBusy ) {
emitOperationFinished( callId, ResultCodeSuccess, QString() );
// reply to this request is handled in korganizer's incomingdialog
return callId;
}
const Incidence::List existingIncidences = d->mCalendar->incidencesFromSchedulingID( inc->uid() );
kDebug() << "status=" << Stringify::scheduleMessageStatus( status ) //krazy:exclude=kdebug
<< ": found " << existingIncidences.count()
<< " incidences with schedulingID " << inc->schedulingID()
<< "; uid was = " << inc->uid();
if ( existingIncidences.isEmpty() ) {
// Perfectly normal if the incidence doesn't exist. This is probably
// a new invitation.
kDebug() << "incidence not found; calendar = " << d->mCalendar.data()
<< "; incidence count = " << d->mCalendar->incidences().count();
}
Incidence::List::ConstIterator incit = existingIncidences.begin();
for ( ; incit != existingIncidences.end() ; ++incit ) {
Incidence::Ptr existingIncidence = *incit;
kDebug() << "Considering this found event ("
<< ( existingIncidence->isReadOnly() ? "readonly" : "readwrite" )
<< ") :" << d->mFormat->toString( existingIncidence );
// If it's readonly, we can't possible update it.
if ( existingIncidence->isReadOnly() ) {
continue;
}
if ( existingIncidence->revision() <= inc->revision() ) {
// The new incidence might be an update for the found one
bool isUpdate = true;
// Code for new invitations:
// If you think we could check the value of "status" to be RequestNew: we can't.
// It comes from a similar check inside libical, where the event is compared to
// other events in the calendar. But if we have another version of the event around
// (e.g. shared folder for a group), the status could be RequestNew, Obsolete or Updated.
kDebug() << "looking in " << existingIncidence->uid() << "'s attendees";
// This is supposed to be a new request, not an update - however we want to update
// the existing one to handle the "clicking more than once on the invitation" case.
// So check the attendee status of the attendee.
const Attendee::List attendees = existingIncidence->attendees();
Attendee::List::ConstIterator ait;
for ( ait = attendees.begin(); ait != attendees.end(); ++ait ) {
if( (*ait)->email() == email && (*ait)->status() == Attendee::NeedsAction ) {
// This incidence wasn't created by me - it's probably in a shared folder
// and meant for someone else, ignore it.
kDebug() << "ignoring "
<< existingIncidence->uid() << " since I'm still NeedsAction there";
isUpdate = false;
break;
}
}
if ( isUpdate ) {
if ( existingIncidence->revision() == inc->revision() &&
existingIncidence->lastModified() > inc->lastModified() ) {
// This isn't an update - the found incidence was modified more recently
deleteTransaction( existingIncidence->uid() );
errorMessage = QLatin1String( "This isn't an update - "
"the found incidence was modified more recently" );
kDebug() << errorMessage;
emitOperationFinished( callId, ResultCodeNotUpdate, errorMessage );
return callId;
}
kDebug() << "replacing existing incidence " << existingIncidence->uid();
bool emitResult = true;
const QString oldUid = existingIncidence->uid();
if ( existingIncidence->type() != inc->type() ) {
errorMessage = QLatin1String( "Cannot assign two different incidence types" );
resultCode = ResultCodeDifferentIncidenceTypes;
} else {
IncidenceBase *existingIncidenceBase = existingIncidence.data();
IncidenceBase *incBase = inc.data();
*existingIncidenceBase = *incBase;
existingIncidence->setSchedulingID( inc->uid(), oldUid );
Akonadi::Item item = d->mCalendar->itemForIncidenceUid( oldUid );
item.setPayload<Incidence::Ptr>( existingIncidence );
if ( item.isValid() ) {
const int changeId = d->mChanger->modifyIncidence( item );
if ( changeId >= 0 ) {
d->mCallIdByChangeId.insert( changeId, callId );
emitResult = false; // will be emitted in the job result's slot.
} else {
//.........这里部分代码省略.........