• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
AddressBook issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AddressBook issues


  • Subject: AddressBook issues
  • From: Hasan Diwan <email@hidden>
  • Date: Mon, 10 Feb 2003 19:24:39 -0800

I'm writing an alternate interface to the Addressbook framework's data
store. To do this, I've written the following category, the NSLog line
in - (NSString *)getFullName does print what it should, it just does
not show up in the index (which is an NSTableView). Any and all
suggestions are appreciated? Thanks in advance! If there's now a
mailing list for the AddressBook framework.
// data source methods
// NSMutableDictionary *backingStore = [[NSMutableDictionary
dictionary] retain];
- (int)numberOfRowsInTableView:(NSTableView *)t {
return [backingStore count];
}
- (void)tableView:(NSTableView *)t setObjectValue:(id)obj
forTableColumn:(NSTableColumn *)tCol row:(int)r {
[backingStore setObject:[entry string] forKey:obj];
}
- (id)tableView:(NSTableView *)t
objectValueForTableColumn:(NSTableColumn *)tCol row:(int)r {
return [[backingStore allKeys] objectAtIndex:r];
}

@implementation ABPerson ( ABRecordAdditions )
- (void)newEntry {
// add entry to the backingStore
NSString *k = [self getFullName]; // defined below
NSString *kValue = [self description]; // overridden below
[[[[Controller alloc] backingStore] autorelease] setObject:kValue
forKey:k];
}

- (NSString *)getFullName {
NSLog (@"%@, %@ %@ %@ %@", [self
valueForProperty:kABLastNameProperty], [self
valueForProperty:kABFirstNameProperty], [self
valueForProperty:kABMiddleNameProperty], [self
valueForProperty:kABSuffixProperty], [self
valueForProperty:kABOrganizationProperty]);
if ([self valueForProperty:kABLastNameProperty] != NULL || [self
valueForProperty:kABFirstNameProperty] != NULL|| [self
valueForProperty:kABMiddleNameProperty] != NULL) return [NSString
stringWithFormat:@"%@, %@ %@ %@", [self
valueForProperty:kABLastNameProperty], [self
valueForProperty:kABFirstNameProperty], [self
valueForProperty:kABMiddleNameProperty], [self
valueForProperty:kABSuffixProperty]];
else return [self valueForProperty:kABOrganizationProperty];
}
- (NSString *)description {
NSMutableString *ret = [NSMutableString stringWithFormat:@"%@",
[self getFullName]]; // place the key first
[ret appendString:[NSString stringWithFormat:@"\n%@",[self
valueForProperty:kABPhoneProperty]]]; // the phone number
[ret appendString:[NSString stringWithFormat:@"\n%@", [self
valueForProperty:kABEmailProperty]]]; // the email address
[ret appendString:[NSString stringWithFormat:@"\n%@", [self
valueForProperty:kABAddressProperty]]]; // now, the address
[ret appendString:[NSString stringWithFormat:@"\n%@", [self
valueForProperty:kABHomePageProperty]]]; // person's homepage
if (nil != [self valueForProperty:kABAIMInstantProperty]) [ret
appendString:[NSString stringWithFormat:@"\nAIM: %@", [self
valueForProperty:kABAIMInstantProperty]]];
return [ret autorelease];
}

Hasan Diwan
OpenPGP KeyID: 0x7EE3855B
Fingerprint: 42F0 5758 C3EB BA1F ABD2 ED49 3390 CCF0 7EE3 855B
http://www.cs.rpi.edu/~diwanh/gpg.key

[demime 0.98b removed an attachment of type application/pgp-signature which had a name of PGP.sig]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: AddressBook issues
      • From: Henri Lamiraux <email@hidden>
    • Re: AddressBook issues
      • From: Henri Lamiraux <email@hidden>
  • Prev by Date: Problems with NSSocketPort
  • Next by Date: Converting four char code
  • Previous by thread: Re: Problems with NSSocketPort
  • Next by thread: Re: AddressBook issues
  • Index(es):
    • Date
    • Thread