Summary: | add last [2nd last, 3rd...] to recurrent event list (day in month) | ||
---|---|---|---|
Product: | [Applications] korganizer | Reporter: | Peter Dowsett <peter_dowsett> |
Component: | general | Assignee: | Cornelius Schumacher <schumacher> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | binner |
Priority: | NOR | ||
Version: | 2.2.1 | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Other | ||
Latest Commit: | Version Fixed In: |
Description
Peter Dowsett
2001-11-05 04:42:02 UTC
*** Bug 48383 has been marked as a duplicate of this bug. *** Subject: kdepim/korganizer CVS commit by kainhofe: This patch adds entries to the combo box (for monthly recurrences that recur on the n-th weekday) to count recurrence weeks from the end of the month. Note that I also moved some index offsets from readEvent and writeEvent to the RecurMonthly class (since the offset in one direction was done in readEvent, the other direction in the RecurMonthly, this was just begging for trouble in the future. Now all index offset handling is in RecurMonthly). CCMAIL: 34505-done@bugs.kde.org M +21 -6 koeditorrecurrence.cpp 1.47 --- kdepim/korganizer/koeditorrecurrence.cpp #1.46:1.47 @@ -230,4 +230,10 @@ RecurMonthly::RecurMonthly( QWidget *par mByPosCountCombo->insertItem( i18n("4th") ); mByPosCountCombo->insertItem( i18n("5th") ); + mByPosCountCombo->insertItem( i18n("last") ); + mByPosCountCombo->insertItem( i18n("2nd last") ); + mByPosCountCombo->insertItem( i18n("3rd last") ); + mByPosCountCombo->insertItem( i18n("4th last") ); + mByPosCountCombo->insertItem( i18n("5th last") ); + buttonLayout->addWidget( mByPosCountCombo, 1, 1 ); @@ -246,5 +252,5 @@ void RecurMonthly::setByDay( int day ) { mByDayRadio->setChecked( true ); - mByDayCombo->setCurrentItem( day ); + mByDayCombo->setCurrentItem( day-1 ); } @@ -252,5 +258,9 @@ void RecurMonthly::setByPos( int count, { mByPosRadio->setChecked( true ); - mByPosCountCombo->setCurrentItem( count ); + if (count>0) + mByPosCountCombo->setCurrentItem( count - 1 ); + else + // negative weeks means counted from the end of month + mByPosCountCombo->setCurrentItem( -count + 4 ); mByPosWeekdayCombo->setCurrentItem( weekday ); } @@ -273,5 +283,9 @@ int RecurMonthly::day() int RecurMonthly::count() { - return mByPosCountCombo->currentItem() + 1; + int pos=mByPosCountCombo->currentItem(); + if (pos<=4) // positive count + return pos+1; + else + return -pos+4; } @@ -915,7 +929,8 @@ void KOEditorRecurrence::readEvent(Event rmp = r->monthPositions(); if ( rmp.first()->negative ) - count = 5 - rmp.first()->rPos - 1; + count=-rmp.first()->rPos; else - count = rmp.first()->rPos - 1; + // give the week as -5 to -1 and 1 to 5. the widget will do the rest + count = rmp.first()->rPos; day = 0; while ( !rmp.first()->rDays.testBit( day ) ) ++day; @@ -929,5 +944,5 @@ void KOEditorRecurrence::readEvent(Event rmd = r->monthDays(); - day = *rmd.first() - 1; + day = *rmd.first(); mMonthly->setByDay( day ); |