diff --git a/iphone/ZXingWidget/Classes/actions/AddContactAction.h b/iphone/ZXingWidget/Classes/actions/AddContactAction.h index ac6af6f8e..dd29145d2 100644 --- a/iphone/ZXingWidget/Classes/actions/AddContactAction.h +++ b/iphone/ZXingWidget/Classes/actions/AddContactAction.h @@ -30,6 +30,7 @@ NSString *email; NSString *urlString; NSString *address; + NSString *organization; UIViewController *viewController; } @@ -40,12 +41,14 @@ @property (nonatomic, copy) NSString *email; @property (nonatomic, copy) NSString *urlString; @property (nonatomic, copy) NSString *address; +@property (nonatomic, copy) NSString *organization; + (id)actionWithName:(NSString *)n phoneNumbers:(NSArray *)nums email:(NSString *)em url:(NSString *)us address:(NSString *)ad - note:(NSString *)nt; + note:(NSString *)nt + organization:(NSString *)org; @end diff --git a/iphone/ZXingWidget/Classes/actions/AddContactAction.m b/iphone/ZXingWidget/Classes/actions/AddContactAction.m index 393091384..d8c440a82 100644 --- a/iphone/ZXingWidget/Classes/actions/AddContactAction.m +++ b/iphone/ZXingWidget/Classes/actions/AddContactAction.m @@ -31,13 +31,15 @@ @synthesize email; @synthesize urlString; @synthesize address; +@synthesize organization; + (id)actionWithName:(NSString *)n phoneNumbers:(NSArray *)nums email:(NSString *)em url:(NSString *)us address:(NSString *)ad - note:(NSString *)nt { + note:(NSString *)nt + organization:(NSString *)org { AddContactAction *aca = [[[self alloc] init] autorelease]; aca.name = n; aca.phoneNumbers = nums; @@ -45,6 +47,7 @@ aca.urlString = us; aca.address = ad; aca.note = nt; + aca.organization = org; return aca; } @@ -89,6 +92,10 @@ ABRecordSetValue(person, kABPersonNoteProperty, self.note, error); } + if (self.organization) { + ABRecordSetValue(person, kABPersonOrganizationProperty, (CFStringRef)self.organization, error); + } + if (self.phoneNumbers && self.phoneNumbers.count > 0) { // multi-values: nultiple phone numbers ABMutableMultiValueRef phoneNumberMultiValue = @@ -221,4 +228,14 @@ [self performSelector:@selector(dismissUnknownPersonViewController:) withObject:unknownPersonViewController afterDelay:0.0]; } } + +- (void)dealloc { + [name release]; + [phoneNumbers release]; + [note release]; + [email release]; + [urlString release]; + [address release]; + [organization release]; +} @end diff --git a/iphone/ZXingWidget/Classes/parsedResults/BusinessCardParsedResult.h b/iphone/ZXingWidget/Classes/parsedResults/BusinessCardParsedResult.h index 8e7482e4c..781b0203e 100644 --- a/iphone/ZXingWidget/Classes/parsedResults/BusinessCardParsedResult.h +++ b/iphone/ZXingWidget/Classes/parsedResults/BusinessCardParsedResult.h @@ -29,6 +29,7 @@ NSString *email; NSString *urlString; NSString *address; + NSString *organization; } @property (nonatomic, copy) NSString *name; @@ -37,5 +38,6 @@ @property (nonatomic, copy) NSString *email; @property (nonatomic, copy) NSString *urlString; @property (nonatomic, copy) NSString *address; +@property (nonatomic, copy) NSString *organization; @end diff --git a/iphone/ZXingWidget/Classes/parsedResults/BusinessCardParsedResult.m b/iphone/ZXingWidget/Classes/parsedResults/BusinessCardParsedResult.m index ce018df0e..9d91ddb2f 100644 --- a/iphone/ZXingWidget/Classes/parsedResults/BusinessCardParsedResult.m +++ b/iphone/ZXingWidget/Classes/parsedResults/BusinessCardParsedResult.m @@ -30,9 +30,11 @@ @synthesize email; @synthesize urlString; @synthesize address; +@synthesize organization; - (NSString *)stringForDisplay { NSMutableString *result = [NSMutableString stringWithString:self.name]; + if (self.organization) [result appendFormat:@"\n%@",self.organization]; if (self.phoneNumbers) { for (NSString *number in self.phoneNumbers) { [result appendFormat:@"\n%@", number]; @@ -60,7 +62,8 @@ email:self.email url:self.urlString address:self.address - note:self.note]]; + note:self.note + organization:self.organization]]; } - (void) dealloc { @@ -70,6 +73,7 @@ [urlString release]; [address release]; [note release]; + [organization release]; [super dealloc]; } diff --git a/iphone/ZXingWidget/Classes/resultParsers/MeCardParser.m b/iphone/ZXingWidget/Classes/resultParsers/MeCardParser.m index 77d4e6df2..f93e29590 100644 --- a/iphone/ZXingWidget/Classes/resultParsers/MeCardParser.m +++ b/iphone/ZXingWidget/Classes/resultParsers/MeCardParser.m @@ -46,6 +46,7 @@ result.note = [s fieldWithPrefix:@"NOTE:"]; result.urlString = [s fieldWithPrefix:@"URL:"]; result.address = [s fieldWithPrefix:@"ADR:"]; + result.organization = [s fieldWithPrefix:@"ORG:"]; return [result autorelease]; }