コード例 #1
0
ファイル: recurrence.cpp プロジェクト: pvuorela/kcalcore
void Recurrence::addMonthlyPos( short pos, const QBitArray &days )
{
  // Allow 53 for yearly!
  if ( d->mRecurReadOnly || pos > 53 || pos < -53 ) {
    return;
  }

  RecurrenceRule *rrule = defaultRRule( false );
  if ( !rrule ) {
    return;
  }
  bool changed = false;
  QList<RecurrenceRule::WDayPos> positions = rrule->byDays();

  for ( int i = 0; i < 7; ++i ) {
    if ( days.testBit( i ) ) {
      RecurrenceRule::WDayPos p( pos, i + 1 );
      if ( !positions.contains( p ) ) {
        changed = true;
        positions.append( p );
      }
    }
  }
  if ( changed ) {
    rrule->setByDays( positions );
    updated();
  }
}
コード例 #2
0
ファイル: recurrence.cpp プロジェクト: pvuorela/kcalcore
void Recurrence::addMonthlyPos( short pos, ushort day )
{
  // Allow 53 for yearly!
  if ( d->mRecurReadOnly || pos > 53 || pos < -53 ) {
    return;
  }

  RecurrenceRule *rrule = defaultRRule( false );
  if ( !rrule ) {
    return;
  }
  QList<RecurrenceRule::WDayPos> positions = rrule->byDays();

  RecurrenceRule::WDayPos p( pos, day );
  if ( !positions.contains( p ) ) {
    positions.append( p );
    rrule->setByDays( positions );
    updated();
  }
}