See Changelog.
Monotone-Parent: f632b73418c67ba2778ff41a75a2842d90da9883 Monotone-Revision: 8ae1b0b4d89d23b2996f0b95677ca5599649f47b Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2011-01-14T15:33:20 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
32dc764c41
commit
2c8744dcb0
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2011-01-14 Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
|
|
||||||
|
* SoObjects/Appointments/iCalRepeatableEntityObject+SOGo.m
|
||||||
|
(-doesOccurOnDate:): exception rules be adjusted to the event's
|
||||||
|
timezone since the recurrence calculation is also based on the
|
||||||
|
event's timezone.
|
||||||
|
|
||||||
|
* SoObjects/Appointments/SOGoAppointmentFolder.m
|
||||||
|
(-_flattenCycleRecord:forRange:intoArray:): idem.
|
||||||
|
|
||||||
2011-01-13 Francis Lachapelle <flachapelle@inverse.ca>
|
2011-01-13 Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
|
|
||||||
* SoObjects/Appointments/iCalRepeatableEntityObject+SOGo.m
|
* SoObjects/Appointments/iCalRepeatableEntityObject+SOGo.m
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
2011-01-14 Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
|
|
||||||
|
* iCalTimeZone.m (-computedDateForString:): new method that
|
||||||
|
returns a date adjusted with respect to this vTimeZone.
|
||||||
|
(-computedDatesForStrings:): idem but for multiple dates.
|
||||||
|
|
||||||
|
* iCalRepeatableEntityObject.m
|
||||||
|
(-exceptionDatesWithEventTimeZone:): new method that returns the
|
||||||
|
exception dates for the event, but adjusted to the event's timezone.
|
||||||
|
|
||||||
2011-01-13 Francis Lachapelle <flachapelle@inverse.ca>
|
2011-01-13 Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
|
|
||||||
* iCalTimeZone.m (-computedDateForDate:): Was
|
* iCalTimeZone.m (-computedDateForDate:): Was
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@class NSCalendarDate, NSMutableArray, NGCalendarDateRange;
|
@class NSCalendarDate, NSMutableArray, NGCalendarDateRange;
|
||||||
|
@class iCalTimeZone;
|
||||||
|
|
||||||
@interface iCalRepeatableEntityObject : iCalEntityObject
|
@interface iCalRepeatableEntityObject : iCalEntityObject
|
||||||
// {
|
// {
|
||||||
|
@ -56,6 +57,7 @@
|
||||||
- (void)addToExceptionDates:(NSCalendarDate *)_date;
|
- (void)addToExceptionDates:(NSCalendarDate *)_date;
|
||||||
- (BOOL)hasExceptionDates;
|
- (BOOL)hasExceptionDates;
|
||||||
- (NSArray *)exceptionDates;
|
- (NSArray *)exceptionDates;
|
||||||
|
- (NSArray *)exceptionDatesWithEventTimeZone:(iCalTimeZone*)theTimeZone;
|
||||||
|
|
||||||
- (BOOL)isRecurrent;
|
- (BOOL)isRecurrent;
|
||||||
- (BOOL)isWithinCalendarDateRange:(NGCalendarDateRange *)_range
|
- (BOOL)isWithinCalendarDateRange:(NGCalendarDateRange *)_range
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#import "NSCalendarDate+NGCards.h"
|
#import "NSCalendarDate+NGCards.h"
|
||||||
#import "iCalDateTime.h"
|
#import "iCalDateTime.h"
|
||||||
|
#import "iCalTimeZone.h"
|
||||||
#import "iCalRecurrenceRule.h"
|
#import "iCalRecurrenceRule.h"
|
||||||
#import "iCalRecurrenceCalculator.h"
|
#import "iCalRecurrenceCalculator.h"
|
||||||
#import "iCalRepeatableEntityObject.h"
|
#import "iCalRepeatableEntityObject.h"
|
||||||
|
@ -130,6 +131,10 @@
|
||||||
return ([[self childrenWithTag: @"exdate"] count] > 0);
|
return ([[self childrenWithTag: @"exdate"] count] > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the exception dates of the event in GMT.
|
||||||
|
* @return an array of strings.
|
||||||
|
*/
|
||||||
- (NSArray *) exceptionDates
|
- (NSArray *) exceptionDates
|
||||||
{
|
{
|
||||||
NSArray *exDates;
|
NSArray *exDates;
|
||||||
|
@ -157,6 +162,39 @@
|
||||||
return dates;
|
return dates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the exception dates for the event, but adjusted to the event timezone.
|
||||||
|
* Used when calculating a recurrence rule.
|
||||||
|
* @param theTimeZone the timezone of the event.
|
||||||
|
* @see [iCalTimeZone computedDatesForStrings:]
|
||||||
|
* @return the exception dates for the event, adjusted to the event timezone.
|
||||||
|
*/
|
||||||
|
- (NSArray *) exceptionDatesWithEventTimeZone: (iCalTimeZone *) theTimeZone
|
||||||
|
{
|
||||||
|
NSArray *exDates;
|
||||||
|
NSMutableArray *dates;
|
||||||
|
NSEnumerator *dateList;
|
||||||
|
NSCalendarDate *exDate;
|
||||||
|
NSString *dateString;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
dates = [NSMutableArray array];
|
||||||
|
dateList = [[self childrenWithTag: @"exdate"] objectEnumerator];
|
||||||
|
|
||||||
|
while ((dateString = [dateList nextObject]))
|
||||||
|
{
|
||||||
|
exDates = [(iCalDateTime*) dateString values];
|
||||||
|
for (i = 0; i < [exDates count]; i++)
|
||||||
|
{
|
||||||
|
dateString = [exDates objectAtIndex: i];
|
||||||
|
exDate = [theTimeZone computedDateForString: dateString];
|
||||||
|
[dates addObject: exDate];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dates;
|
||||||
|
}
|
||||||
|
|
||||||
/* Convenience */
|
/* Convenience */
|
||||||
|
|
||||||
- (BOOL) isRecurrent
|
- (BOOL) isRecurrent
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
- (NSString *) tzId;
|
- (NSString *) tzId;
|
||||||
- (iCalTimeZonePeriod *) periodForDate: (NSCalendarDate *) date;
|
- (iCalTimeZonePeriod *) periodForDate: (NSCalendarDate *) date;
|
||||||
- (NSCalendarDate *) computedDateForDate: (NSCalendarDate *) theDate;
|
- (NSCalendarDate *) computedDateForDate: (NSCalendarDate *) theDate;
|
||||||
|
- (NSCalendarDate *) computedDateForString: (NSString *) theDate;
|
||||||
|
- (NSMutableArray *) computedDatesForStrings: (NSArray *) theDates;
|
||||||
- (NSString *) dateTimeStringForDate: (NSCalendarDate *) date;
|
- (NSString *) dateTimeStringForDate: (NSCalendarDate *) date;
|
||||||
- (NSString *) dateStringForDate: (NSCalendarDate *) date;
|
- (NSString *) dateStringForDate: (NSCalendarDate *) date;
|
||||||
- (NSCalendarDate *) dateForDateTimeString: (NSString *) string;
|
- (NSCalendarDate *) dateForDateTimeString: (NSString *) string;
|
||||||
|
|
|
@ -209,6 +209,49 @@ static NSMutableDictionary *cache;
|
||||||
second: [[self periodForDate: theDate] secondsOffsetFromGMT]];
|
second: [[self periodForDate: theDate] secondsOffsetFromGMT]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjust a date with respect to this vTimeZone.
|
||||||
|
* @param theDate the string representing a date.
|
||||||
|
* @return a new GMT date adjusted with the offset of this timezone.
|
||||||
|
*/
|
||||||
|
- (NSCalendarDate *) computedDateForString: (NSString *) theDate
|
||||||
|
{
|
||||||
|
NSCalendarDate *tmpDate;
|
||||||
|
NSTimeZone *utc;
|
||||||
|
|
||||||
|
utc = [NSTimeZone timeZoneWithName: @"GMT"];
|
||||||
|
tmpDate = [theDate asCalendarDate];
|
||||||
|
[tmpDate setTimeZone: utc];
|
||||||
|
|
||||||
|
return [tmpDate addYear: 0 month: 0 day: 0
|
||||||
|
hour: 0 minute: 0
|
||||||
|
second: [[self periodForDate: tmpDate] secondsOffsetFromGMT]];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjust multiple dates with respect to this vTimeZone.
|
||||||
|
* @param theDates an array of strings representing dates.
|
||||||
|
* @param an array of NSCalendarDate objects.
|
||||||
|
*/
|
||||||
|
- (NSMutableArray *) computedDatesForStrings: (NSArray *) theDates
|
||||||
|
{
|
||||||
|
NSCalendarDate *date;
|
||||||
|
NSMutableArray *dates;
|
||||||
|
NSEnumerator *dateList;
|
||||||
|
NSString *dateString;
|
||||||
|
|
||||||
|
dates = [NSMutableArray array];
|
||||||
|
dateList = [theDates objectEnumerator];
|
||||||
|
|
||||||
|
while ((dateString = [dateList nextObject]))
|
||||||
|
{
|
||||||
|
date = [self computedDateForString: dateString];
|
||||||
|
[dates addObject: date];
|
||||||
|
}
|
||||||
|
|
||||||
|
return dates;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) dateTimeStringForDate: (NSCalendarDate *) date
|
- (NSString *) dateTimeStringForDate: (NSCalendarDate *) date
|
||||||
{
|
{
|
||||||
return [[self computedDateForDate: date]
|
return [[self computedDateForDate: date]
|
||||||
|
|
|
@ -899,7 +899,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
// Calculate the occurrences for the given range
|
// Calculate the occurrences for the given range
|
||||||
rules = [cycleinfo objectForKey: @"rules"];
|
rules = [cycleinfo objectForKey: @"rules"];
|
||||||
exRules = [cycleinfo objectForKey: @"exRules"];
|
exRules = [cycleinfo objectForKey: @"exRules"];
|
||||||
exDates = [cycleinfo objectForKey: @"exDates"];
|
exDates = [eventTimeZone computedDatesForStrings: [cycleinfo objectForKey: @"exDates"]];
|
||||||
ranges = [iCalRecurrenceCalculator recurrenceRangesWithinCalendarDateRange: theRange
|
ranges = [iCalRecurrenceCalculator recurrenceRangesWithinCalendarDateRange: theRange
|
||||||
firstInstanceCalendarDateRange: firstRange
|
firstInstanceCalendarDateRange: firstRange
|
||||||
recurrenceRules: rules
|
recurrenceRules: rules
|
||||||
|
|
|
@ -118,6 +118,7 @@
|
||||||
NGCalendarDateRange *checkRange, *firstRange;
|
NGCalendarDateRange *checkRange, *firstRange;
|
||||||
NSCalendarDate *startDate, *endDate;
|
NSCalendarDate *startDate, *endDate;
|
||||||
iCalDateTime *firstStartDate;
|
iCalDateTime *firstStartDate;
|
||||||
|
iCalTimeZone *eventTimeZone;
|
||||||
BOOL doesOccur;
|
BOOL doesOccur;
|
||||||
|
|
||||||
doesOccur = [self isRecurrent];
|
doesOccur = [self isRecurrent];
|
||||||
|
@ -128,7 +129,8 @@
|
||||||
|
|
||||||
// Set the range to check with respect to the event timezone (extracted from the start date)
|
// Set the range to check with respect to the event timezone (extracted from the start date)
|
||||||
firstStartDate = (iCalDateTime *)[self uniqueChildWithTag: @"dtstart"];
|
firstStartDate = (iCalDateTime *)[self uniqueChildWithTag: @"dtstart"];
|
||||||
startDate = [[firstStartDate timeZone] computedDateForDate: theOccurenceDate];
|
eventTimeZone = [firstStartDate timeZone];
|
||||||
|
startDate = [eventTimeZone computedDateForDate: theOccurenceDate];
|
||||||
endDate = [startDate addTimeInterval: [self occurenceInterval]];
|
endDate = [startDate addTimeInterval: [self occurenceInterval]];
|
||||||
checkRange = [NGCalendarDateRange calendarDateRangeWithStartDate: startDate
|
checkRange = [NGCalendarDateRange calendarDateRangeWithStartDate: startDate
|
||||||
endDate: endDate];
|
endDate: endDate];
|
||||||
|
@ -138,7 +140,7 @@
|
||||||
firstInstanceCalendarDateRange: firstRange
|
firstInstanceCalendarDateRange: firstRange
|
||||||
recurrenceRules: [self recurrenceRules]
|
recurrenceRules: [self recurrenceRules]
|
||||||
exceptionRules: [self exceptionRules]
|
exceptionRules: [self exceptionRules]
|
||||||
exceptionDates: [self exceptionDates]];
|
exceptionDates: [self exceptionDatesWithEventTimeZone: eventTimeZone]];
|
||||||
doesOccur = [ranges dateRangeArrayContainsDate: startDate];
|
doesOccur = [ranges dateRangeArrayContainsDate: startDate];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue