See ChangeLog.
Monotone-Parent: d6ace8d3429bf9ad569fff969474bd5aa01214ae Monotone-Revision: ae85556f790a11b8a40593a88822bee09e847d96 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2012-06-04T15:29:38maint-2.0.2
parent
33bb7e5556
commit
939eeba1f7
|
@ -1,3 +1,10 @@
|
|||
2012-06-04 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
* SoObjects/Appointments/SOGoAppointmentFolder.m
|
||||
(-_appendCycleException:firstInstanceCalendarDateRange:fromRow:forRange:withTimeZone:toArray:):
|
||||
adjust recurrence id according to timezone when dealing with a
|
||||
floating all-day event.
|
||||
|
||||
2012-06-01 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/NSString+Utilities.m
|
||||
|
|
|
@ -268,6 +268,8 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
// Example: timezone is -0400, date is 2012-05-24 (00:00:00 +0000),
|
||||
// and changes to 2012-05-24 04:00:00 +0000
|
||||
exDate = [dateString asCalendarDate];
|
||||
offset = [(NSTimeZone *) theTimeZone secondsFromGMTForDate: exDate];
|
||||
exDate = (NSCalendarDate *) [exDate dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
|
||||
|
|
|
@ -270,6 +270,8 @@ static NSArray *knownTimeZones;
|
|||
|
||||
/**
|
||||
* Adjust a date with respect to this vTimeZone.
|
||||
* Example: Timezone is -0400, the date is 2012-05-23 13:00:00 +0000:
|
||||
* it returns 2012-05-23 09:00:00 +0000
|
||||
* @param theDate the string representing a date.
|
||||
* @return a new GMT date adjusted with the offset of this timezone.
|
||||
*/
|
||||
|
|
|
@ -744,7 +744,7 @@ static NSNumber *sharedYes = nil;
|
|||
{
|
||||
currentRecord = [recordArray objectAtIndex: count];
|
||||
if ([[currentRecord objectForKey: @"startDate"]
|
||||
isEqual: matchDate])
|
||||
compare: matchDate] == NSOrderedSame)
|
||||
recordIndex = count;
|
||||
else
|
||||
count++;
|
||||
|
@ -773,18 +773,32 @@ static NSNumber *sharedYes = nil;
|
|||
firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||
fromRow: (NSDictionary *) row
|
||||
forRange: (NGCalendarDateRange *) dateRange
|
||||
withTimeZone: (NSTimeZone *) tz
|
||||
toArray: (NSMutableArray *) ma
|
||||
{
|
||||
NSCalendarDate *startDate, *recurrenceId;
|
||||
NSMutableDictionary *newRecord;
|
||||
NSDictionary *oldRecord;
|
||||
NGCalendarDateRange *newRecordRange;
|
||||
int recordIndex;
|
||||
NSComparisonResult compare;
|
||||
int recordIndex, secondsOffsetFromGMT;
|
||||
|
||||
newRecord = nil;
|
||||
recurrenceId = [component recurrenceId];
|
||||
|
||||
if ([dateRange containsDate: recurrenceId])
|
||||
if (tz)
|
||||
{
|
||||
// The following adjustment is necessary for floating all-day events.
|
||||
// For example, the recurrence-id 20120523T000000Z for timezone -0400
|
||||
// will become 20120523T000400Z
|
||||
secondsOffsetFromGMT = [tz secondsFromGMTForDate: recurrenceId];
|
||||
recurrenceId = (NSCalendarDate *) [recurrenceId dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
|
||||
seconds:-secondsOffsetFromGMT];
|
||||
}
|
||||
|
||||
compare = [[dateRange startDate] compare: recurrenceId];
|
||||
if ((compare == NSOrderedAscending || compare == NSOrderedSame) &&
|
||||
[[dateRange endDate] compare: recurrenceId] == NSOrderedDescending)
|
||||
{
|
||||
recordIndex = [self _indexOfRecordMatchingDate: recurrenceId
|
||||
inArray: ma];
|
||||
|
@ -799,6 +813,8 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
oldRecord = [ma objectAtIndex: recordIndex];
|
||||
[newRecord setObject: [oldRecord objectForKey: @"c_recurrence_id"]
|
||||
forKey: @"c_recurrence_id"];
|
||||
// [newRecord setObject: [NSNumber numberWithInt: [recurrenceId timeIntervalSince1970]]
|
||||
// forKey: @"c_recurrence_id"];
|
||||
|
||||
// The first instance date is added to the dictionary so it can
|
||||
// be used by UIxCalListingActions to compute the DST offset.
|
||||
|
@ -838,6 +854,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
- (void) _appendCycleExceptionsFromRow: (NSDictionary *) row
|
||||
firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||
forRange: (NGCalendarDateRange *) dateRange
|
||||
withTimeZone: (NSTimeZone *) tz
|
||||
toArray: (NSMutableArray *) ma
|
||||
{
|
||||
NSArray *elements, *components;
|
||||
|
@ -859,6 +876,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
firstInstanceCalendarDateRange: fir
|
||||
fromRow: row
|
||||
forRange: dateRange
|
||||
withTimeZone: tz
|
||||
toArray: ma];
|
||||
}
|
||||
}
|
||||
|
@ -877,20 +895,19 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
intoArray: (NSMutableArray *) theRecords
|
||||
{
|
||||
NSMutableDictionary *row, *fixedRow;
|
||||
NSMutableArray *records, *newExDates;
|
||||
NSMutableArray *records;
|
||||
NSDictionary *cycleinfo;
|
||||
NSEnumerator *exDatesList;
|
||||
NGCalendarDateRange *firstRange, *recurrenceRange, *oneRange;
|
||||
NSArray *rules, *exRules, *exDates, *ranges;
|
||||
NSArray *elements, *components;
|
||||
NSString *content;
|
||||
NSCalendarDate *checkStartDate, *checkEndDate, *firstStartDate,
|
||||
*firstEndDate;
|
||||
NSCalendarDate *checkStartDate, *checkEndDate, *firstStartDate, *firstEndDate;
|
||||
NSTimeZone *allDayTimeZone;
|
||||
iCalDateTime *dtstart;
|
||||
iCalEvent *component;
|
||||
iCalTimeZone *eventTimeZone;
|
||||
unsigned count, max, offset;
|
||||
id exDate;
|
||||
id tz;
|
||||
|
||||
content = [theRecord objectForKey: @"c_cycleinfo"];
|
||||
if (![content isNotNull])
|
||||
|
@ -910,6 +927,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
rules = [cycleinfo objectForKey: @"rules"];
|
||||
exRules = [cycleinfo objectForKey: @"exRules"];
|
||||
exDates = [cycleinfo objectForKey: @"exDates"];
|
||||
eventTimeZone = allDayTimeZone = tz = nil;
|
||||
|
||||
row = [self fixupRecord: theRecord];
|
||||
[row removeObjectForKey: @"c_cycleinfo"];
|
||||
|
@ -945,12 +963,6 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
recurrenceRange = [NGCalendarDateRange calendarDateRangeWithStartDate: checkStartDate
|
||||
endDate: checkEndDate];
|
||||
|
||||
// Adjust the exception dates
|
||||
exDates = [eventTimeZone computedDatesForStrings: exDates];
|
||||
|
||||
// Adjust the recurrence rules "until" dates
|
||||
rules = [component recurrenceRulesWithTimeZone: eventTimeZone];
|
||||
exRules = [component exceptionRulesWithTimeZone: eventTimeZone];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -959,27 +971,28 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
{
|
||||
// The event lasts all-day and has no timezone (floating); we convert the range of the first event
|
||||
// to the user's timezone
|
||||
offset = [timeZone secondsFromGMTForDate: [firstRange startDate]];
|
||||
allDayTimeZone = timeZone;
|
||||
offset = [allDayTimeZone secondsFromGMTForDate: [firstRange startDate]];
|
||||
firstStartDate = [[firstRange startDate] dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
|
||||
seconds:-offset];
|
||||
firstEndDate = [[firstRange endDate] dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
|
||||
seconds:-offset];
|
||||
[firstStartDate setTimeZone: timeZone];
|
||||
[firstEndDate setTimeZone: timeZone];
|
||||
[firstStartDate setTimeZone: allDayTimeZone];
|
||||
[firstEndDate setTimeZone: allDayTimeZone];
|
||||
firstRange = [NGCalendarDateRange calendarDateRangeWithStartDate: firstStartDate
|
||||
endDate: firstEndDate];
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust the exception dates
|
||||
exDatesList = [exDates objectEnumerator];
|
||||
newExDates = [NSMutableArray arrayWithCapacity: [exDates count]];
|
||||
while ((exDate = [exDatesList nextObject]))
|
||||
tz = eventTimeZone? eventTimeZone : allDayTimeZone;
|
||||
if (tz)
|
||||
{
|
||||
exDate = [[exDate asCalendarDate] dateByAddingYears:0 months:0 days:0 hours:0 minutes:0
|
||||
seconds:-offset];
|
||||
[newExDates addObject: exDate];
|
||||
}
|
||||
exDates = newExDates;
|
||||
}
|
||||
// Adjust the exception dates
|
||||
exDates = [component exceptionDatesWithTimeZone: tz];
|
||||
|
||||
// Adjust the recurrence rules "until" dates
|
||||
rules = [component recurrenceRulesWithTimeZone: tz];
|
||||
exRules = [component exceptionRulesWithTimeZone: tz];
|
||||
}
|
||||
|
||||
// Calculate the occurrences for the given range
|
||||
|
@ -1004,6 +1017,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
|||
[self _appendCycleExceptionsFromRow: row
|
||||
firstInstanceCalendarDateRange: firstRange
|
||||
forRange: theRange
|
||||
withTimeZone: allDayTimeZone
|
||||
toArray: records];
|
||||
|
||||
[theRecords addObjectsFromArray: records];
|
||||
|
|
|
@ -513,7 +513,7 @@
|
|||
[dateFormatter formattedTime: eventStartDate], @"startTime",
|
||||
[dateFormatter formattedDate: eventEndDate], @"endDate",
|
||||
[dateFormatter formattedTime: eventEndDate], @"endTime",
|
||||
([event hasRecurrenceRules] ? @"1": @"0"), @"isRecurring",
|
||||
//([event hasRecurrenceRules] ? @"1": @"0"), @"isRecurring",
|
||||
([event isAllDay] ? @"1": @"0"), @"isAllDay",
|
||||
[event summary], @"summary",
|
||||
[event location], @"location",
|
||||
|
|
Loading…
Reference in New Issue