From cb406e22d30aaf6dc62ea0917943adb555a8b3e6 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 5 Apr 2009 20:22:04 +0000 Subject: Fix an issue where by the show/hide console menu item was not being updated when the toolbar item was used. Also add more interface validation by only enabling the 'Clear Console' menu and toolbar items when there is at least one message in the console. --- Source/SPQueryConsole.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Source/SPQueryConsole.m') diff --git a/Source/SPQueryConsole.m b/Source/SPQueryConsole.m index 7b7edccb..0ba6c982 100644 --- a/Source/SPQueryConsole.m +++ b/Source/SPQueryConsole.m @@ -224,6 +224,14 @@ static SPQueryConsole *sharedQueryConsole = nil; [self _addMessageToConsole:error isError:YES]; } +/** + * Returns the number of messages currently in the console. + */ +- (NSUInteger)consoleMessageCount +{ + return [messages count]; +} + /** * Called when the NSSavePanel sheet ends. Writes the console's current content to the selected file if required. */ @@ -310,6 +318,10 @@ static SPQueryConsole *sharedQueryConsole = nil; if ([menuItem action] == @selector(copy:)) { return ([consoleTableView numberOfSelectedRows] > 0); } + + if ([menuItem action] == @selector(clearConsole:)) { + return ([self consoleMessageCount] > 0); + } return [[self window] validateMenuItem:menuItem]; } -- cgit v1.2.3