diff --git a/ChangeLog b/ChangeLog index 314d22ddb..aa8ddf978 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-09-23 Cyril Robert + + * SoObjects/Appointments/SOGoAppointmentFolder.m (importComponent:): Fixed + addition of BEGIN/END block. + * SoObjects/Appointments/SOGoWebAppointmentFolder.m (deleteAllContent): + Created deleteAllContent to be able to change it in the store bundle. + * UI/Scheduler/UIxCalMainActions.m (addWebCalendarAction): Small improvement. + 2009-09-23 Wolfgang Sourdeau * UI/WebServerResources/SOGoAutoCompletion.js diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 74d208053..bb9885a0f 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -3191,39 +3191,25 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir object = [SOGoAppointmentObject objectWithName: uid inContainer: self]; content = - [NSString stringWithFormat: @"BEGIN:VCALENDAR\n%@END:VCALENDAR\n", + [NSString stringWithFormat: @"BEGIN:VCALENDAR\n%@\nEND:VCALENDAR", [event versitString]]; return ([object saveContentString: content] == nil); } - (int) importCalendar: (iCalCalendar *) calendar { - NSArray *components; + NSMutableArray *components; int imported, count, i; imported = 0; if (calendar) { - components = [calendar events]; - count = [components count]; - for (i = 0; i < count; i++) - if ([self importComponent: [components objectAtIndex: i]]) - imported++; + components = [[calendar events] mutableCopy]; + [components addObjectsFromArray: [calendar todos]]; + [components addObjectsFromArray: [calendar journals]]; + [components addObjectsFromArray: [calendar freeBusys]]; - components = [calendar todos]; - count = [components count]; - for (i = 0; i < count; i++) - if ([self importComponent: [components objectAtIndex: i]]) - imported++; - - components = [calendar journals]; - count = [components count]; - for (i = 0; i < count; i++) - if ([self importComponent: [components objectAtIndex: i]]) - imported++; - - components = [calendar freeBusys]; count = [components count]; for (i = 0; i < count; i++) if ([self importComponent: [components objectAtIndex: i]]) diff --git a/SoObjects/Appointments/SOGoAppointmentFolders.h b/SoObjects/Appointments/SOGoAppointmentFolders.h index d4f5d7698..19fa464ff 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolders.h +++ b/SoObjects/Appointments/SOGoAppointmentFolders.h @@ -30,6 +30,7 @@ @interface SOGoAppointmentFolders : SOGoParentFolder - (NSArray *) proxyFoldersWithWriteAccess: (BOOL) hasWriteAccess; +- (NSArray *) webCalendarIds; @end diff --git a/SoObjects/Appointments/SOGoWebAppointmentFolder.h b/SoObjects/Appointments/SOGoWebAppointmentFolder.h index 945e941f0..184ab150f 100644 --- a/SoObjects/Appointments/SOGoWebAppointmentFolder.h +++ b/SoObjects/Appointments/SOGoWebAppointmentFolder.h @@ -28,6 +28,7 @@ @interface SOGoWebAppointmentFolder : SOGoAppointmentFolder - (int) loadWebCalendar: (NSString *) location; +- (void) deleteAllContent; @end diff --git a/SoObjects/Appointments/SOGoWebAppointmentFolder.m b/SoObjects/Appointments/SOGoWebAppointmentFolder.m index 395fb2e47..fd9099412 100644 --- a/SoObjects/Appointments/SOGoWebAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoWebAppointmentFolder.m @@ -31,6 +31,11 @@ @implementation SOGoWebAppointmentFolder +- (void) deleteAllContent +{ + [[self ocsFolder] deleteAllContent]; +} + - (int) loadWebCalendar: (NSString *) location { NSURL *url; @@ -57,7 +62,7 @@ calendar = [iCalCalendar parseSingleFromSource: contents]; if (calendar) { - [[self ocsFolder] deleteAllContent]; + [self deleteAllContent]; imported = [self importCalendar: calendar]; } else diff --git a/UI/Scheduler/UIxCalMainActions.m b/UI/Scheduler/UIxCalMainActions.m index 675ae5678..357787fa9 100644 --- a/UI/Scheduler/UIxCalMainActions.m +++ b/UI/Scheduler/UIxCalMainActions.m @@ -44,6 +44,7 @@ NSURL *url; NSString *name, *displayName; NSMutableDictionary *rc; + SOGoAppointmentFolders *folders; int imported = 0; r = [context request]; @@ -53,13 +54,14 @@ url = [NSURL URLWithString: [r formValueForKey: @"url"]]; if (url) { + folders = [self clientObject]; displayName = [self displayNameForUrl: [r formValueForKey: @"url"]]; - [[self clientObject] newFolderWithName: displayName - nameInContainer: &name]; + [folders newFolderWithName: displayName + nameInContainer: &name]; [self saveUrl: url forCalendar: name]; - folder = [[self clientObject] lookupName: name - inContext: context - acquire: NO]; + folder = [folders lookupName: name + inContext: context + acquire: NO]; if (folder) { imported = [folder loadWebCalendar: [r formValueForKey: @"url"]];