diff --git a/ChangeLog b/ChangeLog index 582a816ef..0138872aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2009-03-24 Wolfgang Sourdeau + * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor + -takeValuesFromRequest:_rqinContext:_ctx]): ensure the values + meant to construct the custom recurrence rule are consistent. + * UI/Scheduler/UIxCalMainView.m: if the module settings key exists, do not reset it. diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index f8d22a9e3..8ffe9460a 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -1438,19 +1438,22 @@ RANGE(2); // case 0: { - [theRule setFrequency: iCalRecurrenceFrequenceDaily]; + if ([[self repeat2] intValue] > 0) + { + [theRule setFrequency: iCalRecurrenceFrequenceDaily]; - if ([[self repeat1] intValue] == 0) - { - [theRule setInterval: [self repeat2]]; - } - else - { - [theRule setByDayMask: (iCalWeekDayMonday - |iCalWeekDayTuesday - |iCalWeekDayWednesday - |iCalWeekDayThursday - |iCalWeekDayFriday)]; + if ([[self repeat1] intValue] == 0) + { + [theRule setInterval: [self repeat2]]; + } + else + { + [theRule setByDayMask: (iCalWeekDayMonday + |iCalWeekDayTuesday + |iCalWeekDayWednesday + |iCalWeekDayThursday + |iCalWeekDayFriday)]; + } } } break; @@ -1465,20 +1468,23 @@ RANGE(2); // The list is separated by commas, like: 1,3,4 case 1: { - NSArray *v; - int c, mask; + if ([[self repeat1] intValue] > 0) + { + NSArray *v; + int c, mask; - [theRule setFrequency: iCalRecurrenceFrequenceWeekly]; - [theRule setInterval: [self repeat1]]; + [theRule setFrequency: iCalRecurrenceFrequenceWeekly]; + [theRule setInterval: [self repeat1]]; - v = [[self repeat2] componentsSeparatedByString: @","]; - c = [v count]; - mask = 0; + v = [[self repeat2] componentsSeparatedByString: @","]; + c = [v count]; + mask = 0; - while (c--) - mask |= 1 << ([[v objectAtIndex: c] intValue]); + while (c--) + mask |= 1 << ([[v objectAtIndex: c] intValue]); - [theRule setByDayMask: mask]; + [theRule setByDayMask: mask]; + } } break; @@ -1504,17 +1510,21 @@ RANGE(2); // case 2: { - [theRule setFrequency: iCalRecurrenceFrequenceMonthly]; - [theRule setInterval: [self repeat1]]; + if ([[self repeat1] intValue] > 0) + { + [theRule setFrequency: iCalRecurrenceFrequenceMonthly]; + [theRule setInterval: [self repeat1]]; - // We recur on specific days... - if ([[self repeat2] intValue] == 1) - { - [theRule setNamedValue: @"bymonthday" to: [self repeat5]]; - } - else - { - // TODO + // We recur on specific days... + if ([[self repeat2] intValue] == 1 + && [[self repeat5] intValue] > 0) + { + [theRule setNamedValue: @"bymonthday" to: [self repeat5]]; + } + else + { + // TODO + } } } break; @@ -1538,19 +1548,27 @@ RANGE(2); case 3: default: { - [theRule setFrequency: iCalRecurrenceFrequenceYearly]; - [theRule setInterval: [self repeat1]]; + if ([[self repeat1] intValue] > 0) + { + [theRule setFrequency: iCalRecurrenceFrequenceYearly]; + [theRule setInterval: [self repeat1]]; - // We recur Every .. of .. - if ([[self repeat2] intValue] == 1) - { - // TODO - } - else - { - [theRule setNamedValue: @"bymonthday" to: [self repeat3]]; - [theRule setNamedValue: @"bymonth" - to: [NSString stringWithFormat: @"%d", ([[self repeat4] intValue]+1)]]; + // We recur Every .. of .. + if ([[self repeat2] intValue] == 1) + { + // TODO + } + else + { + if ([[self repeat3] intValue] > 0 + && [[self repeat4] intValue] > 0) + { + [theRule setNamedValue: @"bymonthday" + to: [self repeat3]]; + [theRule setNamedValue: @"bymonth" + to: [NSString stringWithFormat: @"%d", ([[self repeat4] intValue]+1)]]; + } + } } } break;