diff --git a/ChangeLog b/ChangeLog index c431727be..34bc7b304 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-07-16 Ludovic Marcotte + + * UI/Contacts/UIxContactView.m + In secondaryEmail, we make sure that we loop + in all available email address and we pick the + first one that doesn't match the primaryEmail + 2010-07-16 Wolfgang Sourdeau * SoObjects/Appointments/SOGoAppointmentObject.m diff --git a/UI/Contacts/UIxContactView.m b/UI/Contacts/UIxContactView.m index dde492ca3..77fe8d4f5 100644 --- a/UI/Contacts/UIxContactView.m +++ b/UI/Contacts/UIxContactView.m @@ -139,15 +139,29 @@ // We might not have a preferred item but rather something like this: // EMAIL;TYPE=work:dd@ee.com // EMAIL;TYPE=home:ff@gg.com - // In this case, we always return the last entry. + // + // or: + // + // EMAIL;TYPE=INTERNET:a@a.com + // EMAIL;TYPE=INTERNET,HOME:b@b.com + // + // In this case, we always return the entry NOT matching the primaryEmail if ([emails count] > 0) { - email = [[emails objectAtIndex: [emails count]-1] value: 0]; + int i; - if ([email caseInsensitiveCompare: [card preferredEMail]] != NSOrderedSame) - mailTo = [NSString stringWithFormat: @"');\">" - @"%@", email, [[card fn] stringByReplacingString: @"\"" withString: @""], email, email]; + for (i = 0; i < [emails count]; i++) + { + email = [[emails objectAtIndex: i] value: 0]; + + if ([email caseInsensitiveCompare: [card preferredEMail]] != NSOrderedSame) + { + mailTo = [NSString stringWithFormat: @"');\">" + @"%@", email, [[card fn] stringByReplacingString: @"\"" withString: @""], email, email]; + break; + } + } } return [self _cardStringWithLabel: @"Additional Email:"