correctly display name of company in abook integration instead of (null) (null)

This commit is contained in:
pinkerton%aol.net 2004-05-04 14:20:16 +00:00
Родитель 513c5431a9
Коммит 4d3bbc13de
1 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -82,7 +82,21 @@
while ((person = [peopleEnumerator nextObject])) {
homepage = [person valueForProperty:kABHomePageProperty];
if ([homepage length] > 0) {
name = [NSString stringWithFormat:@"%@ %@",[person valueForProperty:kABFirstNameProperty],[person valueForProperty:kABLastNameProperty]];
NSString* firstName = [person valueForProperty:kABFirstNameProperty];
NSString* lastName = [person valueForProperty:kABLastNameProperty];
if (firstName || lastName) {
if (!firstName)
name = lastName;
else if (!lastName)
name = firstName;
else
name = [NSString stringWithFormat:@"%@ %@", firstName, lastName];
}
else {
name = [person valueForProperty:kABOrganizationProperty];
if (!name)
name = NSLocalizedString(@"<No Name>",nil);
}
id bookmark = [mAddressBookFolder addBookmark];
[bookmark setTitle:name];
[bookmark setUrl:homepage];