See ChangeLog.

Monotone-Parent: 4a37382e84f4a00ccbbc0542ef0ae4a99a954cdd
Monotone-Revision: 5768aec2a733241a4cb94db69e98b57603adb638

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-03-29T23:22:08
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Francis Lachapelle 2011-03-29 23:22:08 +00:00
parent cb76677762
commit eea9b8b91d
3 changed files with 79 additions and 6 deletions

View File

@ -1,3 +1,13 @@
2011-03-29 Francis Lachapelle <flachapelle@inverse.ca>
* iCalRepeatableEntityObject.m (-rules:withEventTimeZone:): new
method that returns a new set of rules with their "untill dates"
adjusted to the specified timezone.
(-recurrenceRulesWithTimeZone:): new method that returns the
recurrence rules adjusted to the specified timezone.
(-exceptionRulesWithTimeZone:): new method that returns the
exception rules adjusted to the specified timezone.
2011-03-23 Francis Lachapelle <flachapelle@inverse.ca>
* iCalRepeatableEntityObject.m (-removeAllExceptionDates): don't

View File

@ -47,17 +47,21 @@
- (void)setRecurrenceRules:(NSArray *)_rrule;
- (BOOL)hasRecurrenceRules;
- (NSArray *)recurrenceRules;
- (NSArray *)recurrenceRulesWithTimeZone: (iCalTimeZone *) timezone;
- (void)removeAllExceptionRules;
- (void)addToExceptionRules:(id)_rrule;
- (BOOL)hasExceptionRules;
- (NSArray *)exceptionRules;
- (NSArray *)exceptionRulesWithTimeZone: (iCalTimeZone *) timezone;
- (void)removeAllExceptionDates;
- (void)addToExceptionDates:(NSCalendarDate *)_date;
- (BOOL)hasExceptionDates;
- (NSArray *)exceptionDates;
- (NSArray *)exceptionDatesWithEventTimeZone:(iCalTimeZone*)theTimeZone;
- (NSArray *)exceptionDatesWithTimeZone: (iCalTimeZone*) theTimeZone;
- (NSArray *) rules: (NSArray *) theRules withTimeZone: (iCalTimeZone *) theTimeZone;
- (BOOL)isRecurrent;
- (BOOL)isWithinCalendarDateRange:(NGCalendarDateRange *)_range

View File

@ -1,6 +1,6 @@
/*
Copyright (C) 2004-2005 SKYRIX Software AG
Copyright (C) 2010 Inverse inc.
Copyright (C) 2011 Inverse inc.
This file is part of SOPE.
@ -78,6 +78,14 @@
return [self childrenWithTag: @"rrule"];
}
- (NSArray *) recurrenceRulesWithTimeZone: (iCalTimeZone *) timezone
{
NSArray *rules;
rules = [self recurrenceRules];
return [self rules: rules withTimeZone: timezone];
}
- (void) removeAllExceptionRules
{
[self removeChildren: [self exceptionRules]];
@ -104,6 +112,57 @@
return [self childrenWithTag: @"exrule"];
}
- (NSArray *) exceptionRulesWithTimeZone: (iCalTimeZone *) timezone
{
NSArray *rules;
rules = [self exceptionRules];
return [self rules: rules withTimeZone: timezone];
}
/**
* Returns a new set of rules, but with "until dates" adjusted to the
* specified timezone.
* Used when calculating a recurrence/exception rule.
* @param theRules the iCalRecurrenceRule instances
* @param theTimeZone the timezone of the entity.
* @see recurrenceRulesWithTimeZone:
* @see exceptionRulesWithTimeZone:
* @return a new array of iCalRecurrenceRule instances, adjusted for the timezone.
*/
- (NSArray *) rules: (NSArray *) theRules withTimeZone: (iCalTimeZone *) theTimeZone
{
NSArray *rules;
NSCalendarDate *untilDate;
NSMutableArray *fixedRules;
iCalRecurrenceRule *currentRule;
unsigned int max, count;
rules = theRules;
if (theTimeZone)
{
max = [rules count];
if (max)
{
fixedRules = [NSMutableArray arrayWithCapacity: max];
for (count = 0; count < max; count++)
{
currentRule = [rules objectAtIndex: count];
untilDate = [currentRule untilDate];
if (untilDate)
{
untilDate = [theTimeZone computedDateForDate: untilDate];
[currentRule setUntilDate: untilDate];
}
[fixedRules addObject: currentRule];
}
rules = fixedRules;
}
}
return rules;
}
- (void) removeAllExceptionDates
{
[self removeChildren: [self childrenWithTag: @"exdate"]];
@ -163,13 +222,13 @@
}
/**
* Returns the exception dates for the event, but adjusted to the event timezone.
* Returns the exception dates for the entity, but adjusted to the entity timezone.
* Used when calculating a recurrence rule.
* @param theTimeZone the timezone of the event.
* @param theTimeZone the timezone of the entity.
* @see [iCalTimeZone computedDatesForStrings:]
* @return the exception dates for the event, adjusted to the event timezone.
* @return the exception dates, adjusted to the timezone.
*/
- (NSArray *) exceptionDatesWithEventTimeZone: (iCalTimeZone *) theTimeZone
- (NSArray *) exceptionDatesWithTimeZone: (iCalTimeZone *) theTimeZone
{
NSArray *dates, *exDates;
NSEnumerator *dateList;