Allow multiple "attach" values in iCalEntityObject
parent
f449f0456b
commit
763ce37f8c
|
@ -94,8 +94,8 @@ typedef enum
|
||||||
- (void) increaseSequence;
|
- (void) increaseSequence;
|
||||||
|
|
||||||
/* url can either be set as NSString or NSURL */
|
/* url can either be set as NSString or NSURL */
|
||||||
- (void) setAttach: (id) _value;
|
- (void) setAttach: (NSArray *) _value;
|
||||||
- (NSURL *) attach;
|
- (NSArray *) attach;
|
||||||
- (void) setUrl: (id) _value;
|
- (void) setUrl: (id) _value;
|
||||||
- (NSURL *) url;
|
- (NSURL *) url;
|
||||||
|
|
||||||
|
|
|
@ -400,32 +400,49 @@
|
||||||
return [self childrenWithTag: @"valarm"];
|
return [self childrenWithTag: @"valarm"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setAttach: (id) _value
|
- (void) setAttach: (NSArray *) _value
|
||||||
{
|
{
|
||||||
NSString *aString;
|
NSString *aString;
|
||||||
|
id anObject;
|
||||||
|
int count, max;
|
||||||
|
|
||||||
if ([_value isKindOfClass: [NSString class]])
|
max = [_value count];
|
||||||
aString = _value;
|
for (count = 0; count < max; count++)
|
||||||
else if ([_value isKindOfClass: [NSURL class]])
|
{
|
||||||
aString = [_value absoluteString];
|
anObject = [_value objectAtIndex: count];
|
||||||
else
|
if ([anObject isKindOfClass: [NSURL class]])
|
||||||
aString = @"";
|
{
|
||||||
|
aString = [anObject absoluteString];
|
||||||
[[self uniqueChildWithTag: @"attach"] setSingleValue: aString forKey: @""];
|
}
|
||||||
|
else
|
||||||
|
aString = anObject;
|
||||||
|
[self addChild: [CardElement simpleElementWithTag: @"attach" value: aString]];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSURL *) attach
|
- (NSArray *) attach
|
||||||
{
|
{
|
||||||
|
NSArray *elements;
|
||||||
|
NSMutableArray *attachUrls;
|
||||||
NSString *stringAttach;
|
NSString *stringAttach;
|
||||||
NSURL *url;
|
NSURL *url;
|
||||||
|
int count, max;
|
||||||
|
|
||||||
stringAttach = [[self uniqueChildWithTag: @"attach"] flattenedValuesForKey: @""];
|
elements = [self childrenWithTag: @"attach"];
|
||||||
url = [NSURL URLWithString: stringAttach];
|
max = [elements count];
|
||||||
|
attachUrls = [NSMutableArray arrayWithCapacity: max];
|
||||||
|
for (count = 0; count < max; count++)
|
||||||
|
{
|
||||||
|
stringAttach = [[elements objectAtIndex: count] flattenedValuesForKey: @""];
|
||||||
|
url = [NSURL URLWithString: stringAttach];
|
||||||
|
|
||||||
if (!url && [stringAttach length] > 0)
|
if (!url && [stringAttach length] > 0)
|
||||||
url = [NSURL URLWithString: [NSString stringWithFormat: @"http://%@", stringAttach]];
|
url = [NSURL URLWithString: [NSString stringWithFormat: @"http://%@", stringAttach]];
|
||||||
|
|
||||||
|
[attachUrls addObject: [url absoluteString]];
|
||||||
|
}
|
||||||
|
|
||||||
return url;
|
return attachUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setUrl: (id) _value
|
- (void) setUrl: (id) _value
|
||||||
|
|
Loading…
Reference in New Issue