aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/SPConstants.h1
-rw-r--r--Source/SPConstants.m1
-rw-r--r--Source/SPTableContent.m14
-rw-r--r--Source/SPTableRelations.h1
-rw-r--r--Source/SPTableRelations.m7
5 files changed, 14 insertions, 10 deletions
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index e6855132..ffe37d66 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -288,6 +288,7 @@ extern NSString *SPNullValue;
extern NSString *SPGlobalResultTableFont;
extern NSString *SPFilterTableDefaultOperator;
extern NSString *SPFilterTableDefaultOperatorLastItems;
+extern NSString *SPAlphabeticalTableSorting;
// Favorites Prefpane
extern NSString *SPFavorites;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index 39b925c1..1f391d47 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -94,6 +94,7 @@ NSString *SPNullValue = @"SPNullValue";
NSString *SPGlobalResultTableFont = @"GlobalResultTableFont";
NSString *SPFilterTableDefaultOperator = @"FilterTableDefaultOperator";
NSString *SPFilterTableDefaultOperatorLastItems = @"FilterTableDefaultOperatorLastItems";
+NSString *SPAlphabeticalTableSorting = @"AlphabeticalTableSorting";
// Favorites Prefpane
NSString *SPFavorites = @"favorites";
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index ddc58670..e4fe9dc2 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -609,10 +609,8 @@
// Enable and initialize filter fields (with tags for position of menu item and field position)
[fieldField setEnabled:YES];
[fieldField removeAllItems];
- [fieldField addItemsWithTitles:columnNames];
- for ( i = 0 ; i < [fieldField numberOfItems] ; i++ ) {
- [[fieldField itemAtIndex:i] setTag:i];
- }
+ NSArray *columnTitles = ([prefs boolForKey:SPAlphabeticalTableSorting])? [columnNames sortedArrayUsingSelector:@selector(compare:)] : columnNames;
+ [fieldField addItemsWithTitles:columnTitles];
[compareField setEnabled:YES];
[self setCompareTypes:self];
[argumentField setEnabled:YES];
@@ -2346,8 +2344,8 @@
[compareField removeAllItems];
NSString *fieldTypeGrouping;
- if([[tableDataInstance columnWithName:[[fieldField selectedItem] title]] objectForKey:@"typegrouping"])
- fieldTypeGrouping = [NSString stringWithString:[[tableDataInstance columnWithName:[[fieldField selectedItem] title]] objectForKey:@"typegrouping"]];
+ if([[tableDataInstance columnWithName:[fieldField titleOfSelectedItem]] objectForKey:@"typegrouping"])
+ fieldTypeGrouping = [NSString stringWithString:[[tableDataInstance columnWithName:[fieldField titleOfSelectedItem]] objectForKey:@"typegrouping"]];
else
return;
@@ -2393,7 +2391,7 @@
} else {
compareType = @"";
NSBeep();
- NSLog(@"ERROR: unknown type for comparision: %@, in %@", [[tableDataInstance columnWithName:[[fieldField selectedItem] title]] objectForKey:@"type"], fieldTypeGrouping);
+ NSLog(@"ERROR: unknown type for comparision: %@, in %@", [[tableDataInstance columnWithName:[fieldField titleOfSelectedItem]] objectForKey:@"type"], fieldTypeGrouping);
}
// Add IS NULL and IS NOT NULL as they should always be available
@@ -3330,7 +3328,7 @@
theDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
[self tableFilterString], @"menuLabel",
- [[fieldField selectedItem] title], @"filterField",
+ [fieldField titleOfSelectedItem], @"filterField",
[[compareField selectedItem] title], @"filterComparison",
[NSNumber numberWithInteger:[[compareField selectedItem] tag]], @"filterComparisonTag",
[argumentField stringValue], @"filterValue",
diff --git a/Source/SPTableRelations.h b/Source/SPTableRelations.h
index aa270854..a71b151a 100644
--- a/Source/SPTableRelations.h
+++ b/Source/SPTableRelations.h
@@ -53,6 +53,7 @@
MCPConnection *connection;
NSMutableArray *relationData;
+ NSUserDefaults *prefs;
}
@property (readonly) NSMutableArray *relationData;
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m
index 5160448f..980b8d30 100644
--- a/Source/SPTableRelations.m
+++ b/Source/SPTableRelations.m
@@ -49,6 +49,7 @@
{
if ((self = [super init])) {
relationData = [[NSMutableArray alloc] init];
+ prefs = [NSUserDefaults standardUserDefaults];
}
return self;
@@ -175,7 +176,8 @@
[addRelationTableBox setTitle:[NSString stringWithFormat:NSLocalizedString(@"Table: %@", @"Add Relation sheet title, showing table name"), [tablesListInstance tableName]]];
[columnPopUpButton removeAllItems];
- [columnPopUpButton addItemsWithTitles:[tableDataInstance columnNames]];
+ NSArray *columnTitles = ([prefs boolForKey:SPAlphabeticalTableSorting])? [[tableDataInstance columnNames] sortedArrayUsingSelector:@selector(compare:)] : [tableDataInstance columnNames];
+ [columnPopUpButton addItemsWithTitles:columnTitles];
[refTablePopUpButton removeAllItems];
@@ -559,7 +561,8 @@
// Add the valid columns
if ([validColumns count] > 0) {
- [refColumnPopUpButton addItemsWithTitles:validColumns];
+ NSArray *columnTitles = ([prefs boolForKey:SPAlphabeticalTableSorting])? [validColumns sortedArrayUsingSelector:@selector(compare:)] : validColumns;
+ [refColumnPopUpButton addItemsWithTitles:columnTitles];
[refColumnPopUpButton setEnabled:YES];
[confirmAddRelationButton setEnabled:YES];