diff options
author | rowanbeentje <rowan@beent.je> | 2012-08-30 00:28:56 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-08-30 00:28:56 +0000 |
commit | 28734c995b3f97d8eb50610cfd6d7ad62697d2cb (patch) | |
tree | 243d4d6e188c3a450d84396395dd101cc3569ca9 /Source/SPTablesList.m | |
parent | 83e1b0430ef46225aa1c1108e960c3758d5086e3 (diff) | |
download | sequelpro-28734c995b3f97d8eb50610cfd6d7ad62697d2cb.tar.gz sequelpro-28734c995b3f97d8eb50610cfd6d7ad62697d2cb.tar.bz2 sequelpro-28734c995b3f97d8eb50610cfd6d7ad62697d2cb.zip |
- Fix the SPSplitView helper to correctly restore focus to focussed responders in an expanding view at the end of the animation
- On initial launch, and when changing database, ensure that the window focus is set to the table list or the table list filter or the table list as appropriate. This addresses Issue #1437.
- Clean up some logic
Diffstat (limited to 'Source/SPTablesList.m')
-rw-r--r-- | Source/SPTablesList.m | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index cbe4d4da..30e22eab 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -264,29 +264,18 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; // Check for mysql errors - if information_schema is not accessible for some reasons // omit adding procedures and functions - if(![mySQLConnection queryErrored] && theResult != nil && [theResult numberOfRows] ) { + if(![mySQLConnection queryErrored] && theResult != nil && [theResult numberOfRows] && [theResult numberOfFields] > 3) { // Add the header row [tables addObject:NSLocalizedString(@"PROCS & FUNCS",@"header for procs & funcs list")]; [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeNone]]; - if( [theResult numberOfFields] == 1 ) { - for (NSArray *eachRow in theResult) { - [tables addObject:NSArrayObjectAtIndex(eachRow, 3)]; - if ([NSArrayObjectAtIndex(eachRow, 4) isEqualToString:@"PROCEDURE"]) { - [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeProc]]; - } else { - [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeFunc]]; - } - } - } else { - for (NSArray *eachRow in theResult) { - [tables addObject:NSArrayObjectAtIndex(eachRow, 3)]; - if ([NSArrayObjectAtIndex(eachRow, 4) isEqualToString:@"PROCEDURE"]) { - [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeProc]]; - } else { - [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeFunc]]; - } + for (NSArray *eachRow in theResult) { + [tables addObject:NSArrayObjectAtIndex(eachRow, 3)]; + if ([NSArrayObjectAtIndex(eachRow, 4) isEqualToString:@"PROCEDURE"]) { + [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeProc]]; + } else { + [tableTypes addObject:[NSNumber numberWithInteger:SPTableTypeFunc]]; } } } @@ -1830,20 +1819,26 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; } /** - * Set focus to table list filter search field + * Set focus to table list filter search field, or the table list if the filter + * field is not visible. */ - (void) makeTableListFilterHaveFocus { if([tables count] > 20) { [[tableDocumentInstance parentWindow] makeFirstResponder:listFilterField]; } - else if([tables count] > 2) { + else { [[tableDocumentInstance parentWindow] makeFirstResponder:tablesListView]; - if([tablesListView numberOfSelectedRows] < 1) - [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO]; - } } + +/** + * Set focus to the table list. + */ +- (void) makeTableListHaveFocus +{ + [[tableDocumentInstance parentWindow] makeFirstResponder:tablesListView]; +} #endif /** |