aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <dmoagx@users.noreply.github.com>2018-05-07 21:56:04 +0200
committerMax <dmoagx@users.noreply.github.com>2018-05-07 22:02:43 +0200
commitaf369da49328f699f951760fa5af7463cb401e99 (patch)
tree9ad5872592b5c1c45f30119271cccd42a1b33509
parent66e8dc21b8dfe25f83872036a1268d4e014f16eb (diff)
downloadsequelpro-af369da49328f699f951760fa5af7463cb401e99.tar.gz
sequelpro-af369da49328f699f951760fa5af7463cb401e99.tar.bz2
sequelpro-af369da49328f699f951760fa5af7463cb401e99.zip
#63: Some code I forgot to move in the previous commit
-rw-r--r--Source/SPTableContent.h2
-rw-r--r--Source/SPTableContent.m34
-rw-r--r--Source/SPTableContentFilterController.m4
3 files changed, 4 insertions, 36 deletions
diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h
index be7fd58d..d47dd467 100644
--- a/Source/SPTableContent.h
+++ b/Source/SPTableContent.h
@@ -137,8 +137,6 @@ typedef NS_ENUM(NSInteger, SPTableContentFilterSource) {
NSUserDefaults *prefs;
NSInteger currentlyEditingRow, maxNumRows;
- NSMutableDictionary *contentFilters;
- NSMutableDictionary *numberOfDefaultFilters;
NSUInteger contentPage;
#ifndef SP_CODA
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 74af1dba..603e9671 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -178,38 +178,6 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
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 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
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);
diff --git a/Source/SPTableContentFilterController.m b/Source/SPTableContentFilterController.m
index 6c8d16bc..ef11b3d3 100644
--- a/Source/SPTableContentFilterController.m
+++ b/Source/SPTableContentFilterController.m
@@ -366,7 +366,9 @@ static void _addIfNotNil(NSMutableArray *array, id toAdd);
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 @@ static void _addIfNotNil(NSMutableArray *array, id toAdd);
[[NSNotificationCenter defaultCenter] removeObserver:self];
SPClear(model);
SPClear(columns);
+ SPClear(contentFilters);
+ SPClear(numberOfDefaultFilters);
[super dealloc];
}