#import "TelParsedResult.h"
#import "CallAction.h"
-#define PREFIX @"tel:"
-
@implementation TelParsedResult
@synthesize number;
-- initWithNumber:(NSString *)n {
+- (id)initWithNumber:(NSString *)n {
if ((self = [super init]) != nil) {
self.number = n;
}
return self;
}
-+ parsedResultForString:(NSString *)s {
- NSRange telRange = [s rangeOfString:PREFIX options:NSCaseInsensitiveSearch];
- if (telRange.location == 0) {
- int restStart = telRange.location + telRange.length;
- return [[[self alloc] initWithNumber:[s substringFromIndex:restStart]]
- autorelease];
- }
- return nil;
-}
-
- (NSString *)stringForDisplay {
return self.number;
}
-- (NSArray *)actions {
- return [NSArray arrayWithObject:[CallAction actionWithNumber:self.number]];
+
++ (NSString *)typeName {
+ return NSLocalizedString(@"TelParsedResult type name", @"Tel");
+}
+
+- (UIImage *)icon {
+ return [UIImage imageNamed:@"phone.png"];
+}
+
+- (void)populateActions {
+ [actions addObject:[CallAction actionWithNumber:self.number]];
}
- (void) dealloc {