diff options
author | stuconnolly <stuart02@gmail.com> | 2011-09-04 13:30:26 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-09-04 13:30:26 +0000 |
commit | 7b69d7481a828f4466335dd988da5ee3bc35af33 (patch) | |
tree | f10244d4300b7ef272062cdcf63535730e4f8131 /Source/SPDatabaseDocument.m | |
parent | 41d0618a58f4f047ce453577d1b2b01a29761705 (diff) | |
download | sequelpro-7b69d7481a828f4466335dd988da5ee3bc35af33.tar.gz sequelpro-7b69d7481a828f4466335dd988da5ee3bc35af33.tar.bz2 sequelpro-7b69d7481a828f4466335dd988da5ee3bc35af33.zip |
Fix for issue 1168. Whenever the database is changed load all of the currently used relation names in a backgroud thread. In the event that the user opens the add new relation sheet during this process, the ability to enter a relation name and confirm the addition is disabled until the retrieval process is complete. There is also a new progress indicator on the add sheet to indicate this.
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r-- | Source/SPDatabaseDocument.m | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 52858787..a6b905b2 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -73,6 +73,7 @@ enum { #import "SPDatabaseCopy.h" #import "SPTableCopy.h" #import "SPDatabaseRename.h" +#import "SPTableRelations.h" #endif #import "SPServerSupport.h" #ifndef SP_REFACTOR /* headers */ @@ -227,6 +228,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax"; // Set the connection controller's delegate [connectionController setDelegate:self]; + return connectionController; } @@ -5890,7 +5892,6 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax"; #endif } - /** * Select the specified database and, optionally, table. */ @@ -5923,7 +5924,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax"; // End the task first to ensure the database dropdown can be reselected [self endTask]; - if ( [mySQLConnection isConnected] ) { + if ([mySQLConnection isConnected]) { // Update the database list [[self onMainThread] setDatabases:self]; @@ -5970,10 +5971,14 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax"; // Set focus to table list filter field if visible // otherwise set focus to Table List view - if ( [[tablesListInstance tables] count] > 20 ) + if ([[tablesListInstance tables] count] > 20) { [[parentWindow onMainThread] makeFirstResponder:listFilterField]; - else + } + else { [[parentWindow onMainThread] makeFirstResponder:[tablesListInstance valueForKeyPath:@"tablesListView"]]; + } + + [tableRelationsInstance loadUsedRelationNames]; #endif } @@ -6031,8 +6036,9 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax"; #endif #ifdef SP_REFACTOR /* glue */ - if ( delegate && [delegate respondsToSelector:@selector(databaseDidChange:)] ) + if (delegate && [delegate respondsToSelector:@selector(databaseDidChange:)]) { [delegate performSelectorOnMainThread:@selector(databaseDidChange:) withObject:self waitUntilDone:NO]; + } #endif [taskPool drain]; |