From 7b69d7481a828f4466335dd988da5ee3bc35af33 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 4 Sep 2011 13:30:26 +0000 Subject: 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. --- Source/SPDatabaseDocument.m | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'Source/SPDatabaseDocument.m') 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]; -- cgit v1.2.3