mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
[iphone/ZXingWidget] added support for non standard ORG attribute in MECARD format
git-svn-id: https://zxing.googlecode.com/svn/trunk@1694 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
5e5ac2153e
commit
79381116c1
|
@ -30,6 +30,7 @@
|
||||||
NSString *email;
|
NSString *email;
|
||||||
NSString *urlString;
|
NSString *urlString;
|
||||||
NSString *address;
|
NSString *address;
|
||||||
|
NSString *organization;
|
||||||
|
|
||||||
UIViewController *viewController;
|
UIViewController *viewController;
|
||||||
}
|
}
|
||||||
|
@ -40,12 +41,14 @@
|
||||||
@property (nonatomic, copy) NSString *email;
|
@property (nonatomic, copy) NSString *email;
|
||||||
@property (nonatomic, copy) NSString *urlString;
|
@property (nonatomic, copy) NSString *urlString;
|
||||||
@property (nonatomic, copy) NSString *address;
|
@property (nonatomic, copy) NSString *address;
|
||||||
|
@property (nonatomic, copy) NSString *organization;
|
||||||
|
|
||||||
+ (id)actionWithName:(NSString *)n
|
+ (id)actionWithName:(NSString *)n
|
||||||
phoneNumbers:(NSArray *)nums
|
phoneNumbers:(NSArray *)nums
|
||||||
email:(NSString *)em
|
email:(NSString *)em
|
||||||
url:(NSString *)us
|
url:(NSString *)us
|
||||||
address:(NSString *)ad
|
address:(NSString *)ad
|
||||||
note:(NSString *)nt;
|
note:(NSString *)nt
|
||||||
|
organization:(NSString *)org;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -31,13 +31,15 @@
|
||||||
@synthesize email;
|
@synthesize email;
|
||||||
@synthesize urlString;
|
@synthesize urlString;
|
||||||
@synthesize address;
|
@synthesize address;
|
||||||
|
@synthesize organization;
|
||||||
|
|
||||||
+ (id)actionWithName:(NSString *)n
|
+ (id)actionWithName:(NSString *)n
|
||||||
phoneNumbers:(NSArray *)nums
|
phoneNumbers:(NSArray *)nums
|
||||||
email:(NSString *)em
|
email:(NSString *)em
|
||||||
url:(NSString *)us
|
url:(NSString *)us
|
||||||
address:(NSString *)ad
|
address:(NSString *)ad
|
||||||
note:(NSString *)nt {
|
note:(NSString *)nt
|
||||||
|
organization:(NSString *)org {
|
||||||
AddContactAction *aca = [[[self alloc] init] autorelease];
|
AddContactAction *aca = [[[self alloc] init] autorelease];
|
||||||
aca.name = n;
|
aca.name = n;
|
||||||
aca.phoneNumbers = nums;
|
aca.phoneNumbers = nums;
|
||||||
|
@ -45,6 +47,7 @@
|
||||||
aca.urlString = us;
|
aca.urlString = us;
|
||||||
aca.address = ad;
|
aca.address = ad;
|
||||||
aca.note = nt;
|
aca.note = nt;
|
||||||
|
aca.organization = org;
|
||||||
return aca;
|
return aca;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +92,10 @@
|
||||||
ABRecordSetValue(person, kABPersonNoteProperty, self.note, error);
|
ABRecordSetValue(person, kABPersonNoteProperty, self.note, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.organization) {
|
||||||
|
ABRecordSetValue(person, kABPersonOrganizationProperty, (CFStringRef)self.organization, error);
|
||||||
|
}
|
||||||
|
|
||||||
if (self.phoneNumbers && self.phoneNumbers.count > 0) {
|
if (self.phoneNumbers && self.phoneNumbers.count > 0) {
|
||||||
// multi-values: nultiple phone numbers
|
// multi-values: nultiple phone numbers
|
||||||
ABMutableMultiValueRef phoneNumberMultiValue =
|
ABMutableMultiValueRef phoneNumberMultiValue =
|
||||||
|
@ -221,4 +228,14 @@
|
||||||
[self performSelector:@selector(dismissUnknownPersonViewController:) withObject:unknownPersonViewController afterDelay:0.0];
|
[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
|
@end
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
NSString *email;
|
NSString *email;
|
||||||
NSString *urlString;
|
NSString *urlString;
|
||||||
NSString *address;
|
NSString *address;
|
||||||
|
NSString *organization;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, copy) NSString *name;
|
@property (nonatomic, copy) NSString *name;
|
||||||
|
@ -37,5 +38,6 @@
|
||||||
@property (nonatomic, copy) NSString *email;
|
@property (nonatomic, copy) NSString *email;
|
||||||
@property (nonatomic, copy) NSString *urlString;
|
@property (nonatomic, copy) NSString *urlString;
|
||||||
@property (nonatomic, copy) NSString *address;
|
@property (nonatomic, copy) NSString *address;
|
||||||
|
@property (nonatomic, copy) NSString *organization;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -30,9 +30,11 @@
|
||||||
@synthesize email;
|
@synthesize email;
|
||||||
@synthesize urlString;
|
@synthesize urlString;
|
||||||
@synthesize address;
|
@synthesize address;
|
||||||
|
@synthesize organization;
|
||||||
|
|
||||||
- (NSString *)stringForDisplay {
|
- (NSString *)stringForDisplay {
|
||||||
NSMutableString *result = [NSMutableString stringWithString:self.name];
|
NSMutableString *result = [NSMutableString stringWithString:self.name];
|
||||||
|
if (self.organization) [result appendFormat:@"\n%@",self.organization];
|
||||||
if (self.phoneNumbers) {
|
if (self.phoneNumbers) {
|
||||||
for (NSString *number in self.phoneNumbers) {
|
for (NSString *number in self.phoneNumbers) {
|
||||||
[result appendFormat:@"\n%@", number];
|
[result appendFormat:@"\n%@", number];
|
||||||
|
@ -60,7 +62,8 @@
|
||||||
email:self.email
|
email:self.email
|
||||||
url:self.urlString
|
url:self.urlString
|
||||||
address:self.address
|
address:self.address
|
||||||
note:self.note]];
|
note:self.note
|
||||||
|
organization:self.organization]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc {
|
- (void) dealloc {
|
||||||
|
@ -70,6 +73,7 @@
|
||||||
[urlString release];
|
[urlString release];
|
||||||
[address release];
|
[address release];
|
||||||
[note release];
|
[note release];
|
||||||
|
[organization release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
result.note = [s fieldWithPrefix:@"NOTE:"];
|
result.note = [s fieldWithPrefix:@"NOTE:"];
|
||||||
result.urlString = [s fieldWithPrefix:@"URL:"];
|
result.urlString = [s fieldWithPrefix:@"URL:"];
|
||||||
result.address = [s fieldWithPrefix:@"ADR:"];
|
result.address = [s fieldWithPrefix:@"ADR:"];
|
||||||
|
result.organization = [s fieldWithPrefix:@"ORG:"];
|
||||||
|
|
||||||
return [result autorelease];
|
return [result autorelease];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue