From: znek Date: Thu, 16 Dec 2004 14:33:06 +0000 (+0000) Subject: Added transparency and added convenience methods X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=383b4476ea461a6f035643c367c2e70aef9588d5;p=sope Added transparency and added convenience methods git-svn-id: http://svn.opengroupware.org/SOPE/trunk@449 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-ical/NGiCal/ChangeLog b/sope-ical/NGiCal/ChangeLog index fb33578f..ec3e4cd0 100644 --- a/sope-ical/NGiCal/ChangeLog +++ b/sope-ical/NGiCal/ChangeLog @@ -1,3 +1,12 @@ +2004-12-16 Marcus Mueller + + * v4.5.37 + + * iCalEvent.[hm]: Added transparency 'TRANSP'. Also multiple + convenience methods provided. + + * NGiCal.xmap: added proper mapping for 'transp'. + 2004-12-14 Marcus Mueller * NGiCal.xcode: minor changes and updated diff --git a/sope-ical/NGiCal/NGiCal.xmap b/sope-ical/NGiCal/NGiCal.xmap index 0f605543..61521b5f 100644 --- a/sope-ical/NGiCal/NGiCal.xmap +++ b/sope-ical/NGiCal/NGiCal.xmap @@ -171,7 +171,7 @@ 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; }; diff --git a/sope-ical/NGiCal/Version b/sope-ical/NGiCal/Version index 32c124be..6329c0fc 100644 --- a/sope-ical/NGiCal/Version +++ b/sope-ical/NGiCal/Version @@ -2,4 +2,6 @@ MAJOR_VERSION=4 MINOR_VERSION=5 -SUBMINOR_VERSION:=36 +SUBMINOR_VERSION:=37 + +# v4.5.37 requires NGExtensions v4.5.140 diff --git a/sope-ical/NGiCal/iCalEvent.h b/sope-ical/NGiCal/iCalEvent.h index 63e9d0e0..040fc12f 100644 --- a/sope-ical/NGiCal/iCalEvent.h +++ b/sope-ical/NGiCal/iCalEvent.h @@ -32,7 +32,7 @@ an appointment. */ -@class NSString, NSMutableArray, NSCalendarDate; +@class NSString, NSMutableArray, NSCalendarDate, NGCalendarDateRange; @class iCalPerson, iCalEventChanges; @interface iCalEvent : iCalEntityObject @@ -40,6 +40,7 @@ NSCalendarDate *endDate; NSString *duration; NSString *recurrenceRule; + NSString *transparency; } /* accessors */ @@ -56,6 +57,17 @@ - (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; diff --git a/sope-ical/NGiCal/iCalEvent.m b/sope-ical/NGiCal/iCalEvent.m index dcfbf754..4142c5fd 100644 --- a/sope-ical/NGiCal/iCalEvent.m +++ b/sope-ical/NGiCal/iCalEvent.m @@ -23,6 +23,7 @@ #include "iCalPerson.h" #include "iCalEventChanges.h" #include "iCalRenderer.h" +#include #include "common.h" @interface NSString(DurationTimeInterval) @@ -62,10 +63,6 @@ return self->endDate ? YES : NO; } -- (void)setTransp:(NSString *)_transp { - /* ignore transp ... (used by Evo 'TRANSP:OPAQUE') */ -} - - (void)setDuration:(NSString *)_value { ASSIGNCOPY(self->duration, _value); } @@ -108,12 +105,63 @@ } - (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 {