From f7e3077285b2249351ef494219576d1e7a31c09a Mon Sep 17 00:00:00 2001 From: Marius Ursache Date: Mon, 11 Nov 2013 21:04:11 +1100 Subject: Updated Save Server Variables List panel sheet to 10.6+ SDK --- Source/SPServerVariablesController.m | 35 +++++++++++++++-------------------- 1 file 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]; + } + } + }]; } @@ -163,25 +177,6 @@ [NSApp beginSheet:[self window] modalForWindow:window modalDelegate:self didEndSelector:nil contextInfo:nil]; } -/** - * 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. */ -- cgit v1.2.3