action = { class = NSString; };
priority = { class = NSString; };
status = { class = NSString; };
- transp = { class = NSString; };
+ transp = { class = NSString; key = transparency; };
sequence = { class = NSString; };
categories = { class = NSString; };
class = { class = NSString; key = accessClass; };
an appointment.
*/
-@class NSString, NSMutableArray, NSCalendarDate;
+@class NSString, NSMutableArray, NSCalendarDate, NGCalendarDateRange;
@class iCalPerson, iCalEventChanges;
@interface iCalEvent : iCalEntityObject
NSCalendarDate *endDate;
NSString *duration;
NSString *recurrenceRule;
+ NSString *transparency;
}
/* accessors */
- (void)setRecurrenceRule:(NSString *)_recurrenceRule;
- (NSString *)recurrenceRule;
+- (void)setTransparency:(NSString *)_transparency;
+- (NSString *)transparency;
+
+/* convenience */
+
+- (BOOL)isOpaque;
+- (BOOL)isAllDay;
+- (BOOL)isRecurrent;
+
+- (BOOL)isWithinCalendarDateRange:(NGCalendarDateRange *)_range;
+
/* calculating changes */
- (iCalEventChanges *)getChangesRelativeToEvent:(iCalEvent *)_event;
#include "iCalPerson.h"
#include "iCalEventChanges.h"
#include "iCalRenderer.h"
+#include <NGExtensions/NGCalendarDateRange.h>
#include "common.h"
@interface NSString(DurationTimeInterval)
return self->endDate ? YES : NO;
}
-- (void)setTransp:(NSString *)_transp {
- /* ignore transp ... (used by Evo 'TRANSP:OPAQUE') */
-}
-
- (void)setDuration:(NSString *)_value {
ASSIGNCOPY(self->duration, _value);
}
}
- (void)setRecurrenceRule:(NSString *)_recurrenceRule {
- ASSIGN(self->recurrenceRule, _recurrenceRule);
+ ASSIGNCOPY(self->recurrenceRule, _recurrenceRule);
}
- (NSString *)recurrenceRule {
return self->recurrenceRule;
}
+- (void)setTransparency:(NSString *)_transparency {
+ ASSIGNCOPY(self->transparency, _transparency);
+}
+- (NSString *)transparency {
+ return self->transparency;
+}
+
+/* convenience */
+
+- (BOOL)isOpaque {
+ NSString *s;
+
+ s = [self transparency];
+ if (s && [[s uppercaseString] isEqualToString:@"TRANSPARENT"])
+ return NO;
+ return YES; /* default is OPAQUE, see RFC2445, Section 4.8.2.7 */
+}
+
+/* TODO: FIX THIS!
+ NOTE: How do we find out if appointment is all day? Is this
+ 0:00 - 23:59 GMT??? How do other's handle this?
+*/
+- (BOOL)isAllDay {
+ if (![self hasEndDate])
+ return NO;
+ return NO;
+}
+
+- (BOOL)isRecurrent {
+ if ([self recurrenceRule])
+ return YES;
+ return NO;
+}
+
+/* TODO: FIX THIS FOR RECURRENCY! */
+- (BOOL)isWithinCalendarDateRange:(NGCalendarDateRange *)_range {
+ if (![self isRecurrent]) {
+ if (self->startDate && self->endDate) {
+ NGCalendarDateRange *r;
+
+ r = [NGCalendarDateRange calendarDateRangeWithStartDate:self->startDate
+ endDate:self->endDate];
+ return [_range containsDateRange:r];
+ }
+ else {
+ return [_range containsDate:self->startDate];
+ }
+ }
+ return NO;
+}
+
/* ical typing */
- (NSString *)entityName {