See SOPE/NGCards/ChangeLog.
Monotone-Parent: 99dc7d9dce88b8a323b1e7aab60de99ed2bfda60 Monotone-Revision: d29498142c4a9f1d780373bd5f0d80b17f6e2c33 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2012-05-30T11:34:24maint-2.0.2
parent
d6f0203351
commit
d98db782b3
|
@ -1,3 +1,9 @@
|
|||
2012-05-30 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
* iCalRepeatableEntityObject.m (-exceptionDatesWithTimeZone:)
|
||||
(-rules:withTimeZone:): exception dates and exception rules must
|
||||
also be adjusted for floating all-day repeating events.
|
||||
|
||||
2012-05-29 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
* iCalRecurrenceCalculator.m
|
||||
|
|
|
@ -201,7 +201,9 @@ static Class yearlyCalcClass = Nil;
|
|||
compare = [[currentRange startDate] compare: currentDate];
|
||||
if ((compare == NSOrderedAscending || compare == NSOrderedSame) &&
|
||||
[[currentRange endDate] compare: currentDate] == NSOrderedDescending)
|
||||
[ranges removeObjectAtIndex: count - 1];
|
||||
{
|
||||
[ranges removeObjectAtIndex: count - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,21 +42,21 @@
|
|||
- (void)setRecurrenceRules:(NSArray *)_rrule;
|
||||
- (BOOL)hasRecurrenceRules;
|
||||
- (NSArray *)recurrenceRules;
|
||||
- (NSArray *)recurrenceRulesWithTimeZone: (iCalTimeZone *) timezone;
|
||||
- (NSArray *)recurrenceRulesWithTimeZone: (id) timezone;
|
||||
|
||||
- (void)removeAllExceptionRules;
|
||||
- (void)addToExceptionRules:(id)_rrule;
|
||||
- (BOOL)hasExceptionRules;
|
||||
- (NSArray *)exceptionRules;
|
||||
- (NSArray *)exceptionRulesWithTimeZone: (iCalTimeZone *) timezone;
|
||||
- (NSArray *)exceptionRulesWithTimeZone: (id) timezone;
|
||||
|
||||
- (void)removeAllExceptionDates;
|
||||
- (void)addToExceptionDates:(NSCalendarDate *)_date;
|
||||
- (BOOL)hasExceptionDates;
|
||||
- (NSArray *)exceptionDates;
|
||||
- (NSArray *)exceptionDatesWithTimeZone: (iCalTimeZone*) theTimeZone;
|
||||
- (NSArray *)exceptionDatesWithTimeZone: (id) theTimeZone;
|
||||
|
||||
- (NSArray *) rules: (NSArray *) theRules withTimeZone: (iCalTimeZone *) theTimeZone;
|
||||
- (NSArray *) rules: (NSArray *) theRules withTimeZone: (id) theTimeZone;
|
||||
|
||||
- (BOOL)isRecurrent;
|
||||
- (BOOL)isWithinCalendarDateRange:(NGCalendarDateRange *)_range
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
||||
Copyright (C) 2011 Inverse inc.
|
||||
Copyright (C) 2012 Inverse inc.
|
||||
|
||||
This file is part of SOPE.
|
||||
|
||||
|
@ -24,10 +24,12 @@
|
|||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
|
||||
#import <NGExtensions/NGCalendarDateRange.h>
|
||||
|
||||
#import "NSCalendarDate+NGCards.h"
|
||||
#import "NSString+NGCards.h"
|
||||
#import "iCalDateTime.h"
|
||||
#import "iCalEvent.h"
|
||||
#import "iCalTimeZone.h"
|
||||
|
@ -79,7 +81,7 @@
|
|||
return [self childrenWithTag: @"rrule"];
|
||||
}
|
||||
|
||||
- (NSArray *) recurrenceRulesWithTimeZone: (iCalTimeZone *) timezone
|
||||
- (NSArray *) recurrenceRulesWithTimeZone: (id) timezone
|
||||
{
|
||||
NSArray *rules;
|
||||
|
||||
|
@ -113,7 +115,7 @@
|
|||
return [self childrenWithTag: @"exrule"];
|
||||
}
|
||||
|
||||
- (NSArray *) exceptionRulesWithTimeZone: (iCalTimeZone *) timezone
|
||||
- (NSArray *) exceptionRulesWithTimeZone: (id) timezone
|
||||
{
|
||||
NSArray *rules;
|
||||
|
||||
|
@ -131,12 +133,13 @@
|
|||
* @see exceptionRulesWithTimeZone:
|
||||
* @return a new array of iCalRecurrenceRule instances, adjusted for the timezone.
|
||||
*/
|
||||
- (NSArray *) rules: (NSArray *) theRules withTimeZone: (iCalTimeZone *) theTimeZone
|
||||
- (NSArray *) rules: (NSArray *) theRules withTimeZone: (id) theTimeZone
|
||||
{
|
||||
NSArray *rules;
|
||||
NSCalendarDate *untilDate;
|
||||
NSMutableArray *fixedRules;
|
||||
iCalRecurrenceRule *currentRule;
|
||||
int offset;
|
||||
unsigned int max, count;
|
||||
|
||||
rules = theRules;
|
||||
|
@ -152,7 +155,14 @@
|
|||
untilDate = [currentRule untilDate];
|
||||
if (untilDate)
|
||||
{
|
||||
untilDate = [theTimeZone computedDateForDate: untilDate];
|
||||
if ([theTimeZone isKindOfClass: [iCalTimeZone class]])
|
||||
untilDate = [(iCalTimeZone *) theTimeZone computedDateForDate: untilDate];
|
||||
else
|
||||
{
|
||||
offset = [(NSTimeZone *) theTimeZone secondsFromGMTForDate: untilDate];
|
||||
untilDate = (NSCalendarDate *) [untilDate dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
|
||||
seconds:-offset];
|
||||
}
|
||||
[currentRule setUntilDate: untilDate];
|
||||
}
|
||||
[fixedRules addObject: currentRule];
|
||||
|
@ -232,12 +242,13 @@
|
|||
* @see [iCalTimeZone computedDatesForStrings:]
|
||||
* @return the exception dates, adjusted to the timezone.
|
||||
*/
|
||||
- (NSArray *) exceptionDatesWithTimeZone: (iCalTimeZone *) theTimeZone
|
||||
- (NSArray *) exceptionDatesWithTimeZone: (id) theTimeZone
|
||||
{
|
||||
NSArray *dates, *exDates;
|
||||
NSEnumerator *dateList;
|
||||
NSCalendarDate *exDate;
|
||||
NSString *dateString;
|
||||
int offset;
|
||||
unsigned i;
|
||||
|
||||
if (theTimeZone)
|
||||
|
@ -251,9 +262,19 @@
|
|||
for (i = 0; i < [exDates count]; i++)
|
||||
{
|
||||
dateString = [exDates objectAtIndex: i];
|
||||
exDate = [theTimeZone computedDateForString: dateString];
|
||||
if ([theTimeZone isKindOfClass: [iCalTimeZone class]])
|
||||
{
|
||||
exDate = [(iCalTimeZone *) theTimeZone computedDateForString: dateString];
|
||||
}
|
||||
else
|
||||
{
|
||||
exDate = [dateString asCalendarDate];
|
||||
offset = [(NSTimeZone *) theTimeZone secondsFromGMTForDate: exDate];
|
||||
exDate = (NSCalendarDate *) [exDate dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
|
||||
seconds:-offset];
|
||||
}
|
||||
[(NSMutableArray *) dates addObject: exDate];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -125,9 +125,7 @@
|
|||
NSArray *ranges;
|
||||
NGCalendarDateRange *checkRange, *firstRange;
|
||||
NSCalendarDate *startDate, *endDate;
|
||||
NSTimeZone *timeZone;
|
||||
id firstStartDate, firstEndDate;
|
||||
iCalTimeZone *eventTimeZone;
|
||||
id firstStartDate, firstEndDate, timeZone;
|
||||
BOOL doesOccur;
|
||||
int offset;
|
||||
|
||||
|
@ -139,9 +137,11 @@
|
|||
|
||||
// Set the range to check with respect to the event timezone (extracted from the start date)
|
||||
firstStartDate = (iCalDateTime *)[self uniqueChildWithTag: @"dtstart"];
|
||||
eventTimeZone = [(iCalDateTime *)firstStartDate timeZone];
|
||||
if (eventTimeZone)
|
||||
startDate = [eventTimeZone computedDateForDate: theOccurenceDate];
|
||||
timeZone = [(iCalDateTime *)firstStartDate timeZone];
|
||||
if (timeZone)
|
||||
{
|
||||
startDate = [(iCalTimeZone *)timeZone computedDateForDate: theOccurenceDate];
|
||||
}
|
||||
else
|
||||
{
|
||||
startDate = theOccurenceDate;
|
||||
|
@ -150,13 +150,14 @@
|
|||
// The event lasts all-day and has no timezone (floating); we convert the range of the first event
|
||||
// to the occurence's timezone.
|
||||
timeZone = [theOccurenceDate timeZone];
|
||||
offset = [timeZone secondsFromGMTForDate: [firstRange startDate]];
|
||||
offset = [(NSTimeZone *)timeZone secondsFromGMTForDate: [firstRange startDate]];
|
||||
firstStartDate = (NSCalendarDate *)[[firstRange startDate] dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
|
||||
seconds:-offset];
|
||||
firstEndDate = (NSCalendarDate *)[[firstRange endDate] dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
|
||||
seconds:-offset];
|
||||
[(NSCalendarDate *)firstStartDate setTimeZone: timeZone];
|
||||
[(NSCalendarDate *)firstEndDate setTimeZone: timeZone];
|
||||
|
||||
firstRange = [NGCalendarDateRange calendarDateRangeWithStartDate: firstStartDate
|
||||
endDate: firstEndDate];
|
||||
}
|
||||
|
@ -168,9 +169,9 @@
|
|||
// Calculate the occurrences for the given date
|
||||
ranges = [iCalRecurrenceCalculator recurrenceRangesWithinCalendarDateRange: checkRange
|
||||
firstInstanceCalendarDateRange: firstRange
|
||||
recurrenceRules: [self recurrenceRulesWithTimeZone: eventTimeZone]
|
||||
exceptionRules: [self exceptionRulesWithTimeZone: eventTimeZone]
|
||||
exceptionDates: [self exceptionDatesWithTimeZone: eventTimeZone]];
|
||||
recurrenceRules: [self recurrenceRulesWithTimeZone: timeZone]
|
||||
exceptionRules: [self exceptionRulesWithTimeZone: timeZone]
|
||||
exceptionDates: [self exceptionDatesWithTimeZone: timeZone]];
|
||||
doesOccur = [ranges dateRangeArrayContainsDate: startDate];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue