From 543e9593ff7878af9836df11c3eee3f6fce7101e Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 5 Feb 2010 19:11:14 +0000 Subject: --- Source/CustomQuery.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Source/CustomQuery.m') diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 656b3063..8eb6184c 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -715,9 +715,9 @@ // Register new history item [[SPQueryController sharedQueryController] addHistory:usedQuery forFileURL:[tableDocumentInstance fileURL]]; - + // Refresh history popup menu - [self historyItemsHaveBeenUpdated:self]; + [self performSelector:@selector(historyItemsHaveBeenUpdated:) withObject:self afterDelay:0.0]; } // Error checking @@ -1317,7 +1317,7 @@ [autouppercaseKeywordsMenuItem setState:([prefs boolForKey:SPCustomQueryAutoUppercaseKeywords]?NSOnState:NSOffState)]; if ( [[SPQueryController sharedQueryController] historyForFileURL:[tableDocumentInstance fileURL]] ) - [self historyItemsHaveBeenUpdated:self]; + [self performSelector:@selector(historyItemsHaveBeenUpdated:) withObject:self afterDelay:0.0]; // Populate query favorites [self queryFavoritesHaveBeenUpdated:nil]; @@ -2703,8 +2703,10 @@ while([queryHistoryButton numberOfItems] > 7) [queryHistoryButton removeItemAtIndex:[queryHistoryButton numberOfItems]-1]; - for(id historyMenuItem in [[SPQueryController sharedQueryController] historyMenuItemsForFileURL:[tableDocumentInstance fileURL]]) - [historyMenu addItem:historyMenuItem]; + NSUInteger numberOfHistoryItems = [[SPQueryController sharedQueryController] numberOfHistoryItemsForFileURL:[tableDocumentInstance fileURL]]; + if(numberOfHistoryItems>0) + for(id historyMenuItem in [[SPQueryController sharedQueryController] historyMenuItemsForFileURL:[tableDocumentInstance fileURL]]) + [historyMenu addItem:historyMenuItem]; } /** * Called by the query favorites manager whenever the query favorites have been updated. -- cgit v1.2.3