本文整理汇总了C++中KDateTime::timeSpec方法的典型用法代码示例。如果您正苦于以下问题:C++ KDateTime::timeSpec方法的具体用法?C++ KDateTime::timeSpec怎么用?C++ KDateTime::timeSpec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDateTime
的用法示例。
在下文中一共展示了KDateTime::timeSpec方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: availableOccurrences
int RecurrenceActions::availableOccurrences( const Incidence::Ptr &incidence,
const KDateTime &selectedOccurrence )
{
int result = NoOccurrence;
if ( incidence->recurrence()->recursOn( selectedOccurrence.date(),
selectedOccurrence.timeSpec() ) ) {
result |= SelectedOccurrence;
}
if ( incidence->recurrence()->getPreviousDateTime( selectedOccurrence ).isValid() ) {
result |= PastOccurrences;
}
if ( incidence->recurrence()->getNextDateTime( selectedOccurrence ).isValid() ) {
result |= FutureOccurrences;
}
return result;
}
示例2: dumpTime
QString dumpTime( const KDateTime &dt, const KDateTime::Spec &viewSpec )
{
if ( !dt.isValid() ) {
return QString();
}
KDateTime vdt = viewSpec.isValid() ? dt.toTimeSpec( viewSpec ) : dt;
QString format;
#ifdef FLOAT_IS_DATE_ONLY
if ( vdt.isDateOnly() ) {
format = QLatin1String( "%Y-%m-%d" );
} else
#endif
format = QLatin1String( "%Y-%m-%dT%H:%M:%S" );
if ( vdt.isSecondOccurrence() ) {
format += QLatin1String( " %Z" );
}
if ( vdt.timeSpec() != KDateTime::ClockTime ) {
format += QLatin1String( " %:Z" );
}
return vdt.toString( format );
}
示例3: kDebug
//@cond PRIVATE
void FreeBusy::Private::init( const Event::List &eventList,
const KDateTime &start, const KDateTime &end )
{
int extraDays, i, x, duration;
duration = start.daysTo( end );
QDate day;
KDateTime tmpStart;
KDateTime tmpEnd;
// Loops through every event in the calendar
Event::List::ConstIterator it;
for ( it = eventList.constBegin(); it != eventList.constEnd(); ++it ) {
Event::Ptr event = *it;
// If this event is transparent it shouldn't be in the freebusy list.
if ( event->transparency() == Event::Transparent ) {
continue;
}
// The code below can not handle all-day events. Fixing this resulted
// in a lot of duplicated code. Instead, make a copy of the event and
// set the period to the full day(s). This trick works for recurring,
// multiday, and single day all-day events.
Event::Ptr allDayEvent;
if ( event->allDay() ) {
// addDay event. Do the hack
kDebug() << "All-day event";
allDayEvent = Event::Ptr( new Event( *event ) );
// Set the start and end times to be on midnight
KDateTime st = allDayEvent->dtStart();
st.setTime( QTime( 0, 0 ) );
KDateTime nd = allDayEvent->dtEnd();
nd.setTime( QTime( 23, 59, 59, 999 ) );
allDayEvent->setAllDay( false );
allDayEvent->setDtStart( st );
allDayEvent->setDtEnd( nd );
kDebug() << "Use:" << st.toString() << "to" << nd.toString();
// Finally, use this event for the setting below
event = allDayEvent;
}
// This whole for loop is for recurring events, it loops through
// each of the days of the freebusy request
for ( i = 0; i <= duration; ++i ) {
day = start.addDays( i ).date();
tmpStart.setDate( day );
tmpEnd.setDate( day );
if ( event->recurs() ) {
if ( event->isMultiDay() ) {
// FIXME: This doesn't work for sub-daily recurrences or recurrences with
// a different time than the original event.
extraDays = event->dtStart().daysTo( event->dtEnd() );
for ( x = 0; x <= extraDays; ++x ) {
if ( event->recursOn( day.addDays( -x ), start.timeSpec() ) ) {
tmpStart.setDate( day.addDays( -x ) );
tmpStart.setTime( event->dtStart().time() );
tmpEnd = event->duration().end( tmpStart );
addLocalPeriod( q, tmpStart, tmpEnd );
break;
}
}
} else {
if ( event->recursOn( day, start.timeSpec() ) ) {
tmpStart.setTime( event->dtStart().time() );
tmpEnd.setTime( event->dtEnd().time() );
addLocalPeriod ( q, tmpStart, tmpEnd );
}
}
}
}
// Non-recurring events
addLocalPeriod( q, event->dtStart(), event->dtEnd() );
}
q->sortList();
}