本文整理汇总了C++中incidence::List::constEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ List::constEnd方法的具体用法?C++ List::constEnd怎么用?C++ List::constEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类incidence::List
的用法示例。
在下文中一共展示了List::constEnd方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyIncidences
bool DndFactory::copyIncidences( const Incidence::List &incidences )
{
QClipboard *clipboard = QApplication::clipboard();
Q_ASSERT( clipboard );
MemoryCalendar::Ptr calendar( new MemoryCalendar( d->mCalendar->timeSpec() ) );
Incidence::List::ConstIterator it;
for ( it = incidences.constBegin(); it != incidences.constEnd(); ++it ) {
if ( *it ) {
calendar->addIncidence( Incidence::Ptr( ( *it )->clone() ) );
}
}
QMimeData *mimeData = new QMimeData;
ICalDrag::populateMimeData( mimeData, calendar );
VCalDrag::populateMimeData( mimeData, calendar );
if ( calendar->incidences().isEmpty() ) {
return false;
} else {
clipboard->setMimeData( mimeData );
return true;
}
}
示例2: pasteIncidences
Incidence::List DndFactory::pasteIncidences( const QDate &newDate,
const QTime *newTime )
{
QClipboard *cb = QApplication::clipboard();
Calendar *cal = createDropCalendar( cb->mimeData() );
Incidence::List list;
if ( !cal ) {
kDebug() << "Can't parse clipboard";
return list;
}
// All pasted incidences get new uids, must keep track of old uids,
// so we can update child's parents
QHash<QString,Incidence*> oldUidToNewInc;
Incidence::List::ConstIterator it;
const Incidence::List incs = cal->incidences();
for ( it = incs.constBegin();
it != incs.constEnd(); ++it ) {
Incidence *inc = d->pasteIncidence( *it, newDate, newTime );
if ( inc ) {
list.append( inc );
oldUidToNewInc[( *it )->uid()] = inc;
}
}
// update relations
for ( it = list.constBegin(); it != list.constEnd(); ++it ) {
Incidence *inc = *it;
if ( oldUidToNewInc.contains( inc->relatedToUid() ) ) {
Incidence *parentInc = oldUidToNewInc[inc->relatedToUid()];
inc->setRelatedToUid( parentInc->uid() );
inc->setRelatedTo( parentInc );
} else {
// not related to anything in the clipboard
inc->setRelatedToUid( QString() );
inc->setRelatedTo( 0 );
}
}
return list;
}
示例3: cutIncidences
bool DndFactory::cutIncidences( const Incidence::List &incidences )
{
if ( copyIncidences( incidences ) ) {
Incidence::List::ConstIterator it;
for ( it = incidences.constBegin(); it != incidences.constEnd(); ++it ) {
d->mCalendar->deleteIncidence( *it );
}
return true;
} else {
return false;
}
}
示例4: doFileLoad
bool ResourceLocalDir::doFileLoad(CalendarLocal &cal, const QString &fileName)
{
if(!cal.load(fileName))
return false;
Incidence::List incidences = cal.rawIncidences();
Incidence::List::ConstIterator it;
for(it = incidences.constBegin(); it != incidences.constEnd(); ++it)
{
Incidence *i = *it;
if(i) mCalendar.addIncidence(i->clone());
}
return true;
}
示例5: acceptReply
CallId Scheduler::acceptReply( const IncidenceBase::Ptr &incidence,
ScheduleMessage::Status status,
iTIPMethod method )
{
Q_UNUSED( status );
if ( incidence->type() == IncidenceBase::TypeFreeBusy ) {
return acceptFreeBusy( incidence, method );
}
const CallId callId = ++d->mLatestCallId;
ResultCode resultCode = ResultCodeIncidenceOrAttendeeNotFound;
QString errorMessage;
Event::Ptr ev = d->mCalendar->event( incidence->uid() );
Todo::Ptr to = d->mCalendar->todo( incidence->uid() );
// try harder to find the correct incidence
if ( !ev && !to ) {
const Incidence::List list = d->mCalendar->incidences();
for ( Incidence::List::ConstIterator it=list.constBegin(), end=list.constEnd();
it != end; ++it ) {
if ( (*it)->schedulingID() == incidence->uid() ) {
ev = ( *it ).dynamicCast<Event>();
to = ( *it ).dynamicCast<Todo>();
break;
}
}
}
if ( ev || to ) {
//get matching attendee in calendar
kDebug() << "match found!";
Attendee::List attendeesIn = incidence->attendees();
Attendee::List attendeesEv;
Attendee::List attendeesNew;
if ( ev ) {
attendeesEv = ev->attendees();
}
if ( to ) {
attendeesEv = to->attendees();
}
Attendee::List::ConstIterator inIt;
Attendee::List::ConstIterator evIt;
for ( inIt = attendeesIn.constBegin(); inIt != attendeesIn.constEnd(); ++inIt ) {
Attendee::Ptr attIn = *inIt;
bool found = false;
for ( evIt = attendeesEv.constBegin(); evIt != attendeesEv.constEnd(); ++evIt ) {
Attendee::Ptr attEv = *evIt;
if ( attIn->email().toLower() == attEv->email().toLower() ) {
//update attendee-info
kDebug() << "update attendee";
attEv->setStatus( attIn->status() );
attEv->setDelegate( attIn->delegate() );
attEv->setDelegator( attIn->delegator() );
resultCode = ResultCodeSuccess;
found = true;
}
}
if ( !found && attIn->status() != Attendee::Declined ) {
attendeesNew.append( attIn );
}
}
bool attendeeAdded = false;
for ( Attendee::List::ConstIterator it = attendeesNew.constBegin();
it != attendeesNew.constEnd(); ++it ) {
Attendee::Ptr attNew = *it;
QString msg =
i18nc( "@info", "%1 wants to attend %2 but was not invited.",
attNew->fullName(),
( ev ? ev->summary() : to->summary() ) );
if ( !attNew->delegator().isEmpty() ) {
msg = i18nc( "@info", "%1 wants to attend %2 on behalf of %3.",
attNew->fullName(),
( ev ? ev->summary() : to->summary() ), attNew->delegator() );
}
if ( KMessageBox::questionYesNo(
0, msg, i18nc( "@title", "Uninvited attendee" ),
KGuiItem( i18nc( "@option", "Accept Attendance" ) ),
KGuiItem( i18nc( "@option", "Reject Attendance" ) ) ) != KMessageBox::Yes ) {
Incidence::Ptr cancel = incidence.dynamicCast<Incidence>();
if ( cancel ) {
cancel->addComment(
i18nc( "@info",
"The organizer rejected your attendance at this meeting." ) );
}
performTransaction( incidence, iTIPCancel, attNew->fullName() );
// ### can't delete cancel here because it is aliased to incidence which
// is accessed in the next loop iteration (CID 4232)
// delete cancel;
continue;
}
Attendee::Ptr a( new Attendee( attNew->name(), attNew->email(), attNew->RSVP(),
attNew->status(), attNew->role(), attNew->uid() ) );
a->setDelegate( attNew->delegate() );
a->setDelegator( attNew->delegator() );
if ( ev ) {
ev->addAttendee( a );
//.........这里部分代码省略.........
示例6: createTodoList
void HtmlExport::createTodoList(QTextStream *ts)
{
Todo::List rawTodoList = d->mCalendar->todos();
int index = 0;
while (index < rawTodoList.count()) {
Todo::Ptr ev = rawTodoList[ index ];
Todo::Ptr subev = ev;
const QString uid = ev->relatedTo();
if (!uid.isEmpty()) {
Incidence::Ptr inc = d->mCalendar->incidence(uid);
if (inc && inc->type() == Incidence::TypeTodo) {
Todo::Ptr todo = inc.staticCast<Todo>();
if (!rawTodoList.contains(todo)) {
rawTodoList.append(todo);
}
}
}
index = rawTodoList.indexOf(subev);
++index;
}
// FIXME: Sort list by priorities. This is brute force and should be
// replaced by a real sorting algorithm.
Todo::List todoList;
Todo::List::ConstIterator it;
for (int i = 1; i <= 9; ++i) {
for (it = rawTodoList.constBegin(); it != rawTodoList.constEnd(); ++it) {
if ((*it)->priority() == i && checkSecrecy(*it)) {
todoList.append(*it);
}
}
}
for (it = rawTodoList.constBegin(); it != rawTodoList.constEnd(); ++it) {
if ((*it)->priority() == 0 && checkSecrecy(*it)) {
todoList.append(*it);
}
}
int columns = 3;
*ts << "<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">" << endl;
*ts << " <tr>" << endl;
*ts << " <th class=\"sum\">" << i18nc("@title:column", "To-do") << "</th>" << endl;
*ts << " <th>" << i18nc("@title:column to-do priority", "Priority") << "</th>" << endl;
*ts << " <th>" << i18nc("@title:column to-do percent completed",
"Completed") << "</th>" << endl;
if (d->mSettings->taskDueDate()) {
*ts << " <th>" << i18nc("@title:column to-do due date", "Due Date") << "</th>" << endl;
++columns;
}
if (d->mSettings->taskLocation()) {
*ts << " <th>" << i18nc("@title:column to-do location", "Location") << "</th>" << endl;
++columns;
}
if (d->mSettings->taskCategories()) {
*ts << " <th>" << i18nc("@title:column to-do categories", "Categories") << "</th>" << endl;
++columns;
}
if (d->mSettings->taskAttendees()) {
*ts << " <th>" << i18nc("@title:column to-do attendees", "Attendees") << "</th>" << endl;
++columns;
}
*ts << " </tr>" << endl;
// Create top-level list.
for (it = todoList.constBegin(); it != todoList.constEnd(); ++it) {
if ((*it)->relatedTo().isEmpty()) {
createTodo(ts, *it);
}
}
// Create sub-level lists
for (it = todoList.constBegin(); it != todoList.constEnd(); ++it) {
Incidence::List relations = d->mCalendar->relations((*it)->uid());
if (relations.count()) {
// Generate sub-to-do list
*ts << " <tr>" << endl;
*ts << " <td class=\"subhead\" colspan=";
*ts << "\"" << QString::number(columns) << "\"";
*ts << "><a name=\"sub" << (*it)->uid() << "\"></a>"
<< i18nc("@title:column sub-to-dos of the parent to-do",
"Sub-To-dos of: ") << "<a href=\"#"
<< (*it)->uid() << "\"><b>" << cleanChars((*it)->summary())
<< "</b></a></td>" << endl;
*ts << " </tr>" << endl;
Todo::List sortedList;
// FIXME: Sort list by priorities. This is brute force and should be
// replaced by a real sorting algorithm.
for (int i = 1; i <= 9; ++i) {
Incidence::List::ConstIterator it2;
for (it2 = relations.constBegin(); it2 != relations.constEnd(); ++it2) {
Todo::Ptr ev3 = (*it2).staticCast<Todo>();
if (ev3 && ev3->priority() == i) {
sortedList.append(ev3);
}
}
}
Incidence::List::ConstIterator it2;
//.........这里部分代码省略.........