diff options
-rw-r--r-- | Source/SPCustomQuery.m | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 0a76030b..dbb7792f 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -483,7 +483,22 @@ [encodingPopUp setEnabled:YES]; - [panel beginSheetForDirectory:nil file:@"history" modalForWindow:[tableDocumentInstance parentWindow] modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:@"saveHistory"]; + [panel setNameFieldStringValue:@"history"]; + [panel beginSheetModalForWindow:[tableDocumentInstance parentWindow] completionHandler:^(NSInteger returnCode) { + if (returnCode == NSOKButton) { + NSError *error = nil; + + [prefs setInteger:[[encodingPopUp selectedItem] tag] forKey:SPLastSQLFileEncoding]; + [prefs synchronize]; + + [[self buildHistoryString] writeToURL:[panel URL] + atomically:YES + encoding:[[encodingPopUp selectedItem] tag] + error:&error]; + + if (error) [[NSAlert alertWithError:error] runModal]; + } + }]; #endif } @@ -3590,27 +3605,6 @@ #endif } -- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(id)contextInfo -{ -#ifndef SP_CODA - if([contextInfo isEqualToString:@"saveHistory"]) { - if (returnCode == NSOKButton) { - NSError *error = nil; - - [prefs setInteger:[[encodingPopUp selectedItem] tag] forKey:SPLastSQLFileEncoding]; - [prefs synchronize]; - - [[self buildHistoryString] writeToURL:[panel URL] - atomically:YES - encoding:[[encodingPopUp selectedItem] tag] - error:&error]; - - if (error) [[NSAlert alertWithError:error] runModal]; - } - } -#endif -} - /** * Menu item validation. */ |