diff options
author | stuconnolly <stuart02@gmail.com> | 2012-04-30 18:39:40 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-04-30 18:39:40 +0000 |
commit | f7164f1f962fb732ea38383150a3bc28a3ae8caf (patch) | |
tree | 8fe6cd5f4ed232474f350d81f8918d0680b25d28 /Source/SPIndexesController.m | |
parent | 61f734103aad78bbdedb48dac55b0081380a295c (diff) | |
download | sequelpro-f7164f1f962fb732ea38383150a3bc28a3ae8caf.tar.gz sequelpro-f7164f1f962fb732ea38383150a3bc28a3ae8caf.tar.bz2 sequelpro-f7164f1f962fb732ea38383150a3bc28a3ae8caf.zip |
When opening the add index sheet make sure we're using the correct table reload call, so the correct validation is done. Fixes issue #1292.
Diffstat (limited to 'Source/SPIndexesController.m')
-rw-r--r-- | Source/SPIndexesController.m | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m index 39abaf81..9db491ae 100644 --- a/Source/SPIndexesController.m +++ b/Source/SPIndexesController.m @@ -225,7 +225,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; // initial key has a required size [indexSizeTableColumn setHidden:![requiresLength containsObject:[[initialField objectForKey:@"type"] uppercaseString]]]; - [indexedColumnsTableView reloadData]; + [self _reloadIndexedColumnsTableData]; [addIndexedColumnButton setEnabled:([indexedFields count] < [fields count])]; @@ -385,7 +385,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; [self _reloadIndexedColumnsTableData]; // Select new added row - [indexedColumnsTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:[indexedFields count]-1] byExtendingSelection:NO]; + [indexedColumnsTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:[indexedFields count] - 1] byExtendingSelection:NO]; [addIndexedColumnButton setEnabled:([indexedFields count] < [fields count])]; } @@ -446,9 +446,11 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; } else { id object = [[indexedFields objectAtIndex:rowIndex] objectForKey:[tableColumn identifier]]; + if ([[tableColumn identifier] isEqualToString:@"Size"] && object) { object = [NSNumber numberWithLongLong:[object longLongValue]]; } + return object; } } @@ -474,9 +476,11 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; if ([object isKindOfClass:[NSNumber class]]) { object = [NSString stringWithFormat:@"%llu", [object unsignedLongLongValue]]; } + if (object) { [[indexedFields objectAtIndex:rowIndex] setObject:object forKey:[tableColumn identifier]]; - } else { + } + else { [[indexedFields objectAtIndex:rowIndex] removeObjectForKey:[tableColumn identifier]]; } } @@ -775,22 +779,25 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; NSUInteger sizeRequiredFieldAndNotYetSet = 0; NSUInteger sizeRequired = 0; - for (NSDictionary *field in indexedFields) { + for (NSDictionary *field in indexedFields) + { if ([requiresLength containsObject:[[field objectForKey:@"type"] uppercaseString]]) { sizeRequired++; sizeRequiredFieldAndNotYetSet++; - if([field objectForKey:@"Size"] && [(NSString *)[field objectForKey:@"Size"] length]) + + if ([field objectForKey:@"Size"] && [(NSString *)[field objectForKey:@"Size"] length]) { sizeRequiredFieldAndNotYetSet--; + } } } #ifndef SP_REFACTOR // Only toggle the sizes column if the advanced view is hidden and at least one field requires a size - if (!showAdvancedView) [indexSizeTableColumn setHidden:(!sizeRequired)]; + if (!showAdvancedView) [indexSizeTableColumn setHidden:!sizeRequired]; #endif // Validate Add Button - [confirmAddIndexButton setEnabled:(!sizeRequiredFieldAndNotYetSet)]; + [confirmAddIndexButton setEnabled:!sizeRequiredFieldAndNotYetSet]; [indexedColumnsTableView reloadData]; } |