- (NSMutableDictionary *)extractQuickFieldsFromEvent:(iCalEvent *)_event {
NSMutableDictionary *row;
NSCalendarDate *startDate, *endDate;
- NSString *uid, *title, *location;
+ NSString *uid, *title, *location, *status, *accessClass;
NSNumber *sequence;
- id participants, partmails;
+ id organizer;
+ id participants, partmails;
if (_event == nil)
return nil;
/* extract values */
- startDate = [_event startDate];
- endDate = [_event endDate];
- uid = [_event uid];
- title = [_event summary];
- location = [_event location];
- sequence = [_event sequence];
-
+ startDate = [_event startDate];
+ endDate = [_event endDate];
+ uid = [_event uid];
+ title = [_event summary];
+ location = [_event location];
+ sequence = [_event sequence];
+ accessClass = [[_event accessClass] uppercaseString];
+ status = [[_event status] uppercaseString];
+
participants = [_event attendees];
partmails = [participants valueForKey:@"email"];
partmails = [partmails componentsJoinedByString:@", "];
[row setObject:participants forKey:@"participants"];
if ([partmails length] > 0)
[row setObject:partmails forKey:@"partmails"];
-
+
+ if ([status isNotNull]) {
+ int code = 1;
+
+ if ([status isEqualToString:@"TENTATIVE"])
+ code = 0;
+ else if ([status isEqualToString:@"CANCELLED"])
+ code = 2;
+ [row setObject:[NSNumber numberWithInt:code] forKey:@"status"];
+ }
+ else {
+ /* confirmed by default */
+ [row setObject:[NSNumber numberWithInt:1] forKey:@"status"];
+ }
+
+ if([accessClass isNotNull] && ![accessClass isEqualToString:@"PUBLIC"]) {
+ [row setObject:[NSNumber numberWithBool:NO] forKey:@"ispublic"];
+ }
+ else {
+ [row setObject:[NSNumber numberWithBool:YES] forKey:@"ispublic"];
+ }
+
+ // TODO: fix transparency when it's supported in iCalEvent
+ [row setObject:[NSNumber numberWithBool:NO] forKey:@"isopaque"];
+
+ organizer = [_event organizer];
+ if (organizer) {
+ NSString *email;
+
+ email = [organizer valueForKey:@"email"];
+ if (email)
+ [row setObject:email forKey:@"orgmail"];
+ }
return row;
}