From 128edbc07587a0b1af9fb104c4332d65a3cc92d6 Mon Sep 17 00:00:00 2001 From: helge Date: Fri, 15 Jul 2005 10:01:29 +0000 Subject: [PATCH] rewrote mail iCal viewer not to use SOGoAppointment (but iCalEvent) git-svn-id: http://svn.opengroupware.org/SOGo/trunk@774 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/MailPartViewers/ChangeLog | 5 ++ .../MailPartViewers/UIxMailPartICalViewer.m | 64 ++++++++++++++----- SOGo/UI/MailPartViewers/Version | 3 +- .../MailPartViewers/UIxMailPartICalViewer.wox | 34 ++++++---- 4 files changed, 75 insertions(+), 31 deletions(-) diff --git a/SOGo/UI/MailPartViewers/ChangeLog b/SOGo/UI/MailPartViewers/ChangeLog index 62bfd39f..852facbf 100644 --- a/SOGo/UI/MailPartViewers/ChangeLog +++ b/SOGo/UI/MailPartViewers/ChangeLog @@ -1,3 +1,8 @@ +2005-07-15 Helge Hess + + * UIxMailPartICalViewer.m: rewrote not to use SOGoAppointment and to + use iCalCalendar instead (v0.9.9) + 2005-07-15 Helge Hess * UIxMailSizeFormatter.m, UIxMailPartMixedViewer.m, diff --git a/SOGo/UI/MailPartViewers/UIxMailPartICalViewer.m b/SOGo/UI/MailPartViewers/UIxMailPartICalViewer.m index 46b07ca3..0cc49e0b 100644 --- a/SOGo/UI/MailPartViewers/UIxMailPartICalViewer.m +++ b/SOGo/UI/MailPartViewers/UIxMailPartICalViewer.m @@ -27,12 +27,13 @@ Show plain/calendar mail parts. */ -@class SOGoDateFormatter, SOGoAppointment; -@class iCalEvent; +@class SOGoDateFormatter; +@class iCalEvent, iCalCalendar; @interface UIxMailPartICalViewer : UIxMailPartViewer { - SOGoAppointment *appointment; + iCalCalendar *inCalendar; + iCalEvent *inEvent; id attendee; SOGoDateFormatter *dateFormatter; id item; @@ -57,7 +58,8 @@ [self->storedEvent release]; [self->attendee release]; [self->item release]; - [self->appointment release]; + [self->inCalendar release]; + [self->inEvent release]; [self->dateFormatter release]; [super dealloc]; } @@ -66,7 +68,8 @@ - (void)resetPathCaches { [super resetPathCaches]; - [self->appointment release]; self->appointment = nil; + [self->inEvent release]; self->inEvent = nil; + [self->inCalendar release]; self->inCalendar = nil; [self->storedEventObject release]; self->storedEventObject = nil; [self->storedEvent release]; self->storedEvent = nil; @@ -77,16 +80,43 @@ /* accessors */ -- (SOGoAppointment *)appointment { +- (iCalCalendar *)inCalendar { NSString *iCalString; - - if (self->appointment != nil) - return self->appointment; + + if (self->inCalendar != nil) + return [self->inCalendar isNotNull] ? self->inCalendar : nil; iCalString = [self flatContentAsString]; - self->appointment = [[SOGoAppointment alloc] initWithICalString:iCalString]; - return self->appointment; + self->inCalendar = + [[iCalCalendar parseCalendarFromSource:iCalString] retain]; + if (self->inCalendar == nil) { + [self warnWithFormat:@"Could not parse a vcalendar string."]; + self->inCalendar = [[NSNull null] retain]; + return nil; + } + else + return self->inCalendar; +} +- (BOOL)couldParseCalendar { + return [[self inCalendar] isNotNull]; +} + +- (iCalEvent *)inEvent { + NSArray *events; + + if (self->inEvent != nil) + return [self->inEvent isNotNull] ? self->inEvent : nil; + + events = [[self inCalendar] events]; + if ([events count] > 0) { + self->inEvent = [[events objectAtIndex:0] retain]; + return self->inEvent; + } + else { + self->inEvent = [[NSNull null] retain]; + return nil; + } } /* formatters */ @@ -118,8 +148,8 @@ - (NSCalendarDate *)startTime { NSCalendarDate *date; - - date = [[self appointment] startDate]; + + date = [[self inEvent] startDate]; [date setTimeZone:[self viewTimeZone]]; return date; } @@ -127,7 +157,7 @@ - (NSCalendarDate *)endTime { NSCalendarDate *date; - date = [[self appointment] endDate]; + date = [[self inEvent] endDate]; [date setTimeZone:[self viewTimeZone]]; return date; } @@ -154,7 +184,7 @@ else { NSString *filename; - filename = [calendar resourceNameForEventUID:[[self appointment] uid]]; + filename = [calendar resourceNameForEventUID:[[self inEvent] uid]]; if (filename != nil) { // TODO: When we get an exception, this might be an auth issue meaning // that the UID indeed exists but that the user has no access to @@ -201,7 +231,7 @@ return [[self storedEvent] isOrganizer:loginEMail]; } - return [[self appointment] isOrganizer:loginEMail]; + return [[self inEvent] isOrganizer:loginEMail]; } - (BOOL)isLoggedInUserAnAttendee { @@ -217,7 +247,7 @@ return [[self storedEvent] isParticipant:loginEMail]; } - return [[self appointment] isParticipant:loginEMail]; + return [[self inEvent] isParticipant:loginEMail]; } @end /* UIxMailPartICalViewer */ diff --git a/SOGo/UI/MailPartViewers/Version b/SOGo/UI/MailPartViewers/Version index 612c754b..390fe45f 100644 --- a/SOGo/UI/MailPartViewers/Version +++ b/SOGo/UI/MailPartViewers/Version @@ -1,5 +1,6 @@ # version file -SUBMINOR_VERSION:=8 +SUBMINOR_VERSION:=9 +# v0.9.0 requires libNGiCal v4.5.53 # v0.9.1 requires libNGMime v4.5.213 diff --git a/SOGo/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox b/SOGo/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox index b8752952..7edac79e 100644 --- a/SOGo/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox +++ b/SOGo/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox @@ -8,11 +8,13 @@ > -
- : -
- - Method:
+
+ + : + + + + Method:
TODO: Storage: @@ -61,7 +63,7 @@
-
+
@@ -76,16 +78,15 @@ - + + + + + +
:
: - - (), +
: - + () @@ -95,14 +96,21 @@
:: + +
: - +
-
+