From bb6e7a78be7fbb801f611d32bdc7c45b9961bb7e Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 16 Jun 2009 15:46:03 +0000 Subject: =?UTF-8?q?=E2=80=A2=20changed=20the=20behaviour=20of=20the=20"Dup?= =?UTF-8?q?licate=20Field"=20button=20in=20TableSource:=20-=20if=20no=20fi?= =?UTF-8?q?eld=20definition=20is=20selected=20"Duplicate=20Field"=20copies?= =?UTF-8?q?=20the=20last=20field=20structure=20defined=20in=20the=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/TableSource.m | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'Source/TableSource.m') 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) { -- cgit v1.2.3