diff --git a/UI/Scheduler/UIxComponentEditor.h b/UI/Scheduler/UIxComponentEditor.h index 598cfb80c..e809758d3 100644 --- a/UI/Scheduler/UIxComponentEditor.h +++ b/UI/Scheduler/UIxComponentEditor.h @@ -37,7 +37,6 @@ @interface UIxComponentEditor : UIxComponent { -@private NSString *iCalString; NSString *errorText; id item; @@ -58,6 +57,7 @@ BOOL checkForConflicts; /* default: NO */ NSDictionary *cycle; NSString *cycleEnd; + NSString *componentOwner; } - (void) setAccessClass: (NSString *) _class; @@ -124,6 +124,9 @@ - (void) setIsCycleEndUntil; - (void) setIsCycleEndNever; +- (NSString *) componentOwner; +- (NSArray *) availableCalendars; + /* access */ - (BOOL) isMyComponent; - (BOOL) canAccessComponent; diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 4469a9ac6..1e5be3360 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -25,6 +25,7 @@ #import #import #import +#import #import #import @@ -38,6 +39,7 @@ #import #import +#import #import #import "UIxComponent+Agenor.h" @@ -53,6 +55,7 @@ [self setIsPrivate: NO]; [self setCheckForConflicts: NO]; [self setIsCycleEndNever]; + componentOwner = @""; } return self; @@ -556,13 +559,20 @@ NSString *s; iCalRecurrenceRule *rrule; NSTimeZone *uTZ; + SOGoObject *co; - if ((startDate = [component startDate]) == nil) - startDate = [[NSCalendarDate date] hour:11 minute:0]; - - uTZ = [[self clientObject] userTimeZone]; - [startDate setTimeZone: uTZ]; - [startDate retain]; + co = [self clientObject]; + componentOwner = [co ownerInContext: nil]; + + startDate = [component startDate]; +// if ((startDate = [component startDate]) == nil) +// startDate = [[NSCalendarDate date] hour:11 minute:0]; + if (startDate) + { + uTZ = [co userTimeZone]; + [startDate setTimeZone: uTZ]; + [startDate retain]; + } title = [[component summary] copy]; location = [[component location] copy]; @@ -689,4 +699,39 @@ return iCalString; } + +- (NSArray *) availableCalendars +{ + NSEnumerator *rawContacts; + NSString *list, *currentId; + NSMutableArray *calendars; + SOGoUser *user; + + calendars = [NSMutableArray array]; + + user = [context activeUser]; + list = [[user userDefaults] stringForKey: @"calendaruids"]; + if ([list length] == 0) + list = [self shortUserNameForDisplay]; + + rawContacts + = [[list componentsSeparatedByString: @","] objectEnumerator]; + currentId = [rawContacts nextObject]; + while (currentId) + { + if ([currentId hasPrefix: @"-"]) + [calendars addObject: [currentId substringFromIndex: 1]]; + else + [calendars addObject: currentId]; + currentId = [rawContacts nextObject]; + } + + return calendars; +} + +- (NSString *) componentOwner +{ + return componentOwner; +} + @end