@@ -253,23 +253,6 @@ - (void) showNotification:(NSString *)browserIdentifier
253
253
[center deliverNotification: notification];
254
254
}
255
255
256
- - (void )getUrl : (NSAppleEventDescriptor *)event
257
- withReplyEvent : (NSAppleEventDescriptor *)replyEvent
258
- {
259
- // Get the URL
260
- NSString *urlStr = [[event paramDescriptorForKeyword: keyDirectObject]
261
- stringValue ];
262
- NSArray *urls = [NSArray arrayWithObject: [NSURL URLWithString: urlStr]];
263
-
264
- int options = NSWorkspaceLaunchAsync ;
265
-
266
- [[NSWorkspace sharedWorkspace ] openURLs: urls
267
- withAppBundleIdentifier: [[Browsers sharedInstance ] defaultBrowserIdentifier ]
268
- options: options
269
- additionalEventParamDescriptor: nil
270
- launchIdentifiers: nil ];
271
- }
272
-
273
256
- (BOOL )userNotificationCenter : (NSUserNotificationCenter *)center shouldPresentNotification : (NSUserNotification *)notification
274
257
{
275
258
return YES ;
@@ -300,4 +283,33 @@ -(void)displayAreWeDefaultMsg
300
283
}
301
284
}
302
285
286
+ #pragma mark - File Handlers
287
+
288
+ - (BOOL )application : (NSApplication *)theApplication openFile : (NSString *)filename
289
+ {
290
+ [self openWithBrowser: [NSString stringWithFormat: kLocalFileUri , filename]];
291
+ return YES ;
292
+ }
293
+
294
+ - (void )getUrl : (NSAppleEventDescriptor *)event
295
+ withReplyEvent : (NSAppleEventDescriptor *)replyEvent
296
+ {
297
+ [self openWithBrowser: [[event paramDescriptorForKeyword: keyDirectObject]
298
+ stringValue ]];
299
+ }
300
+
301
+ - (void )openWithBrowser : (NSString *)location
302
+ {
303
+
304
+ NSArray *urls = [NSArray arrayWithObject: [NSURL URLWithString: location]];
305
+
306
+ int options = NSWorkspaceLaunchAsync ;
307
+
308
+ [[NSWorkspace sharedWorkspace ] openURLs: urls
309
+ withAppBundleIdentifier: [[Browsers sharedInstance ] defaultBrowserIdentifier ]
310
+ options: options
311
+ additionalEventParamDescriptor: nil
312
+ launchIdentifiers: nil ];
313
+ }
314
+
303
315
@end
0 commit comments