diff --git a/ChangeLog b/ChangeLog index fd43c38ae..b0c5f04e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2007-07-20 Wolfgang Sourdeau + * UI/Contacts/UIxContactsListView.m ([UIxContactsListView + -contactInfos]): cache the results to avoid multiple invocations. + * SoObjects/Contacts/SOGoContactLDAPFolder.m ([SOGoContactLDAPFolder -toOneRelationshipKeys]): check whether we really should return something or if we fake to return nil... diff --git a/UI/Contacts/UIxContactsListView.m b/UI/Contacts/UIxContactsListView.m index a68239d21..4803bba0e 100644 --- a/UI/Contacts/UIxContactsListView.m +++ b/UI/Contacts/UIxContactsListView.m @@ -26,8 +26,6 @@ #import #import -#import "common.h" - #import "UIxContactsListView.h" @implementation UIxContactsListView @@ -37,11 +35,18 @@ if ((self = [super init])) { selectorComponentClass = nil; + contactInfos = nil; } return self; } +- (void) dealloc +{ + [contactInfos release]; + [super dealloc]; +} + /* accessors */ - (void) setCurrentContact: (NSDictionary *) _contact @@ -118,21 +123,27 @@ NSString *ascending, *searchText, *valueText; NSComparisonResult ordering; - folder = [self clientObject]; + if (!contactInfos) + { + folder = [self clientObject]; - ascending = [self queryParameterForKey: @"asc"]; - ordering = ((![ascending length] || [ascending boolValue]) - ? NSOrderedAscending : NSOrderedDescending); + ascending = [self queryParameterForKey: @"asc"]; + ordering = ((![ascending length] || [ascending boolValue]) + ? NSOrderedAscending : NSOrderedDescending); - searchText = [self queryParameterForKey: @"search"]; - if ([searchText length] > 0) - valueText = [self queryParameterForKey: @"value"]; - else - valueText = nil; + searchText = [self queryParameterForKey: @"search"]; + if ([searchText length] > 0) + valueText = [self queryParameterForKey: @"value"]; + else + valueText = nil; - return [folder lookupContactsWithFilter: valueText - sortBy: [self sortKey] - ordering: ordering]; + ASSIGN (contactInfos, + [folder lookupContactsWithFilter: valueText + sortBy: [self sortKey] + ordering: ordering]); + } + + return contactInfos; } /* actions */