From c3b8ad6cfb3afcdecd516c1c23c5260505345b70 Mon Sep 17 00:00:00 2001 From: Marius Ursache Date: Mon, 11 Nov 2013 21:00:29 +1100 Subject: Updated Save Process List panel sheet to 10.6+ SDK --- Source/SPProcessListController.m | 57 ++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 31 deletions(-) (limited to 'Source/SPProcessListController.m') diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m index 913035d4..1db30726 100644 --- a/Source/SPProcessListController.m +++ b/Source/SPProcessListController.m @@ -235,7 +235,32 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id"; [panel setAllowsOtherFileTypes:YES]; [panel setCanSelectHiddenExtension:YES]; - [panel beginSheetForDirectory:nil file:@"ServerProcesses" modalForWindow:[self window] modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:nil]; + [panel setNameFieldStringValue:@"ServerProcesses"]; + [panel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger returnCode) { + if (returnCode == NSOKButton) { + if ([processesFiltered count] > 0) { + NSMutableString *processesString = [NSMutableString stringWithFormat:@"# MySQL server proceese for %@\n\n", [[[NSApp delegate] frontDocument] host]]; + + for (NSDictionary *process in processesFiltered) + { + NSString *stringTmp = [NSString stringWithFormat:@"%@ %@ %@ %@ %@ %@ %@ %@", + [process objectForKey:@"Id"], + [process objectForKey:@"User"], + [process objectForKey:@"Host"], + [process objectForKey:@"db"], + [process objectForKey:@"Command"], + [process objectForKey:@"Time"], + [process objectForKey:@"State"], + [process objectForKey:@"Info"]]; + + [processesString appendString:stringTmp]; + [processesString appendString:@"\n"]; + } + + [processesString writeToURL:[panel URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; + } + } + }]; } /** @@ -394,36 +419,6 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id"; } } -/** - * Invoked when the save panel is dismissed. - */ -- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo -{ - if (returnCode == NSOKButton) { - if ([processesFiltered count] > 0) { - NSMutableString *processesString = [NSMutableString stringWithFormat:@"# MySQL server proceese for %@\n\n", [[[NSApp delegate] frontDocument] host]]; - - for (NSDictionary *process in processesFiltered) - { - NSString *stringTmp = [NSString stringWithFormat:@"%@ %@ %@ %@ %@ %@ %@ %@", - [process objectForKey:@"Id"], - [process objectForKey:@"User"], - [process objectForKey:@"Host"], - [process objectForKey:@"db"], - [process objectForKey:@"Command"], - [process objectForKey:@"Time"], - [process objectForKey:@"State"], - [process objectForKey:@"Info"]]; - - [processesString appendString:stringTmp]; - [processesString appendString:@"\n"]; - } - - [processesString writeToURL:[panel URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; - } - } -} - /** * Menu item validation. */ -- cgit v1.2.3