diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-02-05 11:37:30 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-02-05 11:37:30 +0000 |
commit | 64567b12a8e9449ea3e23e20f0d236a9bde24dad (patch) | |
tree | e7d96960c5c695ac3afab0fca057dc0b63c5f83c /Source/SPQueryController.m | |
parent | f880dea7369cb6ce57c552cd359f871bf7e2e414 (diff) | |
download | sequelpro-64567b12a8e9449ea3e23e20f0d236a9bde24dad.tar.gz sequelpro-64567b12a8e9449ea3e23e20f0d236a9bde24dad.tar.bz2 sequelpro-64567b12a8e9449ea3e23e20f0d236a9bde24dad.zip |
• refactored the entire history logic in Custom Query
- queries which are longer than then 64 chars are truncated in title and queries which are longer than then 256 chars are truncated in tooltip to avoid processing time to load very long queries from history; this also decreases the memory usage
- added "Insert Next/Previous History Query" logic bound to ^↑ and ^↓
- fixed tiny GUI spacing problem in Custom Query
Diffstat (limited to 'Source/SPQueryController.m')
-rw-r--r-- | Source/SPQueryController.m | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 9f28c226..ae83a25d 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -644,6 +644,32 @@ static SPQueryController *sharedQueryController = nil; return [NSMutableArray array]; } +- (NSArray *)historyMenuItemsForFileURL:(NSURL *)fileURL +{ + if([historyContainer objectForKey:[fileURL absoluteString]]) { + NSMutableArray *returnArray = [[NSMutableArray arrayWithCapacity:[[historyContainer objectForKey:[fileURL absoluteString]] count]] autorelease]; + NSMenuItem *historyMenuItem; + for(id history in [historyContainer objectForKey:[fileURL absoluteString]]) { + historyMenuItem = [[[NSMenuItem alloc] initWithTitle:([history length] > 64) ? [NSString stringWithFormat:@"%@…", [history substringToIndex:63]] : history + action:NULL + keyEquivalent:@""] autorelease]; + [historyMenuItem setToolTip:([history length] > 256) ? [NSString stringWithFormat:@"%@…", [history substringToIndex:255]] : history]; + [returnArray addObject:historyMenuItem]; + } + + return returnArray; + } + + return [NSArray array]; +} + +- (NSUInteger)numberOfHistoryItemsForFileURL:(NSURL *)fileURL +{ + if([historyContainer objectForKey:[fileURL absoluteString]]) + return [[historyContainer objectForKey:[fileURL absoluteString]] count]; + else + return 0; +} - (NSMutableDictionary *)contentFilterForFileURL:(NSURL *)fileURL { if([contentFilterContainer objectForKey:[fileURL absoluteString]]) |