From 5f6729844ad2af23f006153150f3d41ab71634c1 Mon Sep 17 00:00:00 2001 From: Marius Ursache Date: Mon, 11 Nov 2013 20:43:27 +1100 Subject: Updated ConsoleLog panel sheet to 10.6 code --- Source/SPQueryController.m | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'Source/SPQueryController.m') diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 929de617..8febfd2b 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -228,7 +228,13 @@ static SPQueryController *sharedQueryController = nil; [panel setAccessoryView:saveLogView]; - [panel beginSheetForDirectory:nil file:NSLocalizedString(@"ConsoleLog", @"Console : Save as : Initial filename") modalForWindow:[self window] modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; + [panel setNameFieldStringValue:NSLocalizedString(@"ConsoleLog", @"Console : Save as : Initial filename")]; + [panel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger returnCode) { + if (returnCode == NSOKButton) { + [[self _getConsoleStringWithTimeStamps:[includeTimeStampsButton state] + connections:[includeConnectionButton state]] writeToFile:[[panel URL] path] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; + } + }]; #endif } @@ -310,18 +316,6 @@ static SPQueryController *sharedQueryController = nil; #endif } -/** - * Called when the NSSavePanel sheet ends. Writes the console's current content to the selected file if required. - */ -- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo -{ -#ifndef SP_CODA - if (returnCode == NSOKButton) { - [[self _getConsoleStringWithTimeStamps:[includeTimeStampsButton state] connections:[includeConnectionButton state]] writeToFile:[[sheet URL] path] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; - } -#endif -} - #pragma mark - #pragma mark Other -- cgit v1.2.3