From 64567b12a8e9449ea3e23e20f0d236a9bde24dad Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 5 Feb 2010 11:37:30 +0000 Subject: =?UTF-8?q?=E2=80=A2=20refactored=20the=20entire=20history=20logic?= =?UTF-8?q?=20in=20Custom=20Query=20-=20queries=20which=20are=20longer=20t?= =?UTF-8?q?han=20then=2064=20chars=20are=20truncated=20in=20title=20and=20?= =?UTF-8?q?=20queries=20which=20are=20longer=20than=20then=20256=20chars?= =?UTF-8?q?=20are=20truncated=20in=20tooltip=20to=20avoid=20processing=20t?= =?UTF-8?q?ime=20to=20load=20very=20long=20queries=20from=20history;=20thi?= =?UTF-8?q?s=20also=20decreases=20the=20memory=20usage=20-=20added=20"Inse?= =?UTF-8?q?rt=20Next/Previous=20History=20Query"=20logic=20bound=20to=20^?= =?UTF-8?q?=E2=86=91=20and=20^=E2=86=93=20-=20fixed=20tiny=20GUI=20spacing?= =?UTF-8?q?=20problem=20in=20Custom=20Query?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPQueryController.m | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'Source/SPQueryController.m') 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]]) -- cgit v1.2.3