diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-09-07 16:58:47 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-09-07 16:58:47 +0000 |
commit | 4f7b215bc3cb14270e2825eacc57c075eedc847e (patch) | |
tree | 9861ae48d3fa1ce71cf0879bfae575ffdf203c81 /Source/SPQueryController.m | |
parent | 884ac3db36f3addee4183d976655a91994a5f656 (diff) | |
download | sequelpro-4f7b215bc3cb14270e2825eacc57c075eedc847e.tar.gz sequelpro-4f7b215bc3cb14270e2825eacc57c075eedc847e.tar.bz2 sequelpro-4f7b215bc3cb14270e2825eacc57c075eedc847e.zip |
• removed leaks in QueryFavoriteManager
• prepared QueryController for future steps
Diffstat (limited to 'Source/SPQueryController.m')
-rw-r--r-- | Source/SPQueryController.m | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 4dbd3749..a08a0906 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -569,6 +569,27 @@ static SPQueryController *sharedQueryController = nil; } +- (NSArray *)queryFavoritesForFileURL:(NSURL *)fileURL andTabTrigger:(NSString *)tabTrigger includeGlobals:(BOOL)includeGlobals +{ + + if(![tabTrigger length]) return [NSArray array]; + + NSMutableArray *result = [[NSMutableArray alloc] init]; + for(id fav in [self favoritesForFileURL:fileURL]) { + if([fav objectForKey:@"tabtrigger"] && [[fav objectForKey:@"tabtrigger"] isEqualToString:tabTrigger]) + [result addObject:fav]; + } + + if(includeGlobals && [prefs objectForKey:@"queryFavorites"]) { + for(id fav in [prefs objectForKey:@"queryFavorites"]) { + if([fav objectForKey:@"tabtrigger"] && [[fav objectForKey:@"tabtrigger"] isEqualToString:tabTrigger]) + [result addObject:fav]; + } + } + + return [result autorelease]; +} + - (void)removeFavoriteAtIndex:(NSUInteger)index forFileURL:(NSURL *)fileURL { [[favoritesContainer objectForKey:[fileURL absoluteString]] removeObjectAtIndex:index]; |