Bug 79788 - Create a recurrence for the LAST day of the month
Summary: Create a recurrence for the LAST day of the month
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: Cornelius Schumacher
URL:
Keywords:
: 88544 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-04-17 00:48 UTC by tjg
Modified: 2005-02-13 18:18 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tjg 2004-04-17 00:48:43 UTC
Version:            (using KDE KDE 3.2.1)
Installed from:    Gentoo Packages

While you can recur on the last Friday of the month, I cannot find a way to recur on the last day of the month.
Comment 1 Stephan Binner 2004-04-18 11:26:29 UTC
How does "reoccur on the 31st day" works for months with less days?
Comment 2 tjg 2004-04-18 17:16:38 UTC
Tried it before I filed the report.

Set up an event for the 31st of March, and then checked the months with fewer 
days. It simply doesn't appear, except on months with 31 days.

On Sunday 18 April 2004 02:26 am, Stephan Binner wrote:
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
> http://bugs.kde.org/show_bug.cgi?id=79788
>
>
>
>
> ------- Additional Comments From binner kde org  2004-04-18 11:26 -------
> How does "reoccur on the 31st day" works for months with less days?

Comment 3 Reinhold Kainhofer 2004-10-04 01:01:49 UTC
*** Bug 88544 has been marked as a duplicate of this bug. ***
Comment 4 Reinhold Kainhofer 2005-02-13 18:18:11 UTC
CVS commit by kainhofe: 

Correctly handle monthly recurrences that are counted from the end of the month (e.g. "last day of each month").

BUGS:79788


  M +45 -4     koeditorrecurrence.cpp   1.82


--- kdepim/korganizer/koeditorrecurrence.cpp  #1.81:1.82
@@ -288,4 +288,37 @@ RecurMonthly::RecurMonthly( QWidget *par
   mByDayCombo->insertItem( i18n("30th") );
   mByDayCombo->insertItem( i18n("31st") );
+  mByDayCombo->insertItem( i18n("Last") );
+  mByDayCombo->insertItem( i18n("2nd Last") );
+  mByDayCombo->insertItem( i18n("3rd Last") );
+  mByDayCombo->insertItem( i18n("4th Last") );
+  mByDayCombo->insertItem( i18n("5th Last") );
+  // FIXME: After the string freeze is over, insert all possible values, not
+  //        just the ones we already have translated:
+/*  mByDayCombo->insertItem( i18n("6th Last") );
+  mByDayCombo->insertItem( i18n("7th Last") );
+  mByDayCombo->insertItem( i18n("8th Last") );
+  mByDayCombo->insertItem( i18n("9th Last") );
+  mByDayCombo->insertItem( i18n("10th Last") );
+  mByDayCombo->insertItem( i18n("11th Last") );
+  mByDayCombo->insertItem( i18n("12th Last") );
+  mByDayCombo->insertItem( i18n("13th Last") );
+  mByDayCombo->insertItem( i18n("14th Last") );
+  mByDayCombo->insertItem( i18n("15th Last") );
+  mByDayCombo->insertItem( i18n("16th Last") );
+  mByDayCombo->insertItem( i18n("17th Last") );
+  mByDayCombo->insertItem( i18n("18th Last") );
+  mByDayCombo->insertItem( i18n("19th Last") );
+  mByDayCombo->insertItem( i18n("20th Last") );
+  mByDayCombo->insertItem( i18n("21st Last") );
+  mByDayCombo->insertItem( i18n("22nd Last") );
+  mByDayCombo->insertItem( i18n("23rd Last") );
+  mByDayCombo->insertItem( i18n("24th Last") );
+  mByDayCombo->insertItem( i18n("25th Last") );
+  mByDayCombo->insertItem( i18n("26th Last") );
+  mByDayCombo->insertItem( i18n("27th Last") );
+  mByDayCombo->insertItem( i18n("28th Last") );
+  mByDayCombo->insertItem( i18n("29th Last") );
+  mByDayCombo->insertItem( i18n("30th Last") );
+  mByDayCombo->insertItem( i18n("31st Last") );*/
   buttonLayout->addWidget( mByDayCombo, 0, 1 );
 
@@ -311,5 +344,10 @@ void RecurMonthly::setByDay( int day )
 {
   mByDayRadio->setChecked( true );
+  // Days from the end are after the ones from the begin, so correct for the
+  // negative sign and add 30 (index starting at 0)
+  if ( day > 0 & day <= 31 )
   mByDayCombo->setCurrentItem( day-1 );
+  else if ( day < 0 )
+    mByDayCombo->setCurrentItem( 31 - 1 - day );
 }
 
@@ -337,5 +375,8 @@ bool RecurMonthly::byPos()
 int RecurMonthly::day()
 {
-  return mByDayCombo->currentItem() + 1;
+  int day = mByDayCombo->currentItem();
+  if ( day >= 31 ) day = 31-day-1;
+  else --day;
+  return day;
 }