Permalink
Browse files

#63: Some code I forgot to move in the previous commit

  • Loading branch information...
dmoagx committed May 7, 2018
1 parent 66e8dc2 commit af369da49328f699f951760fa5af7463cb401e99
Showing with 4 additions and 36 deletions.
  1. +0 −2 Source/SPTableContent.h
  2. +0 −34 Source/SPTableContent.m
  3. +4 −0 Source/SPTableContentFilterController.m
@@ -137,8 +137,6 @@ typedef NS_ENUM(NSInteger, SPTableContentFilterSource) {
NSUserDefaults *prefs;
NSInteger currentlyEditingRow, maxNumRows;
NSMutableDictionary *contentFilters;
NSMutableDictionary *numberOfDefaultFilters;
NSUInteger contentPage;
#ifndef SP_CODA
@@ -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");
@@ -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);
@@ -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]];
@@ -670,6 +672,8 @@ - (void)dealloc
[[NSNotificationCenter defaultCenter] removeObserver:self];
SPClear(model);
SPClear(columns);
SPClear(contentFilters);
SPClear(numberOfDefaultFilters);
[super dealloc];
}

0 comments on commit af369da

Please sign in to comment.