aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPQueryController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-10-01 16:35:44 +0000
committerBibiko <bibiko@eva.mpg.de>2009-10-01 16:35:44 +0000
commitcf243d99127441ce2fd3b4641427cb49ab155402 (patch)
treef06c68cc3abfe7e5fb0695b4203a683147ab83b3 /Source/SPQueryController.m
parent11c7eea329acef790b667a27312a09528364140c (diff)
downloadsequelpro-cf243d99127441ce2fd3b4641427cb49ab155402.tar.gz
sequelpro-cf243d99127441ce2fd3b4641427cb49ab155402.tar.bz2
sequelpro-cf243d99127441ce2fd3b4641427cb49ab155402.zip
• first implementation of a Content Filter Editor
- user-defined content filter can be saved globally (Prefs) or in SPF files - BETA - further tests are needed due to complexity - SPQueryController now handles the local user-defined content filters - tooltips are now generated automatically if not defined explicitly (incl. if $BINARY placeholder was used) • if user added local query favorites or content filters to an Untitled document and s/he wants to close it the standard sheet will be displayed (Don't Save - Cancel - Save) - due to that changed old [TableDocument displayName] to 'displaySPName' to be conform with Cocoa • changed behavior while importing query favorites - now they will append at the list (not inserted after selected row - makes more sense) • introduced to history filter dict the key 'menuLabel' which will be set to [TableContent tableFilterString] for displaying the history menu title and simplified the SPHistoryController logic for that • minor code changes
Diffstat (limited to 'Source/SPQueryController.m')
-rw-r--r--Source/SPQueryController.m40
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index a08a0906..86fa9908 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -101,6 +101,7 @@ static SPQueryController *sharedQueryController = nil;
favoritesContainer = [[NSMutableDictionary alloc] init];
historyContainer = [[NSMutableDictionary alloc] init];
+ contentFilterContainer = [[NSMutableDictionary alloc] init];
}
@@ -151,6 +152,7 @@ static SPQueryController *sharedQueryController = nil;
[favoritesContainer release];
[historyContainer release];
+ [contentFilterContainer release];
[super dealloc];
}
@@ -437,6 +439,11 @@ static SPQueryController *sharedQueryController = nil;
}
}
+ // Set the doc-based content filters
+ if(![contentFilterContainer objectForKey:[new absoluteString]]) {
+ [contentFilterContainer setObject:[NSMutableDictionary dictionary] forKey:[new absoluteString]];
+ }
+
return new;
}
@@ -467,6 +474,15 @@ static SPQueryController *sharedQueryController = nil;
[arr release];
}
}
+ if(![contentFilterContainer objectForKey:[fileURL absoluteString]]) {
+ if(contextInfo != nil && [contextInfo objectForKey:@"ContentFilters"]) {
+ [contentFilterContainer setObject:[contextInfo objectForKey:@"ContentFilters"] forKey:[fileURL absoluteString]];
+ } else {
+ NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
+ [contentFilterContainer setObject:dict forKey:[fileURL absoluteString]];
+ [dict release];
+ }
+ }
return fileURL;
@@ -490,6 +506,21 @@ static SPQueryController *sharedQueryController = nil;
[favoritesContainer removeObjectForKey:[fileURL absoluteString]];
if([historyContainer objectForKey:[fileURL absoluteString]])
[historyContainer removeObjectForKey:[fileURL absoluteString]];
+ if([contentFilterContainer objectForKey:[fileURL absoluteString]])
+ [contentFilterContainer removeObjectForKey:[fileURL absoluteString]];
+
+}
+
+- (void)replaceContentFilterByArray:(NSArray *)contentFilterArray ofType:(NSString *)filterType forFileURL:(NSURL *)fileURL
+{
+
+ if([contentFilterContainer objectForKey:[fileURL absoluteString]]) {
+ NSMutableDictionary *c = [[NSMutableDictionary alloc] init];
+ [c setDictionary:[contentFilterContainer objectForKey:[fileURL absoluteString]]];
+ [c setObject:contentFilterArray forKey:filterType];
+ [contentFilterContainer setObject:c forKey:[fileURL absoluteString]];
+ [c release];
+ }
}
@@ -569,6 +600,15 @@ static SPQueryController *sharedQueryController = nil;
}
+- (NSMutableDictionary *)contentFilterForFileURL:(NSURL *)fileURL
+{
+ if([contentFilterContainer objectForKey:[fileURL absoluteString]])
+ return [contentFilterContainer objectForKey:[fileURL absoluteString]];
+
+ return [NSMutableDictionary dictionary];
+
+}
+
- (NSArray *)queryFavoritesForFileURL:(NSURL *)fileURL andTabTrigger:(NSString *)tabTrigger includeGlobals:(BOOL)includeGlobals
{