зеркало из https://github.com/mozilla/pjs.git
use different property on Tiger for homepage, apple depricated the one we
were using (bug 313884)
This commit is contained in:
Родитель
5fc3fcd216
Коммит
c0db2fe7a5
|
@ -45,12 +45,18 @@
|
||||||
#import "Bookmark.h"
|
#import "Bookmark.h"
|
||||||
#import <AddressBook/AddressBook.h>
|
#import <AddressBook/AddressBook.h>
|
||||||
|
|
||||||
|
#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
|
@implementation AddressBookManager
|
||||||
|
|
||||||
-(id)initWithFolder:(id)folder
|
-(id)initWithFolder:(id)folder
|
||||||
{
|
{
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
|
[ABAddressBook sharedAddressBook]; // ensure notification constants are valid, docs say they're not until this is called
|
||||||
mAddressBookFolder = [folder retain];
|
mAddressBookFolder = [folder retain];
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
[nc addObserver:self selector:@selector(fillAddressBook:) name:kABDatabaseChangedNotification object:nil];
|
[nc addObserver:self selector:@selector(fillAddressBook:) name:kABDatabaseChangedNotification object:nil];
|
||||||
|
@ -81,6 +87,11 @@
|
||||||
NSString *name, *homepage;
|
NSString *name, *homepage;
|
||||||
while ((person = [peopleEnumerator nextObject])) {
|
while ((person = [peopleEnumerator nextObject])) {
|
||||||
homepage = [person valueForProperty:kABHomePageProperty];
|
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) {
|
if ([homepage length] > 0) {
|
||||||
NSString* firstName = [person valueForProperty:kABFirstNameProperty];
|
NSString* firstName = [person valueForProperty:kABFirstNameProperty];
|
||||||
NSString* lastName = [person valueForProperty:kABLastNameProperty];
|
NSString* lastName = [person valueForProperty:kABLastNameProperty];
|
||||||
|
|
Загрузка…
Ссылка в новой задаче