diff options
author | Marius Ursache <bamse16@yahoo.com> | 2013-11-11 20:54:44 +1100 |
---|---|---|
committer | Marius Ursache <bamse16@yahoo.com> | 2013-11-11 20:54:44 +1100 |
commit | f0d8ef187a76e01d1dad3b576b302f9ed445f363 (patch) | |
tree | b817254a018c8153b04f8f118a0ba43540f506d7 /Source/SPDatabaseDocument.m | |
parent | 5f6729844ad2af23f006153150f3d41ab71634c1 (diff) | |
download | sequelpro-f0d8ef187a76e01d1dad3b576b302f9ed445f363.tar.gz sequelpro-f0d8ef187a76e01d1dad3b576b302f9ed445f363.tar.bz2 sequelpro-f0d8ef187a76e01d1dad3b576b302f9ed445f363.zip |
Updated Save Create Syntax panel sheet to 10.6+ SDK
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r-- | Source/SPDatabaseDocument.m | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 05c25e92..6a3e4151 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -2305,7 +2305,18 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [panel setAllowsOtherFileTypes:YES]; [panel setCanSelectHiddenExtension:YES]; - [panel beginSheetForDirectory:nil file:@"CreateSyntax" modalForWindow:createTableSyntaxWindow modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:SPCreateSyntx]; + [panel setNameFieldStringValue:[NSString stringWithFormat:@"CreateSyntax-%@", [self table]]]; + [panel beginSheetModalForWindow:createTableSyntaxWindow completionHandler:^(NSInteger returnCode) { + if (returnCode == NSOKButton) { + NSString *createSyntax = [createTableSyntaxTextView string]; + + if ([createSyntax length] > 0) { + NSString *output = [NSString stringWithFormat:@"-- %@ '%@'\n\n%@\n", NSLocalizedString(@"Create syntax for", @"create syntax for table comment"), [self table], createSyntax]; + + [output writeToURL:[panel URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; + } + } + }]; } /** @@ -3686,27 +3697,6 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; } /** - * Called when the NSSavePanel sheet ends. Writes the server variables to the selected file if required. - */ -- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo -{ -#ifndef SP_CODA - if (returnCode == NSOKButton) { - if ([contextInfo isEqualToString:SPCreateSyntx]) { - - NSString *createSyntax = [createTableSyntaxTextView string]; - - if ([createSyntax length] > 0) { - NSString *output = [NSString stringWithFormat:@"-- %@ '%@'\n\n%@\n", NSLocalizedString(@"Create syntax for", @"create syntax for table comment"), [self table], createSyntax]; - - [output writeToURL:[sheet URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; - } - } - } -#endif -} - -/** * Return the createTableSyntaxWindow */ - (NSWindow *)getCreateTableSyntaxWindow |