From d2f71ea289383ea95b782feee81807360af184c8 Mon Sep 17 00:00:00 2001 From: "pinkerton%aol.net" Date: Sun, 13 Nov 2005 17:45:44 +0000 Subject: [PATCH] use different property on Tiger for homepage, apple depricated the one we were using (bug 313884) git-svn-id: svn://10.0.0.236/trunk@184544 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/camino/src/bookmarks/AddressBookManager.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mozilla/camino/src/bookmarks/AddressBookManager.m b/mozilla/camino/src/bookmarks/AddressBookManager.m index f32a47545cc..59e6bf30856 100644 --- a/mozilla/camino/src/bookmarks/AddressBookManager.m +++ b/mozilla/camino/src/bookmarks/AddressBookManager.m @@ -45,12 +45,18 @@ #import "Bookmark.h" #import +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4 +// These are not available for linkage before the 10.4 SDK. Value obtained via inspection. +static NSString * const kABURLsProperty = @"URLs"; +#endif + @implementation AddressBookManager -(id)initWithFolder:(id)folder { if ((self = [super init])) { + [ABAddressBook sharedAddressBook]; // ensure notification constants are valid, docs say they're not until this is called mAddressBookFolder = [folder retain]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(fillAddressBook:) name:kABDatabaseChangedNotification object:nil]; @@ -81,6 +87,11 @@ NSString *name, *homepage; while ((person = [peopleEnumerator nextObject])) { homepage = [person valueForProperty:kABHomePageProperty]; + if (!homepage) { + // |kABHomePageProperty| is depricated on Tiger, look for the new property. + ABMultiValue* urls = [person valueForProperty:kABURLsProperty]; + homepage = [urls valueAtIndex:[urls indexForIdentifier:[urls primaryIdentifier]]]; + } if ([homepage length] > 0) { NSString* firstName = [person valueForProperty:kABFirstNameProperty]; NSString* lastName = [person valueForProperty:kABLastNameProperty];