]> err.no Git - sope/commitdiff
Added transparency and added convenience methods
authorznek <znek@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 16 Dec 2004 14:33:06 +0000 (14:33 +0000)
committerznek <znek@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Thu, 16 Dec 2004 14:33:06 +0000 (14:33 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@449 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-ical/NGiCal/ChangeLog
sope-ical/NGiCal/NGiCal.xmap
sope-ical/NGiCal/Version
sope-ical/NGiCal/iCalEvent.h
sope-ical/NGiCal/iCalEvent.m

index fb33578f80a65a070cd2947347230a36dd4f0dbe..ec3e4cd09cf8a45a2c6c6c1546d2ecfc0a6621a5 100644 (file)
@@ -1,3 +1,12 @@
+2004-12-16  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * 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  <znek@mulle-kybernetik.com>
 
        * NGiCal.xcode: minor changes and updated
index 0f605543f8b76b11c8bf5611923cd98feec83994..61521b5fa45c44b5fc4fbe97236aaaa027db1ddc 100644 (file)
     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; };
index 32c124be4da81454426d9cf8cf1c4e966688a833..6329c0fc8dd6ebe5425d838d5f7af688fbbe8491 100644 (file)
@@ -2,4 +2,6 @@
 
 MAJOR_VERSION=4
 MINOR_VERSION=5
-SUBMINOR_VERSION:=36
+SUBMINOR_VERSION:=37
+
+# v4.5.37 requires NGExtensions v4.5.140
index 63e9d0e0d8cc0128dc39e2943212cddd5ccbf14d..040fc12f8e3ddbd6a38a996e5e27d5d1aa6c95ed 100644 (file)
@@ -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 */
 - (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;
index dcfbf754ae42bc85c60ea3ce5e3b81509122aecd..4142c5fd65c7dd5dc8ea8174eb067d5d485932e2 100644 (file)
@@ -23,6 +23,7 @@
 #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 {