Bug 34505 - add last [2nd last, 3rd...] to recurrent event list (day in month)
Summary: add last [2nd last, 3rd...] to recurrent event list (day in month)
Status: RESOLVED FIXED
Alias: None
Product: korganizer
Classification: Applications
Component: general (show other bugs)
Version: 2.2.1
Platform: openSUSE Other
: NOR wishlist
Target Milestone: ---
Assignee: Cornelius Schumacher
URL:
Keywords:
: 44052 48383 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-11-05 04:48 UTC by Peter Dowsett
Modified: 2003-08-01 15:17 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 Peter Dowsett 2001-11-05 04:42:02 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           korganizer
Version:           2.2.1 (using KDE 2.2.1 )
Severity:          wishlist
Installed from:    SuSE RPMs
Compiler:          Not Specified
OS:                Not Specified
OS/Compiler notes: Not Specified

When setting recurrent events it is somtimes useful to be able to select the last (or 2nd last or 3rd last ...) day of the month or the last (or 2nd last ...) Wednesday of the month.  Currently only numbering from the start of the month is offered.

(Submitted via bugs.kde.org)
Comment 1 Reinhold Kainhofer 2003-07-31 15:31:56 UTC
*** Bug 48383 has been marked as a duplicate of this bug. ***
Comment 2 Reinhold Kainhofer 2003-08-01 02:18:12 UTC
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 );
 


Comment 3 Reinhold Kainhofer 2003-08-01 15:17:09 UTC
*** Bug 44052 has been marked as a duplicate of this bug. ***