From c22167ba872d8991192d54cfc56f7622330300c2 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 12 Dec 2011 15:43:17 +0000 Subject: [PATCH] See ChangeLog. Monotone-Parent: 82cf74276a48a04d2d3bb16da3ed5b73576a77ef Monotone-Revision: 1f900dd9f1637dad2237767e5a65271c06b27df0 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2011-12-12T15:43:17 --- ChangeLog | 8 ++++++++ SoObjects/Contacts/SOGoContactGCSFolder.m | 10 +++++++++- UI/Contacts/UIxContactView.m | 10 ++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a828c7cfa..6c6bab8bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-12-12 Francis Lachapelle + + * SoObjects/Contacts/SOGoContactGCSFolder.m + (-fixupContactRecord:): fallback on organization name when the + contact has no display name, no firstname, and no lastname. + + * UI/Contacts/UIxContactView.m (-fullName): idem. + 2011-12-09 Francis Lachapelle * UI/MainUI/SOGoRootPage.m (_cookieWithUsername:): the SOGoLogin diff --git a/SoObjects/Contacts/SOGoContactGCSFolder.m b/SoObjects/Contacts/SOGoContactGCSFolder.m index e395bf6f8..73114b811 100644 --- a/SoObjects/Contacts/SOGoContactGCSFolder.m +++ b/SoObjects/Contacts/SOGoContactGCSFolder.m @@ -212,7 +212,15 @@ static NSArray *folderListingFields = nil; if (![data length]) { data = [contactRecord keysWithFormat: @"%{c_givenname} %{c_sn}"]; - [contactRecord setObject: data forKey: @"c_cn"]; + if ([data length] > 1) + { + [contactRecord setObject: data forKey: @"c_cn"]; + } + else + { + data = [contactRecord objectForKey: @"c_o"]; + [contactRecord setObject: data forKey: @"c_cn"]; + } } if (![contactRecord objectForKey: @"c_mail"]) diff --git a/UI/Contacts/UIxContactView.m b/UI/Contacts/UIxContactView.m index 3c4583c61..498bf2e91 100644 --- a/UI/Contacts/UIxContactView.m +++ b/UI/Contacts/UIxContactView.m @@ -104,7 +104,7 @@ - (NSString *) fullName { CardElement *n; - NSString *fn, *firstName, *lastName; + NSString *fn, *firstName, *lastName, *org; fn = [card fn]; if ([fn length] == 0) @@ -119,8 +119,14 @@ else fn = firstName; } - else + else if ([lastName length] > 0) fn = lastName; + else + { + n = [card org]; + org = [n flattenedValueAtIndex: 0 forKey: @""]; + fn = org; + } } return fn;