本文整理汇总了C++中incidence::Ptr::dtStart方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::dtStart方法的具体用法?C++ Ptr::dtStart怎么用?C++ Ptr::dtStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类incidence::Ptr
的用法示例。
在下文中一共展示了Ptr::dtStart方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
void CompatPre35::fixRecurrence( const Incidence::Ptr &incidence )
{
Recurrence *recurrence = incidence->recurrence();
if ( recurrence ) {
KDateTime start( incidence->dtStart() );
// kde < 3.5 only had one rrule, so no need to loop over all RRULEs.
RecurrenceRule *r = recurrence->defaultRRule();
if ( r && !r->dateMatchesRules( start ) ) {
recurrence->addExDateTime( start );
}
}
// Call base class method now that everything else is done
Compat::fixRecurrence( incidence );
}
示例2: end
void CompatPre31::fixRecurrence( const Incidence::Ptr &incidence )
{
CompatPre32::fixRecurrence( incidence );
Recurrence *recur = incidence->recurrence();
RecurrenceRule *r = 0;
if ( recur ) {
r = recur->defaultRRule();
}
if ( recur && r ) {
int duration = r->duration();
if ( duration > 0 ) {
// Backwards compatibility for KDE < 3.1.
// rDuration was set to the number of time periods to recur,
// with week start always on a Monday.
// Convert this to the number of occurrences.
r->setDuration( -1 );
QDate end( r->startDt().date() );
bool doNothing = false;
// # of periods:
int tmp = ( duration - 1 ) * r->frequency();
switch ( r->recurrenceType() ) {
case RecurrenceRule::rWeekly:
{
end = end.addDays( tmp * 7 + 7 - end.dayOfWeek() );
break;
}
case RecurrenceRule::rMonthly:
{
int month = end.month() - 1 + tmp;
end.setDate( end.year() + month / 12, month % 12 + 1, 31 );
break;
}
case RecurrenceRule::rYearly:
{
end.setDate( end.year() + tmp, 12, 31 );
break;
}
default:
doNothing = true;
break;
}
if ( !doNothing ) {
duration = r->durationTo(
KDateTime( end, QTime( 0, 0, 0 ), incidence->dtStart().timeSpec() ) );
r->setDuration( duration );
}
}
/* addYearlyNum */
// Dates were stored as day numbers, with a fiddle to take account of
// leap years. Convert the day number to a month.
QList<int> days = r->byYearDays();
if ( !days.isEmpty() ) {
QList<int> months = r->byMonths();
for ( int i = 0; i < months.size(); ++i ) {
int newmonth =
QDate( r->startDt().date().year(), 1, 1 ).addDays( months.at( i ) - 1 ).month();
if ( !months.contains( newmonth ) ) {
months.append( newmonth );
}
}
r->setByMonths( months );
days.clear();
r->setByYearDays( days );
}
}
}