diff options
author | stuconnolly <stuart02@gmail.com> | 2010-12-26 20:09:23 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-12-26 20:09:23 +0000 |
commit | 80977d353eef6a6b3f48bfd3e18d80e94c3c3c71 (patch) | |
tree | 580287f2d043b004b380516f1a38c8d177e63d20 /Source | |
parent | f873d9c10f5023be4c14114db009a6467c7dcc92 (diff) | |
download | sequelpro-80977d353eef6a6b3f48bfd3e18d80e94c3c3c71.tar.gz sequelpro-80977d353eef6a6b3f48bfd3e18d80e94c3c3c71.tar.bz2 sequelpro-80977d353eef6a6b3f48bfd3e18d80e94c3c3c71.zip |
When adding a new index, exclude fields that have already been added from the drop down list. Part of issue #928.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPIndexesController.m | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m index 6a7c6cb7..f3661528 100644 --- a/Source/SPIndexesController.m +++ b/Source/SPIndexesController.m @@ -407,7 +407,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; */ - (NSInteger)numberOfItemsInComboBoxCell:(NSComboBoxCell *)comboBoxCell { - return [fields count]; + return ([fields count] - [indexedFields count]); } /** @@ -415,7 +415,11 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; */ - (id)comboBoxCell:(NSComboBoxCell *)comboBoxCell objectValueForItemAtIndex:(NSInteger)index { - return [[fields objectAtIndex:index] objectForKey:@"name"]; + NSMutableArray *availableFields = [fields mutableCopy]; + + [availableFields removeObjectsInArray:indexedFields]; + + return [[availableFields objectAtIndex:index] objectForKey:@"name"]; } #pragma mark - |