diff options
author | Marius Ursache <bamse16@yahoo.com> | 2013-11-11 21:04:11 +1100 |
---|---|---|
committer | Marius Ursache <bamse16@yahoo.com> | 2013-11-11 21:04:11 +1100 |
commit | f7e3077285b2249351ef494219576d1e7a31c09a (patch) | |
tree | f9ea5a5e9c70a9e70607ac867707b1cb6b91871c | |
parent | c3b8ad6cfb3afcdecd516c1c23c5260505345b70 (diff) | |
download | sequelpro-f7e3077285b2249351ef494219576d1e7a31c09a.tar.gz sequelpro-f7e3077285b2249351ef494219576d1e7a31c09a.tar.bz2 sequelpro-f7e3077285b2249351ef494219576d1e7a31c09a.zip |
Updated Save Server Variables List panel sheet to 10.6+ SDK
-rw-r--r-- | Source/SPServerVariablesController.m | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/Source/SPServerVariablesController.m b/Source/SPServerVariablesController.m index 0d591f2f..b2afbc13 100644 --- a/Source/SPServerVariablesController.m +++ b/Source/SPServerVariablesController.m @@ -133,7 +133,21 @@ [panel setAllowsOtherFileTypes:YES]; [panel setCanSelectHiddenExtension:YES]; - [panel beginSheetForDirectory:nil file:@"ServerVariables" modalForWindow:[self window] modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:nil]; + [panel setNameFieldStringValue:@"ServerVariables"]; + [panel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger returnCode) { + if (returnCode == NSOKButton) { + if ([variablesFiltered count] > 0) { + NSMutableString *variablesString = [NSMutableString stringWithFormat:@"# MySQL server variables for %@\n\n", [[(SPAppController*)[NSApp delegate] frontDocument] host]]; + + for (NSDictionary *variable in variablesFiltered) + { + [variablesString appendFormat:@"%@ = %@\n", [variable objectForKey:@"Variable_name"], [variable objectForKey:@"Value"]]; + } + + [variablesString writeToURL:[panel URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; + } + } + }]; } @@ -164,25 +178,6 @@ } /** - * Invoked when the save panel is dismissed. - */ -- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo -{ - if (returnCode == NSOKButton) { - if ([variablesFiltered count] > 0) { - NSMutableString *variablesString = [NSMutableString stringWithFormat:@"# MySQL server variables for %@\n\n", [[(SPAppController*)[NSApp delegate] frontDocument] host]]; - - for (NSDictionary *variable in variablesFiltered) - { - [variablesString appendFormat:@"%@ = %@\n", [variable objectForKey:@"Variable_name"], [variable objectForKey:@"Value"]]; - } - - [variablesString writeToURL:[panel URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; - } - } -} - -/** * Menu item validation. */ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem |