Monotone-Parent: 3330b71df0d8c44d51c1026cc042cc4c911cff1a

Monotone-Revision: 06ef0619c58e045dce76e8be407e26af13e75aeb

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-06-07T16:24:20
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau 2007-06-07 16:24:20 +00:00
parent f58ab98f0d
commit a17ccf74c3
3 changed files with 31 additions and 4 deletions

View file

@ -1,5 +1,10 @@
2007-06-07 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2007-06-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalDateTime.m ([iCalDateTime -setDate:dateTime]): take the date
passed as parameter as an all day date.
([iCalDateTime -isAllDay]): new method determining whether the
current value is an all day value.
* NSString+NGCards.m ([NSString -isAllDayDate]): new method that * NSString+NGCards.m ([NSString -isAllDayDate]): new method that
determines whether the date represented in "self" is an all day determines whether the date represented in "self" is an all day
date (date only) or not (date + time). date (date only) or not (date + time).

View file

@ -33,9 +33,12 @@
- (void) setTimeZone: (iCalTimeZone *) iTZ; - (void) setTimeZone: (iCalTimeZone *) iTZ;
- (iCalTimeZone *) timeZone; - (iCalTimeZone *) timeZone;
- (void) setDate: (NSCalendarDate *) date;
- (void) setDateTime: (NSCalendarDate *) dateTime; - (void) setDateTime: (NSCalendarDate *) dateTime;
- (NSCalendarDate *) dateTime; - (NSCalendarDate *) dateTime;
- (BOOL) isAllDay;
@end @end
#endif /* ICALDATETIMEELEMENT_H */ #endif /* ICALDATETIMEELEMENT_H */

View file

@ -89,11 +89,12 @@
/* TODO: should implement the case where the TZ would be implicitly local /* TODO: should implement the case where the TZ would be implicitly local
(no TZID and no UTC) */ (no TZID and no UTC) */
- (void) setDateTime: (NSCalendarDate *) dateTime - (void) _setDateTime: (NSCalendarDate *) dateTime
forAllDayEntity: (BOOL) forAllDayEntity
{ {
NSCalendarDate *tmpTime; NSCalendarDate *tmpTime;
NSTimeZone *utcTZ; NSTimeZone *utcTZ;
NSString *timeString; NSString *timeString, *fmtTimeString;
iCalTimeZone *tz; iCalTimeZone *tz;
if (dateTime) if (dateTime)
@ -107,8 +108,11 @@
tmpTime = [dateTime copy]; tmpTime = [dateTime copy];
[tmpTime setTimeZone: utcTZ]; [tmpTime setTimeZone: utcTZ];
timeString = [NSString stringWithFormat: @"%@Z", if (forAllDayEntity)
[tmpTime iCalFormattedDateTimeString]]; fmtTimeString = [tmpTime iCalFormattedDateTimeString];
else
fmtTimeString = [tmpTime iCalFormattedDateString];
timeString = [NSString stringWithFormat: @"%@Z", fmtTimeString];
[tmpTime release]; [tmpTime release];
} }
} }
@ -118,6 +122,16 @@
[self setValue: 0 to: timeString]; [self setValue: 0 to: timeString];
} }
- (void) setDateTime: (NSCalendarDate *) dateTime
{
[self _setDateTime: dateTime forAllDayEntity: NO];
}
- (void) setDate: (NSCalendarDate *) dateTime
{
[self _setDateTime: dateTime forAllDayEntity: YES];
}
- (NSCalendarDate *) dateTime - (NSCalendarDate *) dateTime
{ {
iCalTimeZone *iTZ; iCalTimeZone *iTZ;
@ -152,4 +166,9 @@
return dateTime; return dateTime;
} }
- (BOOL) isAllDay
{
return [[self value: 0] isAllDayDate];
}
@end @end