From 0b09c1b52b00daea4273ee3c2adca5a0d38748d7 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 17 Oct 2008 02:17:56 +0000 Subject: [PATCH] Fix for bug #3039 Monotone-Parent: 6c02bf9631ff4ffa77f3dd2068fdf632d29bcc25 Monotone-Revision: fd6739c8912ccda074f93108e73623ee0dcc2d1b Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2008-10-17T02:17:56 Monotone-Branch: ca.inverse.sogo --- UI/Contacts/UIxContactFoldersView.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/UI/Contacts/UIxContactFoldersView.m b/UI/Contacts/UIxContactFoldersView.m index 27d7526a4..54128163d 100644 --- a/UI/Contacts/UIxContactFoldersView.m +++ b/UI/Contacts/UIxContactFoldersView.m @@ -42,6 +42,7 @@ #import #import #import +#import #import #import #import @@ -192,6 +193,7 @@ withSearchOn: (NSString *) contact NSString *searchText, *mail; NSDictionary *contact, *data; NSArray *folders, *contacts, *descriptors, *sortedContacts; + NSMutableArray *sortedFolders; NSMutableDictionary *uniqueContacts; unsigned int i, j; NSSortDescriptor *displayNameDescriptor; @@ -201,10 +203,20 @@ withSearchOn: (NSString *) contact { //NSLog(@"Search all contacts: %@", searchText); folders = [[self clientObject] subFolders]; + sortedFolders = [NSMutableArray arrayWithCapacity: [folders count]]; uniqueContacts = [NSMutableDictionary dictionary]; + /* We first search in LDAP folders (in case of duplicated entries in GCS folders) */ for (i = 0; i < [folders count]; i++) { folder = [folders objectAtIndex: i]; + if ([folder isKindOfClass: [SOGoContactLDAPFolder class]]) + [sortedFolders insertObject: folder atIndex: 0]; + else + [sortedFolders addObject: folder]; + } + for (i = 0; i < [sortedFolders count]; i++) + { + folder = [sortedFolders objectAtIndex: i]; //NSLog(@" Address book: %@ (%@)", [folder displayName], [folder class]); contacts = [folder lookupContactsWithFilter: searchText sortBy: @"displayName"