From f4d8031101a4cee7182dc02297dd7cc3427db987 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 20 Jul 2007 20:22:16 +0000 Subject: [PATCH] Monotone-Parent: 3e115caf9292772485392f689415b1620ec81d9e Monotone-Revision: 6c18461fde8c24d977a5536ff8d6c935f2d59268 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-07-20T20:22:16 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 +++ UI/Contacts/UIxContactsListView.m | 39 ++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 14 deletions(-) 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 */