From 64434bbfadcbf52cc3093d977341436c51634cd5 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 5 Oct 2016 15:23:18 -0400 Subject: [PATCH] Fix sort by email with LDAP sources --- SoObjects/Contacts/GNUmakefile | 1 + SoObjects/Contacts/NSArray+Contacts.h | 34 +++++++++++++++++ SoObjects/Contacts/NSArray+Contacts.m | 37 +++++++++++++++++++ SoObjects/Contacts/SOGoContactSourceFolder.m | 1 + .../ContactsUI/UIxContactFoldersView.wox | 2 +- 5 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 SoObjects/Contacts/NSArray+Contacts.h create mode 100644 SoObjects/Contacts/NSArray+Contacts.m diff --git a/SoObjects/Contacts/GNUmakefile b/SoObjects/Contacts/GNUmakefile index bbdef42ce..4d3dd4381 100644 --- a/SoObjects/Contacts/GNUmakefile +++ b/SoObjects/Contacts/GNUmakefile @@ -21,6 +21,7 @@ Contacts_OBJC_FILES = \ SOGoUserFolder+Contacts.m \ SOGoContactEntryPhoto.m \ \ + NSArray+Contacts.m \ NSDictionary+LDIF.m \ NSString+LDIF.m diff --git a/SoObjects/Contacts/NSArray+Contacts.h b/SoObjects/Contacts/NSArray+Contacts.h new file mode 100644 index 000000000..b063da339 --- /dev/null +++ b/SoObjects/Contacts/NSArray+Contacts.h @@ -0,0 +1,34 @@ +/* NSArray+Contacts.h - this file is part of SOGo + * + * Copyright (C) 2016 Inverse inc + * + * Author: Inverse + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef NSARRAY_CONTACTS_H +#define NSARRAY_CONTACTS_H + +#import + +@interface NSArray (SOGoContacts) + +- (NSComparisonResult) compareCaseInsensitiveAscending: (id) otherRecord; + +@end + +#endif /* NSARRAY_CONTACTS_H */ diff --git a/SoObjects/Contacts/NSArray+Contacts.m b/SoObjects/Contacts/NSArray+Contacts.m new file mode 100644 index 000000000..fe4ce974f --- /dev/null +++ b/SoObjects/Contacts/NSArray+Contacts.m @@ -0,0 +1,37 @@ +/* NSArray+Contacts.m - this file is part of SOGo + * + * Copyright (C) 2016 Inverse inc + * + * Author: Inverse + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import "NSArray+Contacts.h" + +@implementation NSArray (SOGoContacts) + +- (NSComparisonResult) compareCaseInsensitiveAscending: (id) otherRecord +{ + id firstObject, otherFirstObject; + + firstObject = [self objectAtIndex: 0]; + otherFirstObject = [otherRecord objectAtIndex: 0]; + + return [firstObject compareCaseInsensitiveAscending: otherFirstObject]; +} + +@end diff --git a/SoObjects/Contacts/SOGoContactSourceFolder.m b/SoObjects/Contacts/SOGoContactSourceFolder.m index 2cb3aee46..446ce251c 100644 --- a/SoObjects/Contacts/SOGoContactSourceFolder.m +++ b/SoObjects/Contacts/SOGoContactSourceFolder.m @@ -38,6 +38,7 @@ #import #import +#import "NSArray+Contacts.h" #import "SOGoContactFolders.h" #import "SOGoContactGCSFolder.h" #import "SOGoContactLDIFEntry.h" diff --git a/UI/Templates/ContactsUI/UIxContactFoldersView.wox b/UI/Templates/ContactsUI/UIxContactFoldersView.wox index 89db4c89f..f0e4b261e 100644 --- a/UI/Templates/ContactsUI/UIxContactFoldersView.wox +++ b/UI/Templates/ContactsUI/UIxContactFoldersView.wox @@ -231,7 +231,7 @@ search {{addressbook.selectedFolder.name}} + ng-click="addressbook.searchMode()">{{addressbook.selectedFolder.name}}