aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CustomQuery.h4
-rw-r--r--Source/CustomQuery.m31
-rw-r--r--Source/TableDocument.h1
-rw-r--r--Source/TableDocument.m18
4 files changed, 43 insertions, 11 deletions
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h
index 1fae3b5d..72cc749c 100644
--- a/Source/CustomQuery.h
+++ b/Source/CustomQuery.h
@@ -31,6 +31,8 @@
#import "CMMCPResult.h"
#import "RegexKitLite.h"
+#define SP_HELP_TOC_SEARCH_STRING @"contents"
+
@interface CustomQuery : NSObject {
IBOutlet id tableWindow;
@@ -123,6 +125,8 @@
- (void)showHelpFor:(NSString *)aString addToHistory:(BOOL)addToHistory;
- (void)helpTargetValidation;
- (void)openMySQLonlineDocumentationWithString:(NSString *)searchString;
+- (NSWindow *)helpWebViewWindow;
+- (void)setMySQLversion:(NSString *)theVersion;
// Other
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 10cf95f7..755b980f 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -37,7 +37,6 @@
#define SP_HELP_SHOW_TOC_BUTTON 1
#define SP_HELP_GOFORWARD_BUTTON 2
#define SP_HELP_NOT_AVAILABLE @"__no_help_available"
-#define SP_HELP_TOC_SEARCH_STRING @"contents"
@implementation CustomQuery
@@ -1383,6 +1382,21 @@ traps enter key and
#pragma mark -
#pragma mark MySQL Help
+/*
+ * Set the MySQL version as X.Y for Help window title and online search
+ */
+- (void)setMySQLversion:(NSString *)theVersion
+{
+ mySQLversion = [[theVersion substringToIndex:3] retain];
+}
+
+/*
+ * Return the Help window.
+ */
+- (NSWindow *)helpWebViewWindow
+{
+ return helpWebViewWindow;
+}
/*
* Show the data for "HELP 'searchString'".
@@ -1390,18 +1404,13 @@ traps enter key and
- (void)showHelpFor:(NSString *)searchString addToHistory:(BOOL)addToHistory
{
NSString * helpString = [self getHTMLformattedMySQLHelpFor:searchString];
+
// Order out resp. init the Help window if not visible
if(![helpWebViewWindow isVisible])
{
- // get current MySQL version for title and online search
- mySQLversion = [[[(TableDocument *)[[textView window] delegate] mySQLVersion] substringToIndex:3] retain];
-
+ // set title of the Help window
[helpWebViewWindow setTitle:[NSString stringWithFormat:@"%@ (%@ %@)", NSLocalizedString(@"MySQL Help", @"mysql help"), NSLocalizedString(@"version", @"version"), mySQLversion]];
-
- // init search history
- [helpWebView setMaintainsBackForwardList:YES];
- [[helpWebView backForwardList] setCapacity:20];
-
+
// init goback/forward buttons
if([[helpWebView backForwardList] backListCount] < 1)
{
@@ -1872,6 +1881,10 @@ traps enter key and
NSBeep();
}
+ // init search history
+ [helpWebView setMaintainsBackForwardList:YES];
+ [[helpWebView backForwardList] setCapacity:20];
+
return self;
}
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index fb35d612..94e95047 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -134,6 +134,7 @@
- (IBAction)addDatabase:(id)sender;
- (IBAction)closeDatabaseSheet:(id)sender;
- (IBAction)removeDatabase:(id)sender;
+- (IBAction)showMySQLHelp:(id)sender;
//encoding methods
- (void)setConnectionEncoding:(NSString *)mysqlEncoding reloadingViews:(BOOL)reloadViews;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 3acb53b4..ecbe6d86 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -339,6 +339,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
[tableSourceInstance setConnection:mySQLConnection];
[tableContentInstance setConnection:mySQLConnection];
[customQueryInstance setConnection:mySQLConnection];
+ [customQueryInstance setMySQLversion:mySQLVersion];
[tableDumpInstance setConnection:mySQLConnection];
[spExportControllerInstance setConnection:mySQLConnection];
[tableStatusInstance setConnection:mySQLConnection];
@@ -1436,11 +1437,22 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
return [self export:sender];
}
+/*
+ * Show the MySQL Help TOC of the current MySQL connection
+ * Invoked by the MainMenu > Help > MySQL Help
+ */
+- (IBAction)showMySQLHelp:(id)sender
+{
+ [customQueryInstance showHelpFor:SP_HELP_TOC_SEARCH_STRING addToHistory:YES];
+ [[customQueryInstance helpWebViewWindow] makeKeyWindow];
+}
+
+
/**
* Menu validation
*/
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
-{
+{
if ([menuItem action] == @selector(import:) ||
[menuItem action] == @selector(export:) ||
[menuItem action] == @selector(exportMultipleTables:) ||
@@ -1816,7 +1828,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
//set up toolbar
[self setupToolbar];
- // [self connectToDB:nil];
+ // [self connectToDB:nil];
[self performSelector:@selector(connectToDB:) withObject:tableWindow afterDelay:0.0f];
if([prefs boolForKey:@"SelectLastFavoriteUsed"] == YES){
@@ -1835,6 +1847,8 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
{
if ([mySQLConnection isConnected]) [self closeConnection];
if ([[[SPQueryConsole sharedQueryConsole] window] isVisible]) [self toggleConsole:self];
+ [[customQueryInstance helpWebViewWindow] release];
+ [createTableSyntaxWindow release];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}