From 58dfa2e43be894ec9c617da79264e88ddd6faa50 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 13 Nov 2015 14:43:03 -0500 Subject: [PATCH] Return categories (from quick table) as an array --- UI/Scheduler/UIxCalListingActions.m | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/UI/Scheduler/UIxCalListingActions.m b/UI/Scheduler/UIxCalListingActions.m index 2ff577d48..6157b42ec 100644 --- a/UI/Scheduler/UIxCalListingActions.m +++ b/UI/Scheduler/UIxCalListingActions.m @@ -364,7 +364,7 @@ static NSArray *tasksFields = nil; NSMutableDictionary *newInfo; NSMutableArray *infos, *quickInfos, *allInfos, *quickInfosName; NSNull *marker; - NSString *owner, *role, *calendarName, *iCalString, *recurrenceTime; + NSString *owner, *role, *calendarName, *iCalString, *recurrenceTime, *categories; NSRange match; iCalCalendar *calendar; iCalEntityObject *master; @@ -423,7 +423,7 @@ static NSArray *tasksFields = nil; if (quickInfosFlag == YES) { for (i = ([allInfos count] - 1); i >= 0 ; i--) { - if([quickInfosName containsObject:[[allInfos objectAtIndex:i] objectForKey:@"c_name"]]) + if ([quickInfosName containsObject:[[allInfos objectAtIndex:i] objectForKey:@"c_name"]]) [allInfos removeObjectAtIndex:i]; } } @@ -522,6 +522,11 @@ static NSArray *tasksFields = nil; [newInfo setObject: calendarName forKey: @"calendarName"]; + // Split comma-delimited categories + categories = [newInfo objectForKey: @"c_category"]; + if ([categories length]) + [newInfo setObject: [categories componentsSeparatedByString: @","] forKey: @"c_category"]; + // Fix empty title if (![[newInfo objectForKey: @"c_title"] length]) [self _fixComponentTitle: newInfo withType: component]; @@ -941,7 +946,7 @@ static inline iCalPersonPartStat _userStateInEvent (NSArray *event) eventStart = eventEnd; eventEnd = swap; [self warnWithFormat: @"event '%@' has end < start: %d < %d", - [event objectAtIndex: eventNameIndex], eventEnd, eventStart]; + [event objectAtIndex: eventNameIndex], eventEnd, eventStart]; } startSecs = (unsigned int) [startDate timeIntervalSince1970]; @@ -994,21 +999,21 @@ static inline iCalPersonPartStat _userStateInEvent (NSArray *event) currentDay = [blocks objectAtIndex: offset]; } - computedEventEnd = eventEnd; + computedEventEnd = eventEnd; - // We add 5 mins to the end date of an event if the end date - // is equal or smaller than the event's start date. - if (eventEnd <= currentStart) + // We add 5 mins to the end date of an event if the end date + // is equal or smaller than the event's start date. + if (eventEnd <= currentStart) computedEventEnd = currentStart + (5*60); - eventBlock = [self _eventBlockWithStart: currentStart + eventBlock = [self _eventBlockWithStart: currentStart end: computedEventEnd number: number onDay: currentDayStart recurrenceTime: recurrenceTime userState: userState]; - [currentDay addObject: eventBlock]; - } + [currentDay addObject: eventBlock]; + } } } } @@ -1319,7 +1324,7 @@ _computeBlocksPosition (NSArray *blocks) for (i = 0; i < [calendars count]; i++) // For each calendar { calendar = [calendars objectAtIndex:i]; - calendarName =[calendar objectForKey: @"name"]; + calendarName = [calendar objectForKey: @"name"]; calendarId = [calendar objectForKey: @"id"]; eventsForCalendar = [NSMutableArray array]; [self _prepareEventBlocks: &blocks withAllDays: &allDayBlocks];