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(); } }
// Emulate the old behavior QBitArray Recurrence::days() const { QBitArray days( 7 ); days.fill( 0 ); RecurrenceRule *rrule = defaultRRuleConst(); if ( rrule ) { QList<RecurrenceRule::WDayPos> bydays = rrule->byDays(); for ( int i = 0; i < bydays.size(); ++i ) { if ( bydays.at( i ).pos() == 0 ) { days.setBit( bydays.at( i ).day() - 1 ); } } } return days; }
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(); } }
// Emulate the old behavior QList<RecurrenceRule::WDayPos> Recurrence::monthPositions() const { RecurrenceRule *rrule = defaultRRuleConst(); return rrule ? rrule->byDays() : QList<RecurrenceRule::WDayPos>(); }