From d0e10adace0a7b8dad13876f1cf9c5b813584685 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 26 Sep 2006 18:42:05 +0000 Subject: [PATCH] Monotone-Parent: 9b75a56ce8daf9300f46778c1489c7a8d55088da Monotone-Revision: 49aa57834a0704767ffea833b67d08d668dd8cb4 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-09-26T18:42:05 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ UI/Contacts/UIxContactsListViewBase.m | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 50faafb16..5b31dc2ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-09-26 Wolfgang Sourdeau + * UI/Contacts/UIxContactsListViewBase.m ([UIxContactsListViewBase + -displayName]): new method that returns the display name from "cn" + or from the "displayName" key if found. + * UI/Contacts/UIxContactEditor.m ([UIxContactEditor -initSnapshot]): check if "[card n]" returns anything to avoid a crash. diff --git a/UI/Contacts/UIxContactsListViewBase.m b/UI/Contacts/UIxContactsListViewBase.m index 557074f5a..b7401555b 100644 --- a/UI/Contacts/UIxContactsListViewBase.m +++ b/UI/Contacts/UIxContactsListViewBase.m @@ -38,12 +38,12 @@ /* accessors */ -- (void) setCurrentContact: (id ) _contact +- (void) setCurrentContact: (NSDictionary *) _contact { currentContact = _contact; } -- (id ) currentContact +- (NSDictionary *) currentContact { return currentContact; } @@ -66,6 +66,17 @@ return @"fn"; } +- (NSString *) displayName +{ + NSString *displayName; + + displayName = [currentContact objectForKey: @"displayName"]; + if (!(displayName && [displayName length] > 0)) + displayName = [currentContact objectForKey: @"cn"]; + + return displayName; +} + - (NSString *) sortKey { NSString *s;