Monotone-Parent: 8491f20b4bac3508e0839201c1e6756c5df21835

Monotone-Revision: 52de90085e2d18ded0d0c315e7148e1c72feb785

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-07-17T21:04:32
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2008-07-17 21:04:32 +00:00
parent 4a9c837741
commit e1beed1ba0
7 changed files with 68 additions and 18 deletions

View File

@ -49,7 +49,7 @@
- (void) addChild: (CardElement *) aChild; - (void) addChild: (CardElement *) aChild;
- (void) addChildren: (NSArray *) someChildren; - (void) addChildren: (NSArray *) someChildren;
- (NSArray *) children; - (NSMutableArray *) children;
- (CardElement *) firstChildWithTag: (NSString *) aTag; - (CardElement *) firstChildWithTag: (NSString *) aTag;
- (NSArray *) childrenWithTag: (NSString *) aTag; - (NSArray *) childrenWithTag: (NSString *) aTag;
- (NSArray *) childrenWithAttribute: (NSString *) anAttribute - (NSArray *) childrenWithAttribute: (NSString *) anAttribute

View File

@ -260,7 +260,7 @@ static NGCardsSaxHandler *sax = nil;
[self addChild: currentChild]; [self addChild: currentChild];
} }
- (NSArray *) children - (NSMutableArray *) children
{ {
return children; return children;
} }
@ -398,9 +398,20 @@ static NGCardsSaxHandler *sax = nil;
- (id) copyWithZone: (NSZone *) aZone - (id) copyWithZone: (NSZone *) aZone
{ {
CardGroup *new; CardGroup *new;
CardElement *newChild;
NSMutableArray *newChildren;
unsigned int count, max;
new = [super copyWithZone: aZone]; new = [super copyWithZone: aZone];
[new setChildrenAsCopy: [children copyWithZone: aZone]]; newChildren = [NSMutableArray new];
max = [children count];
for (count = 0; count < max; count++)
{
newChild = [[children objectAtIndex: count] copyWithZone: aZone];
[newChildren addObject: newChild];
}
[new setChildrenAsCopy: newChildren];
[newChildren release];
return new; return new;
} }
@ -410,9 +421,21 @@ static NGCardsSaxHandler *sax = nil;
- (id) mutableCopyWithZone: (NSZone *) aZone - (id) mutableCopyWithZone: (NSZone *) aZone
{ {
CardGroup *new; CardGroup *new;
CardElement *newChild;
NSMutableArray *newChildren;
unsigned int count, max;
new = [super mutableCopyWithZone: aZone]; new = [super mutableCopyWithZone: aZone];
[new setChildrenAsCopy: [children mutableCopyWithZone: aZone]]; newChildren = [NSMutableArray new];
max = [children count];
for (count = 0; count < max; count++)
{
newChild
= [[children objectAtIndex: count] mutableCopyWithZone: aZone];
[newChildren addObject: newChild];
}
[new setChildrenAsCopy: newChildren];
[newChildren release];
return new; return new;
} }

View File

@ -1,3 +1,17 @@
2008-07-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalRepeatableEntityObject.m ([iCalRepeatableEntityObject
-addToExceptionDates:_rdate]): the iCalDateTime argument was
replaced with NSCalendarDate.
* iCalEntityObject.m ([iCalEntityObject
-setOrganizer:_organizer]): now accepts a nil argument.
* CardGroup.m ([CardGroup -children]): now returns an NSMutableArray.
([CardGroup -copyWithZone:aZone])
([CardGroup -mutableCopyWithZone:aZone]): the children were not
properlty cloned, we thus clone them explicitly.
2008-07-16 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2008-07-16 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalDateTime.m ([iCalDateTime -setDate:dateTime]): don't set * iCalDateTime.m ([iCalDateTime -setDate:dateTime]): don't set

View File

@ -277,8 +277,13 @@
- (void) setOrganizer: (iCalPerson *) _organizer - (void) setOrganizer: (iCalPerson *) _organizer
{ {
[_organizer setTag: @"organizer"]; if (_organizer)
[self setUniqueChild: _organizer]; {
[_organizer setTag: @"organizer"];
[self setUniqueChild: _organizer];
}
else
[children removeObjectsInArray: [self childrenWithTag: @"organizer"]];
} }
- (iCalPerson *) organizer - (iCalPerson *) organizer

View File

@ -188,17 +188,19 @@ static Class yearlyCalcClass = Nil;
NSEnumerator *dates; NSEnumerator *dates;
NSCalendarDate *currentDate; NSCalendarDate *currentDate;
NGCalendarDateRange *currentRange; NGCalendarDateRange *currentRange;
int count, maxRanges; unsigned int count, maxRanges;
maxRanges = [ranges count];
dates = [[self _dates: exdates withinRange: limits] objectEnumerator]; dates = [[self _dates: exdates withinRange: limits] objectEnumerator];
while ((currentDate = [dates nextObject])) while ((currentDate = [dates nextObject]))
for (count = (maxRanges - 1); count > -1; count--) {
{ maxRanges = [ranges count];
currentRange = [ranges objectAtIndex: count]; for (count = maxRanges; count > 0; count--)
if ([currentRange containsDate: currentDate]) {
[ranges removeObjectAtIndex: count]; currentRange = [ranges objectAtIndex: count - 1];
} if ([currentRange containsDate: currentDate])
[ranges removeObjectAtIndex: count - 1];
}
}
} }
+ (NSArray *) + (NSArray *)

View File

@ -32,7 +32,7 @@
are VEVENT, VTODO and VJOURNAL. are VEVENT, VTODO and VJOURNAL.
*/ */
@class NSMutableArray, NGCalendarDateRange; @class NSCalendarDate, NSMutableArray, NGCalendarDateRange;
@interface iCalRepeatableEntityObject : iCalEntityObject @interface iCalRepeatableEntityObject : iCalEntityObject
// { // {
@ -53,7 +53,7 @@
- (NSArray *)exceptionRules; - (NSArray *)exceptionRules;
- (void)removeAllExceptionDates; - (void)removeAllExceptionDates;
- (void)addToExceptionDates:(id)_date; - (void)addToExceptionDates:(NSCalendarDate *)_date;
- (BOOL)hasExceptionDates; - (BOOL)hasExceptionDates;
- (NSArray *)exceptionDates; - (NSArray *)exceptionDates;

View File

@ -107,9 +107,15 @@
[children removeObjectsInArray: [self childrenWithTag: @"exdate"]]; [children removeObjectsInArray: [self childrenWithTag: @"exdate"]];
} }
- (void) addToExceptionDates: (id) _rdate - (void) addToExceptionDates: (NSCalendarDate *) _rdate
{ {
[self addChild: _rdate]; iCalDateTime *dateTime;
dateTime = [iCalDateTime new];
[dateTime setTag: @"exdate"];
[dateTime setDateTime: _rdate];
[self addChild: dateTime];
[dateTime release];
} }
- (void) setExceptionDates: (NSArray *) _rdates - (void) setExceptionDates: (NSArray *) _rdates