See Changelog

Monotone-Parent: be2d77f6c4881e75bb24c06d7eec7e0a2869a643
Monotone-Revision: 99ea9ff62c0f957853593872fbc025892f52f11b

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2010-09-28T16:07:58
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Francis Lachapelle 2010-09-28 16:07:58 +00:00
parent addca0f1b7
commit 572122703f
5 changed files with 70 additions and 27 deletions

View File

@ -1,3 +1,16 @@
2010-09-28 Francis Lachapelle <flachapelle@inverse.ca>
* NSString+NGCards.m (-asCalendarDate): added handling of date that
includes dashes (YYYY-MM-DD).
* iCalDateTime.m (-dateTimes): new method that handles EXDATE with
multiple values.
* iCalRepeatableEntityObject.m (-exceptionDates): add all values
from each EXDATE attribute.
* iCalRepeatableEntityObject.m (-exceptionDates): idem.
2010-08-30 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2010-08-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalPerson.m, iCalWeeklyRecurrenceCalculator.m: adapted classes * iCalPerson.m, iCalWeeklyRecurrenceCalculator.m: adapted classes

View File

@ -1,6 +1,6 @@
/* NSString+NGCards.m - this file is part of SOPE /* NSString+NGCards.m - this file is part of SOPE
* *
* Copyright (C) 2006-2009 Inverse inc. * Copyright (C) 2006-2010 Inverse inc.
* *
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca> * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* *
@ -246,8 +246,12 @@ static NSString *commaSeparator = nil;
year = [[self substringWithRange: cursor] intValue]; year = [[self substringWithRange: cursor] intValue];
cursor.location += cursor.length; cursor.location += cursor.length;
cursor.length = 2; cursor.length = 2;
if ([[self substringWithRange: cursor] hasPrefix: @"-"])
cursor.location += 1;
month = [[self substringWithRange: cursor] intValue]; month = [[self substringWithRange: cursor] intValue];
cursor.location += cursor.length; cursor.location += cursor.length;
if ([[self substringWithRange: cursor] hasPrefix: @"-"])
cursor.location += 1;
day = [[self substringWithRange: cursor] intValue]; day = [[self substringWithRange: cursor] intValue];
if (length > 14) if (length > 14)

View File

@ -35,6 +35,8 @@
- (void) setDate: (NSCalendarDate *) date; - (void) setDate: (NSCalendarDate *) date;
- (void) setDateTime: (NSCalendarDate *) dateTime; - (void) setDateTime: (NSCalendarDate *) dateTime;
- (NSArray *) dateTimes;
- (NSCalendarDate *) dateTime; - (NSCalendarDate *) dateTime;
- (BOOL) isAllDay; - (BOOL) isAllDay;

View File

@ -20,6 +20,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h> #import <Foundation/NSString.h>
#import <Foundation/NSTimeZone.h> #import <Foundation/NSTimeZone.h>
@ -150,37 +151,51 @@
} }
- (NSCalendarDate *) dateTime - (NSCalendarDate *) dateTime
{
return [[self dateTimes] lastObject];
}
- (NSArray *) dateTimes
{ {
iCalTimeZone *iTZ; iCalTimeZone *iTZ;
NSString *date; NSString *date;
NSCalendarDate *initialDate, *dateTime; NSCalendarDate *initialDate, *dateTime;
NSMutableArray *dates;
NSTimeZone *tz; NSTimeZone *tz;
unsigned count, i;
date = [self value: 0]; count = [[self values] count];
iTZ = [self timeZone]; dates = [NSMutableArray arrayWithCapacity: count];
if (iTZ) for (i = 0; i < count; i++)
dateTime = [iTZ dateForDateTimeString: date];
else
{ {
initialDate = [date asCalendarDate]; date = [self value: i];
if (initialDate) iTZ = [self timeZone];
{ if (iTZ)
if ([date hasSuffix: @"Z"] || [date hasSuffix: @"z"]) dateTime = [iTZ dateForDateTimeString: date];
dateTime = initialDate;
else
{
/* same TODO as above */
tz = [NSTimeZone defaultTimeZone];
dateTime = [initialDate addYear: 0 month: 0 day: 0
hour: 0 minute: 0
second: -[tz secondsFromGMTForDate: initialDate]];
}
}
else else
dateTime = nil; {
initialDate = [date asCalendarDate];
if (initialDate)
{
if ([date hasSuffix: @"Z"] || [date hasSuffix: @"z"])
dateTime = initialDate;
else
{
/* same TODO as above */
tz = [NSTimeZone defaultTimeZone];
dateTime = [initialDate addYear: 0 month: 0 day: 0
hour: 0 minute: 0
second: -[tz secondsFromGMTForDate: initialDate]];
}
}
else
dateTime = nil;
}
if (dateTime)
[dates addObject: dateTime];
} }
return dateTime; return dates;
} }
- (BOOL) isAllDay - (BOOL) isAllDay

View File

@ -1,5 +1,6 @@
/* /*
Copyright (C) 2004-2005 SKYRIX Software AG Copyright (C) 2004-2005 SKYRIX Software AG
Copyright (C) 2010 Inverse inc.
This file is part of SOPE. This file is part of SOPE.
@ -131,18 +132,26 @@
- (NSArray *) exceptionDates - (NSArray *) exceptionDates
{ {
NSArray *exDates;
NSMutableArray *dates; NSMutableArray *dates;
NSEnumerator *dateList; NSEnumerator *dateList;
NSCalendarDate *exDate; NSCalendarDate *exDate;
NSString *dateString; NSString *dateString;
unsigned i;
dates = [NSMutableArray array]; dates = [NSMutableArray array];
dateList = [[self childrenWithTag: @"exdate"] objectEnumerator]; dateList = [[self childrenWithTag: @"exdate"] objectEnumerator];
while ((exDate = [[dateList nextObject] dateTime]))
while ((dateString = [dateList nextObject]))
{ {
dateString = [NSString stringWithFormat: @"%@Z", exDates = [(iCalDateTime*) dateString dateTimes];
[exDate iCalFormattedDateTimeString]]; for (i = 0; i < [exDates count]; i++)
[dates addObject: dateString]; {
exDate = [exDates objectAtIndex: i];
dateString = [NSString stringWithFormat: @"%@Z",
[exDate iCalFormattedDateTimeString]];
[dates addObject: dateString];
}
} }
return dates; return dates;