本文整理汇总了C++中event::List::count方法的典型用法代码示例。如果您正苦于以下问题:C++ List::count方法的具体用法?C++ List::count怎么用?C++ List::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类event::List
的用法示例。
在下文中一共展示了List::count方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cal
Incidence *ICalFormat::fromString(const QString &text)
{
CalendarLocal cal(mTimeZoneId);
fromString(&cal, text);
Incidence *ical = 0;
Event::List elist = cal.events();
if(elist.count() > 0)
{
ical = elist.first();
}
else
{
Todo::List tlist = cal.todos();
if(tlist.count() > 0)
{
ical = tlist.first();
}
else
{
Journal::List jlist = cal.journals();
if(jlist.count() > 0)
{
ical = jlist.first();
}
}
}
return ical ? ical->clone() : 0;
}
示例2: showInstance
bool KonsoleKalendar::showInstance()
{
bool status = true;
QFile f;
QString title;
Event::Ptr event;
const KDateTime::Spec timeSpec = m_variables->getCalendar()->timeSpec();
Akonadi::CalendarBase::Ptr calendar = m_variables->getCalendar();
if (m_variables->isDryRun()) {
cout << i18n("View Events <Dry Run>:").toLocal8Bit().data()
<< endl;
printSpecs();
} else {
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
<< "open export file";
if (m_variables->isExportFile()) {
f.setFileName(m_variables->getExportFile());
if (!f.open(QIODevice::WriteOnly)) {
status = false;
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
<< "unable to open export file"
<< m_variables->getExportFile();
}
} else {
f.open(stdout, QIODevice::WriteOnly);
}
if (status) {
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
<< "opened successful";
if (m_variables->isVerbose()) {
cout << i18n("View Event <Verbose>:").toLocal8Bit().data()
<< endl;
printSpecs();
}
QTextStream ts(&f);
if (m_variables->getExportType() != ExportTypeHTML &&
m_variables->getExportType() != ExportTypeMonthHTML) {
if (m_variables->getAll()) {
qCDebug(KONSOLEKALENDAR_LOG) << "konsolekalendar.cpp::showInstance() |"
<< "view all events sorted list";
Event::List sortedList = calendar->events(EventSortStartDate);
qCDebug(KONSOLEKALENDAR_LOG) << "Found" << sortedList.count() << "events";
if (!sortedList.isEmpty()) {
// The code that was here before the akonadi port was really slow with 200 events
// this is much faster:
foreach (const KCalCore::Event::Ptr &event, sortedList) {
status &= printEvent(&ts, event, event->dtStart().date());
}
}
} else if (m_variables->isUID()) {
示例3: loadTemplate
void KOEventEditor::loadTemplate( CalendarLocal &cal )
{
Event::List events = cal.events();
if ( events.count() == 0 ) {
KMessageBox::error( this, i18nc( "@info", "Template does not contain a valid event." ) );
} else {
readEvent( events.first(), QDate(), true );
}
}
示例4: createEventList
void HtmlExport::createEventList(QTextStream *ts)
{
int columns = 3;
*ts << "<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">\n";
*ts << " <tr>\n";
*ts << " <th class=\"sum\">" << i18n("Start Time") << "</th>\n";
*ts << " <th>" << i18n("End Time") << "</th>\n";
*ts << " <th>" << i18n("Event") << "</th>\n";
if(mSettings->eventLocation())
{
*ts << " <th>" << i18n("Location") << "</th>\n";
++columns;
}
if(mSettings->eventCategories())
{
*ts << " <th>" << i18n("Categories") << "</th>\n";
++columns;
}
if(mSettings->eventAttendees())
{
*ts << " <th>" << i18n("Attendees") << "</th>\n";
++columns;
}
*ts << " </tr>\n";
for(QDate dt = fromDate(); dt <= toDate(); dt = dt.addDays(1))
{
kdDebug(5850) << "Getting events for " << dt.toString() << endl;
Event::List events = mCalendar->events(dt,
EventSortStartDate,
SortDirectionAscending);
if(events.count())
{
Event::List::ConstIterator it;
bool first = true;
for(it = events.begin(); it != events.end(); ++it)
{
if(checkSecrecy(*it))
{
if(first)
{
*ts << " <tr><td colspan=\"" << QString::number(columns)
<< "\" class=\"datehead\"><i>"
<< KGlobal::locale()->formatDate(dt)
<< "</i></td></tr>\n";
first = false;
}
createEvent(ts, *it, dt);
}
}
}
}
*ts << "</table>\n";
}
示例5: createEventList
void HtmlExport::createEventList(QTextStream *ts)
{
int columns = 3;
*ts << "<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\">" << endl;
*ts << " <tr>" << endl;
*ts << " <th class=\"sum\">" << i18nc("@title:column event start time",
"Start Time") << "</th>" << endl;
*ts << " <th>" << i18nc("@title:column event end time",
"End Time") << "</th>" << endl;
*ts << " <th>" << i18nc("@title:column event description",
"Event") << "</th>" << endl;
if (d->mSettings->eventLocation()) {
*ts << " <th>" << i18nc("@title:column event locatin",
"Location") << "</th>" << endl;
++columns;
}
if (d->mSettings->eventCategories()) {
*ts << " <th>" << i18nc("@title:column event categories",
"Categories") << "</th>" << endl;
++columns;
}
if (d->mSettings->eventAttendees()) {
*ts << " <th>" << i18nc("@title:column event attendees",
"Attendees") << "</th>" << endl;
++columns;
}
*ts << " </tr>" << endl;
for (QDate dt = fromDate(); dt <= toDate(); dt = dt.addDays(1)) {
qCDebug(KCALUTILS_LOG) << "Getting events for" << dt.toString();
Event::List events = d->mCalendar->events(dt, d->mCalendar->timeSpec(),
EventSortStartDate,
SortDirectionAscending);
if (events.count()) {
*ts << " <tr><td colspan=\"" << QString::number(columns)
<< "\" class=\"datehead\"><i>"
<< QLocale().toString(dt)
<< "</i></td></tr>" << endl;
Event::List::ConstIterator it;
for (it = events.constBegin(); it != events.constEnd(); ++it) {
if (checkSecrecy(*it)) {
createEvent(ts, *it, dt);
}
}
}
}
*ts << "</table>" << endl;
}
示例6: checkAlarmTypes
/******************************************************************************
* Check whether the alarm types in a calendar correspond with the resource's
* alarm type.
* Reply = true if at least 1 alarm is the right type.
*/
bool AlarmResource::checkAlarmTypes(KCal::CalendarLocal& calendar) const
{
KCalEvent::Status type = kcalEventType();
if (type != KCalEvent::EMPTY)
{
bool have = false;
bool other = false;
const Event::List events = calendar.rawEvents();
for (int i = 0, iend = events.count(); i < iend; ++i)
{
KCalEvent::Status s = KCalEvent::status(events[i]);
if (type == s)
have = true;
else
other = true;
if (have && other)
break;
}
if (!have && other)
return false; // contains only wrong alarm types
}
return true;
}
示例7: createMonthView
void HtmlExport::createMonthView(QTextStream *ts)
{
QDate start = fromDate();
start.setYMD(start.year(), start.month(), 1); // go back to first day in month
QDate end(start.year(), start.month(), start.daysInMonth());
int startmonth = start.month();
int startyear = start.year();
while (start < toDate()) {
// Write header
QDate hDate(start.year(), start.month(), 1);
QString hMon = hDate.toString(QStringLiteral("MMMM"));
QString hYear = hDate.toString(QStringLiteral("yyyy"));
*ts << "<h2>"
<< i18nc("@title month and year", "%1 %2", hMon, hYear)
<< "</h2>" << endl;
if (QLocale().firstDayOfWeek() == 1) {
start = start.addDays(1 - start.dayOfWeek());
} else {
if (start.dayOfWeek() != 7) {
start = start.addDays(-start.dayOfWeek());
}
}
*ts << "<table border=\"1\">" << endl;
// Write table header
*ts << " <tr>";
for (int i = 0; i < 7; ++i) {
*ts << "<th>" << QLocale().dayName(start.addDays(i).dayOfWeek()) << "</th>";
}
*ts << "</tr>" << endl;
// Write days
while (start <= end) {
*ts << " <tr>" << endl;
for (int i = 0; i < 7; ++i) {
*ts << " <td valign=\"top\"><table border=\"0\">";
*ts << "<tr><td ";
if (d->mHolidayMap.contains(start) || start.dayOfWeek() == 7) {
*ts << "class=\"dateholiday\"";
} else {
*ts << "class=\"date\"";
}
*ts << ">" << QString::number(start.day());
if (d->mHolidayMap.contains(start)) {
*ts << " <em>" << d->mHolidayMap[start] << "</em>";
}
*ts << "</td></tr><tr><td valign=\"top\">";
// Only print events within the from-to range
if (start >= fromDate() && start <= toDate()) {
Event::List events = d->mCalendar->events(start, d->mCalendar->timeSpec(),
EventSortStartDate,
SortDirectionAscending);
if (events.count()) {
*ts << "<table>";
Event::List::ConstIterator it;
for (it = events.constBegin(); it != events.constEnd(); ++it) {
if (checkSecrecy(*it)) {
createEvent(ts, *it, start, false);
}
}
*ts << "</table>";
} else {
*ts << " ";
}
}
*ts << "</td></tr></table></td>" << endl;
start = start.addDays(1);
}
*ts << " </tr>" << endl;
}
*ts << "</table>" << endl;
startmonth += 1;
if (startmonth > 12) {
startyear += 1;
startmonth = 1;
}
start.setYMD(startyear, startmonth, 1);
end.setYMD(start.year(), start.month(), start.daysInMonth());
}
}