本文整理汇总了C++中incidence::List类的典型用法代码示例。如果您正苦于以下问题:C++ List类的具体用法?C++ List怎么用?C++ List使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了List类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteIncidences
void EventArchiver::deleteIncidences(Calendar *calendar, const QDate &limitDate, QWidget *widget, const Incidence::List &incidences, bool withGUI)
{
QStringList incidenceStrs;
Incidence::List::ConstIterator it;
for(it = incidences.begin(); it != incidences.end(); ++it)
{
incidenceStrs.append((*it)->summary());
}
if(withGUI)
{
int result = KMessageBox::warningContinueCancelList(
widget, i18n("Delete all items before %1 without saving?\n"
"The following items will be deleted:")
.arg(KGlobal::locale()->formatDate(limitDate)), incidenceStrs,
i18n("Delete Old Items"), KStdGuiItem::del());
if(result != KMessageBox::Continue)
return;
}
for(it = incidences.begin(); it != incidences.end(); ++it)
{
calendar->deleteIncidence(*it);
}
emit eventsDeleted();
}
示例2: 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() );
}
示例3: 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;
}
}
示例4: addIncidences
void KOListView::addIncidences(const Incidence::List &incidenceList)
{
Incidence::List::ConstIterator it;
for(it = incidenceList.begin(); it != incidenceList.end(); ++it)
{
addIncidence(*it);
}
}
示例5: selectedIncidences
Incidence::List KOListView::selectedIncidences()
{
Incidence::List eventList;
QListViewItem *item = mListView->selectedItem();
if(item) eventList.append(((KOListViewItem *)item)->data());
return eventList;
}
示例6: 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;
}
示例7: 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;
}
示例8: doSave
bool ResourceGroupware::doSave( bool )
{
kDebug() <<"KCal::ResourceGroupware::doSave()";
saveToCache();
if ( !hasChanges() ) {
kDebug() <<"No changes";
return true;
}
if ( !confirmSave() ) return false;
#if 0
Incidence::List::ConstIterator it;
Incidence::List added = addedIncidences();
for( it = added.begin(); it != added.end(); ++it ) {
if ( mServer->addIncidence( *it, this ) ) {
clearChange( *it );
saveToCache();
}
}
Incidence::List changed = changedIncidences();
for( it = changed.begin(); it != changed.end(); ++it ) {
if ( mServer->changeIncidence( *it ) ) clearChange( *it );
}
Incidence::List deleted = deletedIncidences();
for( it = deleted.begin(); it != deleted.end(); ++it ) {
if ( mServer->deleteIncidence( *it ) ) clearChange( *it );
}
#endif
return true;
}
示例9: rawIncidences
Incidence *Calendar::incidenceFromSchedulingID(const QString &UID)
{
Incidence::List incidences = rawIncidences();
Incidence::List::iterator it = incidences.begin();
for(; it != incidences.end(); ++it)
if((*it)->schedulingID() == UID)
// Touchdown, and the crowd goes wild
return *it;
// Not found
return 0;
}
示例10: run
void EventArchiver::run(Calendar *calendar, const QDate &limitDate, QWidget *widget, bool withGUI, bool errorIfNone)
{
// We need to use rawEvents, otherwise events hidden by filters will not be archived.
Incidence::List incidences;
Event::List events;
Todo::List todos;
Journal::List journals;
if(KOPrefs::instance()->mArchiveEvents)
{
events = calendar->rawEvents(
QDate(1769, 12, 1),
// #29555, also advertised by the "limitDate not included" in the class docu
limitDate.addDays(-1),
true);
}
if(KOPrefs::instance()->mArchiveTodos)
{
Todo::List t = calendar->rawTodos();
Todo::List::ConstIterator it;
for(it = t.begin(); it != t.end(); ++it)
{
if((*it) && ((*it)->isCompleted()) && ((*it)->completed().date() < limitDate))
{
todos.append(*it);
}
}
}
incidences = Calendar::mergeIncidenceList(events, todos, journals);
kdDebug(5850) << "EventArchiver: archiving incidences before " << limitDate << " -> " << incidences.count() << " incidences found." << endl;
if(incidences.isEmpty())
{
if(withGUI && errorIfNone)
KMessageBox::information(widget, i18n("There are no items before %1")
.arg(KGlobal::locale()->formatDate(limitDate)),
"ArchiverNoIncidences");
return;
}
switch(KOPrefs::instance()->mArchiveAction)
{
case KOPrefs::actionDelete:
deleteIncidences(calendar, limitDate, widget, incidences, withGUI);
break;
case KOPrefs::actionArchive:
archiveIncidences(calendar, limitDate, widget, incidences, withGUI);
break;
}
}
示例11: 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;
}
}
示例12: 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;
}
示例13: 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() );
}
示例14: 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
}
示例15: doSave
bool ResourceLocalDir::doSave()
{
Incidence::List list;
bool success = true;
list = addedIncidences();
list += changedIncidences();
for(Incidence::List::iterator it = list.begin(); it != list.end(); ++it)
if(!doSave(*it))
success = false;
return success;
}