From 0e4ad8eb9cddbbd755d55bb50f7707f1e8160121 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 12 Oct 2014 22:41:36 +0200 Subject: Add a "Go to Database" dialog The dialog enables * searching for a database by name (substring matching), * using C&P to select databases * navigating to databases not in the database dropdown * faster keyboard-based navigation --- Source/SPDatabaseDocument.m | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Source/SPDatabaseDocument.m') diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 330716c3..9a736f90 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -109,6 +109,7 @@ enum { #endif #import "SPCharsetCollationHelper.h" +#import "SPGotoDatabaseController.h" #import @@ -206,6 +207,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; mySQLVersion = nil; allDatabases = nil; allSystemDatabases = nil; + gotoDatabaseController = nil; #ifndef SP_CODA /* init ivars */ mainToolbar = nil; @@ -1131,6 +1133,22 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; return [[SPNavigatorController sharedNavigatorController] allSchemaKeysForConnection:[self connectionID]]; } +- (IBAction)showGotoDatabase:(id)sender +{ + if(!gotoDatabaseController) { + gotoDatabaseController = [[SPGotoDatabaseController alloc] init]; + } + + NSMutableArray *dbList = [[NSMutableArray alloc] init]; + [dbList addObjectsFromArray:[self allSystemDatabaseNames]]; + [dbList addObjectsFromArray:[self allDatabaseNames]]; + [gotoDatabaseController setDatabaseList:[dbList autorelease]]; + + if([gotoDatabaseController runModal]) { + [self selectDatabase:[gotoDatabaseController selectedDatabase] item:nil]; + } +} + #ifndef SP_CODA /* console and navigator methods */ #pragma mark - @@ -6269,6 +6287,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [allDatabases release]; [allSystemDatabases release]; + [gotoDatabaseController release]; #ifndef SP_CODA /* dealloc ivars */ [undoManager release]; [printWebView release]; -- cgit v1.2.3