See ChangeLog

Monotone-Parent: ccbc02cbbccf4d53a21e791dc3aa318d85eb34a9
Monotone-Revision: e32cb5a49f7eb94c778c878808a9abcb69576a80

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2009-03-16T21:21:43
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle
2009-03-16 21:21:43 +00:00
parent 4a13bc463c
commit a8cd172a6b
4 changed files with 78 additions and 30 deletions
+15 -29
View File
@@ -578,20 +578,20 @@ static Class sogoAppointmentFolderKlass = Nil;
return md;
}
- (NSArray *) fixupRecords: (NSArray *) records
- (NSArray *) fixupRecords: (NSArray *) theRecords
{
// TODO: is the result supposed to be sorted by date?
NSMutableArray *ma;
unsigned count, max;
id row; // TODO: what is the type of the record?
if (records)
if (theRecords)
{
max = [records count];
max = [theRecords count];
ma = [NSMutableArray arrayWithCapacity: max];
for (count = 0; count < max; count++)
{
row = [self fixupRecord: [records objectAtIndex: count]];
row = [self fixupRecord: [theRecords objectAtIndex: count]];
if (row)
[ma addObject: row];
}
@@ -610,43 +610,31 @@ static Class sogoAppointmentFolderKlass = Nil;
NSMutableDictionary *md;
NSNumber *dateSecs;
id tmp;
signed int daylightOffset;
md = [[_record mutableCopy] autorelease];
daylightOffset = 0;
/* cycle is in _r. We also have to override the c_startdate/c_enddate with the date values of
the reccurence since we use those when displaying events in SOGo Web */
tmp = [_r startDate];
if ([timeZone isDaylightSavingTimeForDate: tmp] != [timeZone isDaylightSavingTimeForDate: [_viewRange startDate]])
// For the event's start/end dates, compute the daylight saving time
// offset with respect to the view period.
daylightOffset = (signed int)[timeZone secondsFromGMTForDate: tmp]
- (signed int)[timeZone secondsFromGMTForDate: [_viewRange startDate]];
tmp = [_r startDate];
[tmp setTimeZone: timeZone];
[md setObject: tmp forKey: @"startDate"];
dateSecs = [NSNumber numberWithInt: [tmp timeIntervalSince1970] + daylightOffset];
dateSecs = [NSNumber numberWithInt: [tmp timeIntervalSince1970]];
[md setObject: dateSecs forKey: @"c_startdate"];
tmp = [_r endDate];
[tmp setTimeZone: timeZone];
[md setObject: tmp forKey: @"endDate"];
dateSecs = [NSNumber numberWithInt: [tmp timeIntervalSince1970] + daylightOffset];
dateSecs = [NSNumber numberWithInt: [tmp timeIntervalSince1970]];
[md setObject: dateSecs forKey: @"c_enddate"];
tmp = [_r startDate];
if ([timeZone isDaylightSavingTimeForDate: tmp] != [timeZone isDaylightSavingTimeForDate: [_fir startDate]])
// For the event's recurrence id, compute the daylight saving time
// offset with respect to the first occurrence of the recurring event.
daylightOffset = (signed int)[timeZone secondsFromGMTForDate: tmp]
- (signed int)[timeZone secondsFromGMTForDate: [_fir startDate]];
else
daylightOffset = 0;
dateSecs = [NSNumber numberWithInt: [tmp timeIntervalSince1970] + daylightOffset];
dateSecs = [NSNumber numberWithInt: [tmp timeIntervalSince1970]];
[md setObject: dateSecs forKey: @"c_recurrence_id"];
tmp = [_fir startDate];
[md setObject: tmp forKey: @"cycleStartDate"];
return md;
}
@@ -657,7 +645,6 @@ static Class sogoAppointmentFolderKlass = Nil;
NSDictionary *currentRecord;
recordIndex = -1;
count = 0;
max = [recordArray count];
while (recordIndex == -1 && count < max)
@@ -729,6 +716,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
oldRecord = [ma objectAtIndex: recordIndex];
[newRecord setObject: [oldRecord objectForKey: @"c_recurrence_id"]
forKey: @"c_recurrence_id"];
[newRecord setObject: [fir startDate] forKey: @"cycleStartDate"];
[ma replaceObjectAtIndex: recordIndex withObject: newRecord];
}
else
@@ -742,11 +730,9 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
else
{
newRecord = [self fixupRecord: [component quickRecord]];
newRecordRange = [NGCalendarDateRange calendarDateRangeWithStartDate:
[newRecord objectForKey:
@"startDate"]
endDate: [newRecord objectForKey:
@"endDate"]];
newRecordRange = [NGCalendarDateRange
calendarDateRangeWithStartDate: [newRecord objectForKey: @"startDate"]
endDate: [newRecord objectForKey: @"endDate"]];
if ([dateRange doesIntersectWithDateRange: newRecordRange])
[ma addObject: newRecord];
}
@@ -249,7 +249,7 @@ _occurenceHasID (iCalRepeatableEntityObject *occurence, NSString *recID)
recDate = [NSCalendarDate dateWithTimeIntervalSince1970: [recID intValue]];
masterOccurence = [self component: NO secure: NO];
if ([masterOccurence doesOccurOnDate: recDate])
{
newOccurence = [masterOccurence mutableCopy];