Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#63: Some code I forgot to move in the previous commit
  • Loading branch information
dmoagx committed May 7, 2018
1 parent 66e8dc2 commit af369da
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
2 changes: 0 additions & 2 deletions Source/SPTableContent.h
Expand Up @@ -137,8 +137,6 @@ typedef NS_ENUM(NSInteger, SPTableContentFilterSource) {
NSUserDefaults *prefs;
NSInteger currentlyEditingRow, maxNumRows;

NSMutableDictionary *contentFilters;
NSMutableDictionary *numberOfDefaultFilters;
NSUInteger contentPage;

#ifndef SP_CODA
Expand Down
34 changes: 0 additions & 34 deletions Source/SPTableContent.m
Expand Up @@ -178,38 +178,6 @@ - (id)init
blueColor = [NSColor blueColor];
whiteColor = [NSColor whiteColor];

// Init default filters for Content Browser
contentFilters = [[NSMutableDictionary alloc] init];
numberOfDefaultFilters = [[NSMutableDictionary alloc] init];

NSError *readError = nil;
NSString *filePath = [NSBundle pathForResource:@"ContentFilters.plist" ofType:nil inDirectory:[[NSBundle mainBundle] bundlePath]];
NSData *defaultFilterData = [NSData dataWithContentsOfFile:filePath
options:NSMappedRead
error:&readError];

if (defaultFilterData && !readError) {
NSDictionary *defaultFilterDict = [NSPropertyListSerialization propertyListWithData:defaultFilterData
options:NSPropertyListMutableContainersAndLeaves
format:NULL
error:&readError];

if(defaultFilterDict && !readError) {
[contentFilters setDictionary:defaultFilterDict];
}
}

if (readError) {
NSLog(@"Error while reading 'ContentFilters.plist':\n%@", readError);
NSBeep();
}
else {
[numberOfDefaultFilters setObject:[NSNumber numberWithInteger:[[contentFilters objectForKey:@"number"] count]] forKey:@"number"];
[numberOfDefaultFilters setObject:[NSNumber numberWithInteger:[[contentFilters objectForKey:@"date"] count]] forKey:@"date"];
[numberOfDefaultFilters setObject:[NSNumber numberWithInteger:[[contentFilters objectForKey:@"string"] count]] forKey:@"string"];
[numberOfDefaultFilters setObject:[NSNumber numberWithInteger:[[contentFilters objectForKey:@"spatial"] count]] forKey:@"spatial"];
}

kCellEditorErrorNoMatch = NSLocalizedString(@"Field is not editable. No matching record found.\nReload table, check the encoding, or try to add\na primary key field or more fields\nin the view declaration of '%@' to identify\nfield origin unambiguously.", @"Table Content result editing error - could not identify original row");
kCellEditorErrorNoMultiTabDb = NSLocalizedString(@"Field is not editable. Field has no or multiple table or database origin(s).",@"field is not editable due to no table/database");
kCellEditorErrorTooManyMatches = NSLocalizedString(@"Field is not editable. Couldn't identify field origin unambiguously (%ld matches).", @"Query result editing error - could not match row being edited uniquely");
Expand Down Expand Up @@ -5227,8 +5195,6 @@ - (void)dealloc
if (filterTableDefaultOperator) SPClear(filterTableDefaultOperator);
#endif
if (selectedTable) SPClear(selectedTable);
if (contentFilters) SPClear(contentFilters);
if (numberOfDefaultFilters) SPClear(numberOfDefaultFilters);
if (keys) SPClear(keys);
if (sortCol) SPClear(sortCol);
SPClear(usedQuery);
Expand Down
4 changes: 4 additions & 0 deletions Source/SPTableContentFilterController.m
Expand Up @@ -366,7 +366,9 @@ - (instancetype)init
target = nil;
action = NULL;

// Init default filters for Content Browser
contentFilters = [[NSMutableDictionary alloc] init];
numberOfDefaultFilters = [[NSMutableDictionary alloc] init];

NSError *readError = nil;
NSString *filePath = [NSBundle pathForResource:@"ContentFilters.plist" ofType:nil inDirectory:[[NSBundle mainBundle] bundlePath]];
Expand Down Expand Up @@ -670,6 +672,8 @@ - (void)dealloc
[[NSNotificationCenter defaultCenter] removeObserver:self];
SPClear(model);
SPClear(columns);
SPClear(contentFilters);
SPClear(numberOfDefaultFilters);
[super dealloc];
}

Expand Down

0 comments on commit af369da

Please sign in to comment.