From 86b0a94eab63cf4b0835f620a9902bee26c3853c Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 28 Apr 2009 15:03:56 +0000 Subject: =?UTF-8?q?=E2=80=A2=20MySQL=20Help=20-=20if=20the=20connected=20d?= =?UTF-8?q?atabase=20doesn't=20support=20the=20HELP=20statement=20or=20the?= =?UTF-8?q?=20admin=20deleted=20the=20help=20tables=20in=20mysql=20the=20s?= =?UTF-8?q?earch=20falls=20back=20to=20the=20online=20search=20according?= =?UTF-8?q?=20to=20the=20connected=20mysql=20version=20-=20changed=20sligh?= =?UTF-8?q?tly=20the=20example=20css=20output=20style?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CustomQuery.m | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 419085fd..6064c979 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -1374,10 +1374,7 @@ traps enter key and if(![helpWebViewWindow isVisible]) { mySQLversion = [[[(TableDocument *)[[textView window] delegate] mySQLVersion] substringToIndex:3] retain]; - [helpWebViewWindow setTitle:[NSString stringWithFormat:@"%@ (%@ %@)", - NSLocalizedString(@"MySQL Help", @"mysql help"), - NSLocalizedString(@"version", @"version"), - mySQLversion]]; + [helpWebViewWindow setTitle:[NSString stringWithFormat:@"%@ (%@ %@)", NSLocalizedString(@"MySQL Help", @"mysql help"), NSLocalizedString(@"version", @"version"), mySQLversion]]; [helpWebView setMaintainsBackForwardList:YES]; [[helpWebView backForwardList] setCapacity:20]; if([[helpWebView backForwardList] backListCount] < 1) @@ -1388,7 +1385,8 @@ traps enter key and [helpNavigator setEnabled:[[helpWebView backForwardList] backListCount] forSegment:0]; [helpNavigator setEnabled:[[helpWebView backForwardList] forwardListCount] forSegment:2]; } - [helpWebViewWindow orderFront:helpWebView]; + if(![helpString isEqualToString:@"__no_help_available"]) + [helpWebViewWindow orderFront:helpWebView]; helpTarget = 2; // set default to search in MySQL help [self helpTargetValidation]; } @@ -1575,6 +1573,9 @@ traps enter key and @" .code {" @" font-family:Monaco;" @" }" + @" .example {" + @" font-family:Courier;" + @" }" @" .searchstring {" @" }" @" .header {" @@ -1587,7 +1588,16 @@ traps enter key and ]; theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"HELP '%@'", aString]]; - if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] || ![theResult numOfRows]) return @""; + if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] || ![theResult numOfRows]) + { + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: + [[NSString stringWithFormat: + MYSQL_DEV_SEARCH_URL, + aString, + [mySQLversion stringByReplacingOccurrencesOfString:@"." withString:@""]] + stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]]; + return @"__no_help_available"; + } tableDetails = [[NSDictionary alloc] initWithDictionary:[theResult fetchRowAsDictionary]]; @@ -1661,7 +1671,7 @@ traps enter key and if([tableDetails objectForKey:@"example"]){ NSString *examples = [[[tableDetails objectForKey:@"example"] copy] autorelease]; if([examples length]){ - [theHelp appendString:@"

Example:

"];
+				[theHelp appendString:@"
Example:
"];
 				[theHelp appendString:examples];
 				[theHelp appendString:@"
"]; } -- cgit v1.2.3