From 80bd276899e86c52b0e4ff3138dd8c6edcd4b57a Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 4 Mar 2011 14:14:12 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: ff995ad9fc0f2d8dac7a71ba3e29531b2f45dfa2 Monotone-Revision: 193c17735fe473ec69d1c4ef59dcdce44a461da8 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2011-03-04T14:14:12 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++++ SoObjects/Appointments/SOGoAppointmentFolder.h | 4 +++- SoObjects/Appointments/SOGoAppointmentFolder.m | 16 +++++++++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e9af407d..3ab3ad885 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-03-04 Ludovic Marcotte + + * SoObjects/Appointments/SOGoAppointmentFolder.h/m: + -importCalendar: we now also import the timezone definition + when present + 2011-02-25 Wolfgang Sourdeau * OpenChange/MAPIStoreMailContext.[hm]: renamed from diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.h b/SoObjects/Appointments/SOGoAppointmentFolder.h index 7c1e70f3b..2ad6ba6b0 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.h +++ b/SoObjects/Appointments/SOGoAppointmentFolder.h @@ -158,7 +158,9 @@ typedef enum { - (BOOL) includeInFreeBusy; - (void) setIncludeInFreeBusy: (BOOL) newInclude; -- (BOOL) importComponent: (iCalEntityObject *) event; +- (BOOL) importComponent: (iCalEntityObject *) event + timezone: (NSString *) timezone; + - (int) importCalendar: (iCalCalendar *) calendar; /* caldav proxy */ diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index a2176c6e1..ea3d7123e 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -2577,6 +2577,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir } - (BOOL) importComponent: (iCalEntityObject *) event + timezone: (NSString *) timezone { SOGoAppointmentObject *object; NSString *uid; @@ -2588,14 +2589,16 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir inContainer: self]; [object setIsNew: YES]; content = - [NSString stringWithFormat: @"BEGIN:VCALENDAR\n%@\nEND:VCALENDAR", - [event versitString]]; + [NSString stringWithFormat: @"BEGIN:VCALENDAR\n%@%@\nEND:VCALENDAR", + timezone, [event versitString]]; return ([object saveContentString: content] == nil); } - (int) importCalendar: (iCalCalendar *) calendar { NSMutableArray *components; + NSString *tz; + int imported, count, i; imported = 0; @@ -2608,9 +2611,16 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir [components addObjectsFromArray: [calendar journals]]; [components addObjectsFromArray: [calendar freeBusys]]; +#warning FIXME we might want to eventually support multiple timezone definitions and match the one used by the event + if ([[calendar timezones] count]) + tz = [NSString stringWithFormat: @"%@\n", + [[[calendar timezones] lastObject] versitString]]; + else + tz = @""; + count = [components count]; for (i = 0; i < count; i++) - if ([self importComponent: [components objectAtIndex: i]]) + if ([self importComponent: [components objectAtIndex: i] timezone: tz]) imported++; }