Diffstat (limited to 'korganizer/koeditorrecurrence.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index dea8981..de4e4f7 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp @@ -837,4 +837,24 @@ void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) } +void KOEditorRecurrence::setDefaultsDates( QDateTime from, QDateTime to ) +{ + setDateTimes( from, to ); + QBitArray days( 7 ); + days.fill( 0 ); + days.setBit( from.date().dayOfWeek()- 1); + mWeekly->setDays( days ); + bool byPos = mMonthly->byPos(); + if ( byPos ) + mMonthly->setByDay( from.date().day()-1 ); + mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); + if ( ! byPos) + mMonthly->setByDay( from.date().day()-1 ); -void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) + bool byDay = mYearly->byDay(); + if ( ! byDay ) + mYearly->setByDay( from.date().dayOfYear() ); + mYearly->setByMonth( from.date().month(), from.date().day() ); + if ( byDay ) + mYearly->setByDay( from.date().dayOfYear() ); +} +void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to ) { @@ -842,3 +862,3 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); - setDateTimes( from, to ); + //setDateTimes( from, to ); @@ -855,14 +875,6 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) mDaily->setFrequency( 1 ); - mWeekly->setFrequency( 1 ); - QBitArray days( 7 ); - days.fill( 0 ); - days.setBit( from.date().dayOfWeek()- 1); - mWeekly->setDays( days ); mMonthly->setFrequency( 1 ); - mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); - mMonthly->setByDay( from.date().day()-1 ); mYearly->setFrequency( 1 ); - mYearly->setByDay( from.date().dayOfYear() ); - mYearly->setByMonth( from.date().month(), from.date().day() ); + setDefaultsDates( from, to ); } @@ -878,3 +890,3 @@ void KOEditorRecurrence::readEvent(Incidence *event) - setDefaults( event->dtStart(), dtEnd, true ); + setDefaults( event->dtStart(), dtEnd ); QBitArray rDays( 7 ); @@ -899,3 +911,3 @@ void KOEditorRecurrence::readEvent(Incidence *event) case Recurrence::rNone: - setDefaults( event->dtStart(), dtEnd, true ); + setDefaults( event->dtStart(), dtEnd ); break; @@ -971,3 +983,3 @@ void KOEditorRecurrence::readEvent(Incidence *event) default: - setDefaults( event->dtStart(), dtEnd, true ); + setDefaults( event->dtStart(), dtEnd ); break; |