From 5b680d16c49428e768eb70c49bc41ec0cdd174b2 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 28 Jan 2011 08:12:59 +0000 Subject: =?UTF-8?q?=E2=80=A2=20changed=20in=20HTML=20output=20window=20the?= =?UTF-8?q?=20link=20behaviour=20of=20file://=20URL=20scheme;=20now=20it?= =?UTF-8?q?=20will=20be=20handled=20by=20the=20webview=20since=20it=20can?= =?UTF-8?q?=20be=20an=20HTML=20file=20-=20in=20addition=20introduced=20URL?= =?UTF-8?q?=20scheme=20sp-reveal-file://=20which=20reveals=20the=20passed?= =?UTF-8?q?=20file=20in=20Finder=20and=20sp-open-file://=20which=20opens?= =?UTF-8?q?=20the=20passed=20file=20with=20the=20default=20application?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPBundleHTMLOutputController.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m index 3c47964a..9fee7358 100644 --- a/Source/SPBundleHTMLOutputController.m +++ b/Source/SPBundleHTMLOutputController.m @@ -263,6 +263,7 @@ - (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id)listener { + NSInteger navigationType = [[actionInformation objectForKey:WebActionNavigationTypeKey] integerValue]; // sequelpro:// handler @@ -270,9 +271,14 @@ [[NSApp delegate] handleEventWithURL:[request URL]]; [listener ignore]; } - // file://a_file_path opens the reveal the file in Finder - else if([[[request URL] scheme] isEqualToString:@"file"] && navigationType == WebNavigationTypeLinkClicked) { - [[NSWorkspace sharedWorkspace] selectFile:[[[request mainDocumentURL] absoluteString] substringFromIndex:6] inFileViewerRootedAtPath:nil]; + // sp-reveal-file://a_file_path reveals the file in Finder + else if([[[request URL] scheme] isEqualToString:@"sp-reveal-file"] && navigationType == WebNavigationTypeLinkClicked) { + [[NSWorkspace sharedWorkspace] selectFile:[[[request mainDocumentURL] absoluteString] substringFromIndex:16] inFileViewerRootedAtPath:nil]; + [listener ignore]; + } + // sp-open-file://a_file_path opens the file with the default + else if([[[request URL] scheme] isEqualToString:@"sp-open-file"] && navigationType == WebNavigationTypeLinkClicked) { + [[NSWorkspace sharedWorkspace] openFile:[[[request mainDocumentURL] absoluteString] substringFromIndex:14]]; [listener ignore]; } else { -- cgit v1.2.3