5 // Created by Christian Brunschen on 29/05/2008.
7 * Copyright 2008 ZXing authors
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
22 #import "URIParsedResult.h"
23 #import "OpenUrlAction.h"
24 #import "EmailAction.h"
28 @implementation URIParsedResult
30 @synthesize urlString;
34 - (ResultAction *)createAction {
35 return [OpenUrlAction actionWithURL:self.URL];
38 - (id)initWithURLString:(NSString *)s title:(NSString *)t URL:(NSURL *)url {
39 if ((self = [super init]) != nil) {
47 - (id)initWithURLString:(NSString *)s URL:(NSURL *)url {
48 return [self initWithURLString:s title:nil URL:url];
51 - (id)initWithURLString:(NSString *)s title:(NSString *)t {
52 return [self initWithURLString:s title:t URL:[NSURL URLWithString:s]];
55 - (id)initWithURLString:(NSString *)s {
56 return [self initWithURLString:s title:nil URL:[NSURL URLWithString:s]];
59 - (NSString *)stringForDisplay {
61 [NSString stringWithFormat:@"%@ <%@>", self.title, self.urlString] :
65 + (NSString *)typeName {
66 return NSLocalizedString(@"URIParsedResult type name", @"URI");
70 return [UIImage imageNamed:@"link2.png"];
73 - (void)populateActions {
75 NSLog(@"creating action to open URL '%@'", self.urlString);
78 [actions addObject:[self createAction]];