aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-04-30 21:28:40 +0000
committerBibiko <bibiko@eva.mpg.de>2009-04-30 21:28:40 +0000
commitc6d9ccf48dcc12c907fd6e86035b5964972ab881 (patch)
tree0619736b463a946653f847e45a24186e5d5b2d5b /Source
parente322bb1f2baf8c5f91ab6d676e81c682e93291ea (diff)
downloadsequelpro-c6d9ccf48dcc12c907fd6e86035b5964972ab881.tar.gz
sequelpro-c6d9ccf48dcc12c907fd6e86035b5964972ab881.tar.bz2
sequelpro-c6d9ccf48dcc12c907fd6e86035b5964972ab881.zip
• added "MySQL Help" to the MainMenu > Help submenu
- it shows the MySQL Help TOC of the front most tableDocument mysql connection, i.e. each tableDocument has its own Help window (due to the fact that the Help is version specific), and makes it the keyWindow - changed the way for getting the mySQLversion into the CustomQuery; now a new tableDocument set it via [customQueryInstance setMySQLversion:foo]; the other way was to unsafe regarding to get the version if MySQL Help was invoked via MainMenu • Help window and Create Table Syntax window will be released while closing the tableDocument
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];
}