From b5bcd962ab29b4d7c455c98e03b429b3c6b11e92 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Mon, 22 Nov 2010 21:43:22 +0000 Subject: * enabled sequel:// url scheme commands from inside the Bundle HTML output window --- Source/SPAppController.h | 2 ++ Source/SPAppController.m | 7 +++++-- Source/SPBundleHTMLOutputController.m | 29 +++++++++++++++++++---------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/Source/SPAppController.h b/Source/SPAppController.h index e4508521..3c18911e 100644 --- a/Source/SPAppController.h +++ b/Source/SPAppController.h @@ -94,4 +94,6 @@ - (NSArray *)bundleItemsForScope:(NSString*)scope; - (NSDictionary *)bundleKeyEquivalentsForScope:(NSString*)scope; +- (void)handleEventWithURL:(NSURL*)url; + @end diff --git a/Source/SPAppController.m b/Source/SPAppController.m index 0a59287c..534b3741 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -528,7 +528,11 @@ { NSURL *url = [NSURL URLWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]]; - + [self handleEventWithURL:url]; +} + +- (void)handleEventWithURL:(NSURL*)url +{ NSString *command = [url host]; NSString *passedProcessID = [url user]; NSArray *parameter; @@ -588,7 +592,6 @@ NSLog(@"param: %@", parameter); NSLog(@"command: %@", command); NSLog(@"command id: %@", passedProcessID); - } #pragma mark - diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m index 0501dba9..56fdb63e 100644 --- a/Source/SPBundleHTMLOutputController.m +++ b/Source/SPBundleHTMLOutputController.m @@ -190,17 +190,26 @@ { NSInteger navigationType = [[actionInformation objectForKey:WebActionNavigationTypeKey] integerValue]; - switch(navigationType) { - case WebNavigationTypeLinkClicked: - [[webView mainFrame] loadRequest:request]; - [listener use]; - break; - case WebNavigationTypeReload: - [[webView mainFrame] loadHTMLString:[self initHTMLSourceString] baseURL:nil]; - break; - default: - [listener use]; + // sequelpro:// handler + if([[[request URL] scheme] isEqualToString:@"sequelpro"] && navigationType == WebNavigationTypeLinkClicked) { + [[NSApp delegate] handleEventWithURL:[request URL]]; + [listener ignore]; + } else { + + switch(navigationType) { + case WebNavigationTypeLinkClicked: + [[webView mainFrame] loadRequest:request]; + [listener use]; + break; + case WebNavigationTypeReload: + [[webView mainFrame] loadHTMLString:[self initHTMLSourceString] baseURL:nil]; + break; + default: + [listener use]; + } + } + } - (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame -- cgit v1.2.3