diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-06-16 15:46:03 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-06-16 15:46:03 +0000 |
commit | bb6e7a78be7fbb801f611d32bdc7c45b9961bb7e (patch) | |
tree | f4f3f1baa59e2e43e55bc40e45c27d87e227d150 /Source | |
parent | 6333eb96026649557a66d23efbf3746fd285307e (diff) | |
download | sequelpro-bb6e7a78be7fbb801f611d32bdc7c45b9961bb7e.tar.gz sequelpro-bb6e7a78be7fbb801f611d32bdc7c45b9961bb7e.tar.bz2 sequelpro-bb6e7a78be7fbb801f611d32bdc7c45b9961bb7e.zip |
• changed the behaviour of the "Duplicate Field" button in TableSource:
- if no field definition is selected "Duplicate Field" copies the last field structure defined in the table
Diffstat (limited to 'Source')
-rw-r--r-- | Source/TableSource.m | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Source/TableSource.m b/Source/TableSource.m index 6509fa24..91037469 100644 --- a/Source/TableSource.m +++ b/Source/TableSource.m @@ -77,7 +77,7 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab // Enable edit table button [editTableButton setEnabled:YES]; - + //query started [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self]; @@ -221,6 +221,11 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab [[tableSourceView enclosingScrollView] display]; [[tableSourceView enclosingScrollView] tile]; + // Enable 'Duplicate field' if at least one field is specified + // if no field is selected 'Duplicate field' will copy the last field + if([tableSourceView numberOfRows] > 0) + [copyFieldButton setEnabled:YES]; + //query finished [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self]; } @@ -266,8 +271,9 @@ reloads the table (performing a new mysql-query) { NSMutableDictionary *tempRow; - if ( ![tableSourceView numberOfSelectedRows] ) - return; + if ( ![tableSourceView numberOfSelectedRows] ) { + [tableSourceView selectRowIndexes:[NSIndexSet indexSetWithIndex:[tableSourceView numberOfRows]-1] byExtendingSelection:NO]; + } // Check whether a save of the current row is required. if ( ![self saveRowOnDeselect] ) return; @@ -1092,15 +1098,16 @@ would result in a position change. if ( isEditingRow && [tableSourceView selectedRow] != currentlyEditingRow ) { [self saveRowOnDeselect]; } + [copyFieldButton setEnabled:YES]; // check if there is currently a field selected // and change button state accordingly if ([tableSourceView numberOfSelectedRows] > 0 && [tablesListInstance tableType] == SP_TABLETYPE_TABLE) { [removeFieldButton setEnabled:YES]; - [copyFieldButton setEnabled:YES]; + // [copyFieldButton setEnabled:YES]; } else { [removeFieldButton setEnabled:NO]; - [copyFieldButton setEnabled:NO]; + // [copyFieldButton setEnabled:YES]; } } else if ([aNotification object] == indexView) { |