From 80977d353eef6a6b3f48bfd3e18d80e94c3c3c71 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 26 Dec 2010 20:09:23 +0000 Subject: When adding a new index, exclude fields that have already been added from the drop down list. Part of issue #928. --- Source/SPIndexesController.m | 8 ++++++-- 1 file 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 - -- cgit v1.2.3