From e1689a9493e00bc0902f681ba129414188c845c4 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Tue, 3 Jul 2007 16:02:27 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1096 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 4 + OGoContentStore/appointment.ocs | 2 +- .../iCalRepeatableEntityObject+OCS.m | 96 +++++++++---------- SOPE/NGCards/CardElement.m | 4 +- SOPE/NGCards/ChangeLog | 13 +++ SOPE/NGCards/iCalRecurrenceRule.m | 21 ++-- 6 files changed, 80 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index fdaa48b5..7eada783 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-07-03 Wolfgang Sourdeau + * OGoContentStore/iCalRepeatableEntityObject+OCS.m + ([iCalRepeatableEntityObject -cycleInfo]): no longer take the + leading tagname into account when serializing the element values. + * Main/SOGoProductLoader.m: only load bundle directories ending with the "SOGo" extension. diff --git a/OGoContentStore/appointment.ocs b/OGoContentStore/appointment.ocs index 966680e4..0b6c1e7a 100644 --- a/OGoContentStore/appointment.ocs +++ b/OGoContentStore/appointment.ocs @@ -25,7 +25,7 @@ allowsNull = YES; }, { - columnName = cylceenddate; + columnName = cycleenddate; sqlType = "INT"; allowsNull = YES; }, diff --git a/OGoContentStore/iCalRepeatableEntityObject+OCS.m b/OGoContentStore/iCalRepeatableEntityObject+OCS.m index fe557b67..5491d12f 100644 --- a/OGoContentStore/iCalRepeatableEntityObject+OCS.m +++ b/OGoContentStore/iCalRepeatableEntityObject+OCS.m @@ -25,65 +25,59 @@ @implementation iCalRepeatableEntityObject (OCS) -- (NSString *)cycleInfo { - NSMutableDictionary *cycleInfo; - NSMutableArray *ma; - NSArray *a; - unsigned count; +- (NSArray *) _indexedRules: (NSArray *) rules +{ + NSMutableArray *ma; + unsigned int i, count; + NSString *valuesString; - if (![self isRecurrent]) - return nil; + ma = nil; + count = [rules count]; + if (count > 0) + { + ma = [NSMutableArray arrayWithCapacity:count]; + for (i = 0; i < count; i++) + { + iCalRecurrenceRule *rule; + + rule = [rules objectAtIndex:i]; +#warning we could return an NSArray instead and feed it as such to the iCalRecurrenceRule in SOGoAppointmentFolder... + valuesString = [[rule values] componentsJoinedByString: @";"]; + [ma addObject: valuesString]; + } + } - cycleInfo = [NSMutableDictionary dictionaryWithCapacity:3]; + return ma; +} - /* rules */ - a = [self recurrenceRules]; - count = [a count]; - if (count > 0) { - unsigned i; +- (NSString *) cycleInfo +{ + NSArray *rules; + NSString *value; + NSMutableDictionary *cycleInfo; - ma = [NSMutableArray arrayWithCapacity:count]; - for (i = 0; i < count; i++) { - iCalRecurrenceRule *rule; - - rule = [a objectAtIndex:i]; - [ma addObject: [rule versitString]]; - } - [cycleInfo setObject:ma forKey:@"rules"]; - } + if ([self isRecurrent]) + { + cycleInfo = [NSMutableDictionary dictionaryWithCapacity: 3]; - /* exception rules */ - a = [self exceptionRules]; - count = [a count]; - if (count > 0) { - unsigned i; - - ma = [NSMutableArray arrayWithCapacity:count]; - for (i = 0; i < count; i++) { - iCalRecurrenceRule *rule; + /* rules */ + rules = [self _indexedRules: [self recurrenceRules]]; + if (rules) + [cycleInfo setObject: rules forKey: @"rules"]; - rule = [a objectAtIndex:i]; - [ma addObject: [rule versitString]]; - } - [cycleInfo setObject:ma forKey:@"exRules"]; - } - - /* exception dates */ - a = [self exceptionDates]; - count = [a count]; - if (count > 0) { - unsigned i; - - ma = [NSMutableArray arrayWithCapacity:count]; - for (i = 0; i < count; i++) { - NSCalendarDate *date; + rules = [self _indexedRules: [self exceptionRules]]; + if (rules) + [cycleInfo setObject: rules forKey: @"exRules"]; - date = [a objectAtIndex:i]; - [ma addObject:[date icalString]]; + rules = [self _indexedRules: [self exceptionDates]]; + if (rules) + [cycleInfo setObject: rules forKey: @"exDates"]; + + value = [cycleInfo description]; } - [cycleInfo setObject:ma forKey:@"exDates"]; - } + else + value = nil; - return [cycleInfo description]; + return value; } @end diff --git a/SOPE/NGCards/CardElement.m b/SOPE/NGCards/CardElement.m index 7af7e19b..f715de76 100644 --- a/SOPE/NGCards/CardElement.m +++ b/SOPE/NGCards/CardElement.m @@ -424,7 +424,9 @@ string = [renderer render: self]; [renderer release]; - return string; + return (([string length] > 1) + ? [string substringToIndex: [string length] - 2] + : @""); } - (CardElement *) elementWithClass: (Class) elementClass diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index 0c04752c..1431e6f2 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,3 +1,16 @@ +2007-07-03 Wolfgang Sourdeau + + * iCalRecurrenceRule.m ([iCalRecurrenceRule + +recurrenceRuleWithICalRepresentation:_iCalRep]): the + representation is generally a series of values separated by a ";". + Therefore we need to split those values and feed them one by one. + ([iCalRecurrenceRule -weekDayFromICalRepresentation:_day]): return + -1 instead of raising an exception if the week day could not be + recognized. + + * CardElement.m ([CardElement -versitString]): remove the ending + "\r\n". + 2007-06-12 Wolfgang Sourdeau * iCalDateTime.m ([iCalDateTime diff --git a/SOPE/NGCards/iCalRecurrenceRule.m b/SOPE/NGCards/iCalRecurrenceRule.m index 9842dd45..fe66f48c 100644 --- a/SOPE/NGCards/iCalRecurrenceRule.m +++ b/SOPE/NGCards/iCalRecurrenceRule.m @@ -71,7 +71,13 @@ + (id) recurrenceRuleWithICalRepresentation: (NSString *) _iCalRep { - return [self simpleElementWithTag: @"rrule" value: _iCalRep]; + iCalRecurrenceRule *rule; + + rule = [self elementWithTag: @"rrule"]; + if ([_iCalRep length] > 0) + [rule addValues: [_iCalRep componentsSeparatedByString: @";"]]; + + return rule; } - (id) init @@ -289,7 +295,7 @@ return mask; } -#warning this is fucked up +#warning this is bad - (int) byDayOccurence1 { return 0; @@ -329,11 +335,12 @@ if (c1 == 'u' || c1 == 'U') return iCalWeekDaySunday; } } - - // TODO: do not raise but rather return an error value? - [NSException raise:NSGenericException - format:@"Incorrect weekDay '%@' specified!", _day]; - return iCalWeekDayMonday; /* keep compiler happy */ + + return -1; +// // TODO: do not raise but rather return an error value? +// [NSException raise:NSGenericException +// format:@"Incorrect weekDay '%@' specified!", _day]; +// return iCalWeekDayMonday; /* keep compiler happy */ } - (NSString *) iCalRepresentationForWeekDay: (iCalWeekDay) _weekDay -- 2.39.5