当前位置: 首页>>代码示例>>C++>>正文


C++ List::append方法代码示例

本文整理汇总了C++中incidence::List::append方法的典型用法代码示例。如果您正苦于以下问题:C++ List::append方法的具体用法?C++ List::append怎么用?C++ List::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在incidence::List的用法示例。


在下文中一共展示了List::append方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testPasteTodo

void DndFactoryTest::testPasteTodo()
{
  MemoryCalendar::Ptr calendar( new MemoryCalendar( QString() ) );

  DndFactory factory( calendar );

  Todo::Ptr todo( new Todo() );
  todo->setSummary( QLatin1String( "Summary 1" ) );
  todo->setDtDue( KDateTime( QDate( 2010, 8, 9 ) ) );

  Incidence::List incidencesToPaste;
  incidencesToPaste.append( todo );

  QVERIFY( factory.copyIncidences( incidencesToPaste ) );

  const KDateTime newDateTime( QDate( 2011, 1, 1 ), QTime( 10, 10 ) );

  Incidence::List pastedIncidences = factory.pasteIncidences( newDateTime );
  QVERIFY( pastedIncidences.size() == 1 );

  Incidence::Ptr incidence = pastedIncidences.first();

  QVERIFY( incidence->type() == Incidence::TypeTodo );

  // check if a new uid was generated.
  QVERIFY( incidence->uid() != todo->uid() );

  Todo::Ptr pastedTodo = incidence.staticCast<Todo>();

  QVERIFY( pastedTodo->dtDue() == newDateTime );
  QVERIFY( pastedTodo->summary() == todo->summary() );

}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:33,代码来源:testdndfactory.cpp

示例2: selectedIncidences

Incidence::List KOListView::selectedIncidences()
{
    Incidence::List eventList;

    QListViewItem *item = mListView->selectedItem();
    if(item) eventList.append(((KOListViewItem *)item)->data());

    return eventList;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:9,代码来源:kolistview.cpp

示例3: allChanges

Incidence::List ResourceCached::allChanges() const
{
    Incidence::List changes;
    QMap<Incidence *, bool>::ConstIterator it;
    for(it = mAddedIncidences.begin(); it != mAddedIncidences.end(); ++it)
    {
        changes.append(it.key());
    }
    for(it = mChangedIncidences.begin(); it != mChangedIncidences.end(); ++it)
    {
        changes.append(it.key());
    }
    for(it = mDeletedIncidences.begin(); it != mDeletedIncidences.end(); ++it)
    {
        changes.append(it.key());
    }
    return changes;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:18,代码来源:resourcecached.cpp

示例4: incidencesFromSchedulingID

Incidence::List Calendar::incidencesFromSchedulingID(const QString &UID)
{
    Incidence::List result;
    Incidence::List incidences = rawIncidences();
    Incidence::List::iterator it = incidences.begin();
    for(; it != incidences.end(); ++it)
        if((*it)->schedulingID() == UID)
            result.append(*it);
    return result;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:10,代码来源:calendar.cpp

示例5: deletedIncidences

Incidence::List ResourceCached::deletedIncidences() const
{
    Incidence::List deleted;
    QMap<Incidence *, bool>::ConstIterator it;
    for(it = mDeletedIncidences.begin(); it != mDeletedIncidences.end(); ++it)
    {
        deleted.append(it.key());
    }
    return deleted;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:10,代码来源:resourcecached.cpp

示例6: mergeIncidenceList

Incidence::List Calendar::mergeIncidenceList(const Event::List &events,
        const Todo::List &todos,
        const Journal::List &journals)
{
    Incidence::List incidences;

    Event::List::ConstIterator it1;
    for(it1 = events.begin(); it1 != events.end(); ++it1)
        incidences.append(*it1);

    Todo::List::ConstIterator it2;
    for(it2 = todos.begin(); it2 != todos.end(); ++it2)
        incidences.append(*it2);

    Journal::List::ConstIterator it3;
    for(it3 = journals.begin(); it3 != journals.end(); ++it3)
        incidences.append(*it3);

    return incidences;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:20,代码来源:calendar.cpp

示例7: calendar

void DndFactoryTest::testPasteAllDayEvent2()
{

  MemoryCalendar::Ptr calendar( new MemoryCalendar( QString() ) );

  DndFactory factory( calendar );

  Event::Ptr allDayEvent( new Event() );
  allDayEvent->setSummary( QLatin1String( "Summary 2" ) );
  allDayEvent->setDtStart( KDateTime( QDate( 2010, 8, 8 ) ) );
  allDayEvent->setDtEnd( KDateTime( QDate( 2010, 8, 9 ) ) );
  const QString originalUid = allDayEvent->uid();

  Incidence::List incidencesToPaste;
  incidencesToPaste.append( allDayEvent );

  QVERIFY( factory.copyIncidences( incidencesToPaste ) );

  const KDateTime newDateTime( QDate( 2011, 1, 1 ) );
  const uint originalLength = allDayEvent->dtStart().secsTo( allDayEvent->dtEnd() );

  // paste at the new time
  Incidence::List pastedIncidences = factory.pasteIncidences( newDateTime );

  // we only copied one incidence
  QVERIFY( pastedIncidences.size() == 1 );

  Incidence::Ptr incidence = pastedIncidences.first();

  QVERIFY( incidence->type() == Incidence::TypeEvent );

  // check if a new uid was generated.
  QVERIFY( incidence->uid() != originalUid );

  // the new dateTime didn't have time component
  QVERIFY( incidence->allDay() );

  Event::Ptr pastedEvent = incidence.staticCast<Event>();
  const uint newLength = pastedEvent->dtStart().secsTo( pastedEvent->dtEnd() );

  kDebug() << "originalLength was " << originalLength << "; and newLength is "
           << newLength << "; old dtStart was " << allDayEvent->dtStart()
           << " and old dtEnd was " << allDayEvent->dtEnd() << endl
           << "; new dtStart is " << pastedEvent->dtStart()
           << " and new dtEnd is " << pastedEvent->dtEnd();

  QVERIFY( originalLength == newLength );
  QVERIFY( pastedEvent->dtStart() == newDateTime );
  QVERIFY( pastedEvent->summary() == allDayEvent->summary() );
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:50,代码来源:testdndfactory.cpp

示例8: print

void KOEventPopupMenu::print( bool preview )
{
#ifndef KORG_NOPRINTER
  KOCoreHelper helper;
  CalPrinter printer( this, mCalendar, &helper, true );
  connect( this, SIGNAL(configChanged()), &printer, SLOT(updateConfig()) );

  Incidence::List selectedIncidences;
  selectedIncidences.append( mCurrentIncidence );

  printer.print( KOrg::CalPrinterBase::Incidence,
                 mCurrentDate, mCurrentDate, selectedIncidences, preview );
#endif
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:14,代码来源:koeventpopupmenu.cpp

示例9: 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;
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:43,代码来源:dndfactory.cpp

示例10: testPasteAllDayEvent

void DndFactoryTest::testPasteAllDayEvent()
{

  MemoryCalendar::Ptr calendar( new MemoryCalendar( QString() ) );

  DndFactory factory( calendar );

  Event::Ptr allDayEvent( new Event() );
  allDayEvent->setSummary( QLatin1String( "Summary 1" ) );
  allDayEvent->setDtStart( KDateTime( QDate( 2010, 8, 8 ) ) );
  allDayEvent->setDtEnd( KDateTime( QDate( 2010, 8, 9 ) ) );
  const QString originalUid = allDayEvent->uid();
  const bool originalIsAllDay = allDayEvent->allDay();

  Incidence::List incidencesToPaste;
  incidencesToPaste.append( allDayEvent );

  QVERIFY( factory.copyIncidences( incidencesToPaste ) );

  Incidence::List pastedIncidences = factory.pasteIncidences();
  QVERIFY( pastedIncidences.size() == 1 );

  Incidence::Ptr incidence = pastedIncidences.first();

  QVERIFY( incidence->type() == Incidence::TypeEvent );

  // check if a new uid was generated.
  QVERIFY( incidence->uid() != originalUid );

  // we passed an invalid KDateTime to pasteIncidences() so dates don't change.
  QVERIFY( incidence->allDay() == originalIsAllDay );

  Event::Ptr pastedEvent = incidence.staticCast<Event>();

  QVERIFY( pastedEvent->dtStart() == allDayEvent->dtStart() );
  QVERIFY( pastedEvent->dtEnd() == allDayEvent->dtEnd() );
  QVERIFY( pastedEvent->summary() == allDayEvent->summary() );
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:38,代码来源:testdndfactory.cpp

示例11: copyIncidence

bool DndFactory::copyIncidence( Incidence *selectedInc )
{
  Incidence::List list;
  list.append( selectedInc );
  return copyIncidences( list );
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:6,代码来源:dndfactory.cpp

示例12: cutIncidence

void DndFactory::cutIncidence( Incidence *selectedInc )
{
  Incidence::List list;
  list.append( selectedInc );
  cutIncidences( list );
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:6,代码来源:dndfactory.cpp

示例13: removeRelations

// If a task with subtasks is deleted, move it's subtasks to the orphans list
void Calendar::removeRelations(Incidence *incidence)
{
    if(!incidence)
    {
        kdDebug(5800) << "Warning: Calendar::removeRelations( 0 )!\n";
        return;
    }

    // kdDebug(5850) << "Calendar::removeRelations for incidence " << forincidence << " with UID " << forincidence->uid() << ", summary: " << forincidence->summary() << endl;
    QString uid = incidence->uid();

    Incidence::List relations = incidence->relations();
    Incidence::List::ConstIterator it;
    for(it = relations.begin(); it != relations.end(); ++it)
    {
        Incidence *i = *it;
        if(!mOrphanUids.find(i->uid()))
        {
            mOrphans.insert(uid, i);
            mOrphanUids.insert(i->uid(), i);
            i->setRelatedTo(0);
            i->setRelatedToUid(uid);
        }
    }

    // If this incidence is related to something else, tell that about it
    if(incidence->relatedTo())
        incidence->relatedTo()->removeRelation(incidence);

    // Remove this one from the orphans list
    if(mOrphanUids.remove(uid))
    {
        // This incidence is located in the orphans list - it should be removed
        // Since the mOrphans dict might contain the same key (with different
        // child incidence pointers!) multiple times, take care that we remove
        // the correct one. So we need to remove all items with the given
        // parent UID, and readd those that are not for this item. Also, there
        // might be other entries with differnet UID that point to this
        // incidence (this might happen when the relatedTo of the item is
        // changed before its parent is inserted. This might happen with
        // groupware servers....). Remove them, too
        QStringList relatedToUids;
        // First get the list of all keys in the mOrphans list that point to the removed item
        relatedToUids << incidence->relatedToUid();
        for(QDictIterator<Incidence> it(mOrphans); it.current(); ++it)
        {
            if(it.current()->uid() == uid)
            {
                relatedToUids << it.currentKey();
            }
        }

        // now go through all uids that have one entry that point to the incidence
        for(QStringList::Iterator uidit = relatedToUids.begin();
                uidit != relatedToUids.end(); ++uidit)
        {
            Incidence::List tempList;
            // Remove all to get access to the remaining entries
            while(Incidence *i = mOrphans[ *uidit ])
            {
                mOrphans.remove(*uidit);
                if(i != incidence) tempList.append(i);
            }
            // Readd those that point to a different orphan incidence
            for(Incidence::List::Iterator incit = tempList.begin();
                    incit != tempList.end(); ++incit)
            {
                mOrphans.insert(*uidit, *incit);
            }
        }
    }
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:73,代码来源:calendar.cpp


注:本文中的incidence::List::append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。