aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-12-10 14:38:31 +0000
committerBibiko <bibiko@eva.mpg.de>2010-12-10 14:38:31 +0000
commitc1561b572cb258a8ff1b8290c56cc22604d4aadd (patch)
treeba7c874b6ad52a2e6ee6f43e18895e346f47e8e2 /Source
parente645692c25fbd9a40e9c7ab65f33f7748f77a211 (diff)
downloadsequelpro-c1561b572cb258a8ff1b8290c56cc22604d4aadd.tar.gz
sequelpro-c1561b572cb258a8ff1b8290c56cc22604d4aadd.tar.bz2
sequelpro-c1561b572cb258a8ff1b8290c56cc22604d4aadd.zip
• Bundle HTML output
- fixed init and release issue - started to allow JavaScript (from inside the HTML output window via js-object window.system) to communicate with SequelPro
Diffstat (limited to 'Source')
-rw-r--r--Source/SPBundleHTMLOutputController.m73
1 files changed, 62 insertions, 11 deletions
diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m
index a630eb06..8ae91400 100644
--- a/Source/SPBundleHTMLOutputController.m
+++ b/Source/SPBundleHTMLOutputController.m
@@ -26,8 +26,6 @@
#import "SPBundleHTMLOutputController.h"
#import "SPAlertSheets.h"
-
-
@implementation SPBundleHTMLOutputController
@synthesize docTitle;
@@ -44,6 +42,13 @@
[[self window] setReleasedWhenClosed:YES];
+ [webView setContinuousSpellCheckingEnabled:NO];
+ [webView setGroupName:@"SequelProBundleHTMLOutput"];
+ [webView setDrawsBackground:YES];
+ [webView setEditable:NO];
+ [webView setShouldCloseWithWindow:YES];
+ [webView setShouldUpdateWhileOffscreen:NO];
+
}
return self;
@@ -59,13 +64,6 @@
{
[super windowControllerDidLoadNib:aController];
- [webView setContinuousSpellCheckingEnabled:NO];
- [webView setGroupName:@"SequelProBundleHTMLOutput"];
- [webView setDrawsBackground:YES];
- [webView setEditable:NO];
- [webView setShouldCloseWithWindow:YES];
- [webView setShouldUpdateWhileOffscreen:NO];
-
}
- (void)displayHTMLContent:(NSString *)content withOptions:(NSDictionary *)displayOptions
@@ -114,9 +112,7 @@
- (void)dealloc
{
- if(webView) [webView release];
if(webPreferences) [webPreferences release];
- // [super dealloc];
}
- (void)keyDown:(NSEvent *)theEvent
@@ -222,6 +218,7 @@
[webView close];
[self setInitHTMLSourceString:@""];
windowUUID = @"";
+ [self release];
}
#pragma mark -
@@ -313,6 +310,60 @@
}
#pragma mark -
+#pragma mark JS support
+
+- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame
+{
+ NSLog(@"alert %@", message);
+}
+
+- (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame
+{
+ NSLog(@"confirm");
+ return NO;
+}
+
+- (NSString *)webView:(WebView *)sender runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WebFrame *)frame
+{
+ return @"be patient";
+}
+
+- (void)webView:(WebView *)sender windowScriptObjectAvailable: (WebScriptObject *)windowScriptObject
+{
+ [windowScriptObject setValue:self forKey:@"system"];
+}
+
++ (NSString *)webScriptNameForSelector:(SEL)aSelector
+{
+ if (aSelector == @selector(run:))
+ return @"run";
+ return @"";
+}
+
++ (BOOL)isSelectorExcludedFromWebScript:(SEL)selector {
+ if (selector == @selector(run:)) {
+ return NO;
+ }
+ return YES;
+}
+
++ (BOOL)isKeyExcludedFromWebScript:(const char *)property {
+ if (strcmp(property, "run") == 0) {
+ return NO;
+ }
+ return YES;
+}
+
+- (void) windowScriptObjectAvailable:(WebScriptObject*)webScriptObject {
+ [webScriptObject setValue:self forKey:@"system"];
+}
+
+- (NSString *)run:(NSString*)command
+{
+ return [NSString stringWithFormat:@"Hallo-%@", [command description]];
+}
+
+#pragma mark -
#pragma mark multi-touch trackpad support
/**