diff options
author | Marius Ursache <bamse16@yahoo.com> | 2013-11-11 21:00:29 +1100 |
---|---|---|
committer | Marius Ursache <bamse16@yahoo.com> | 2013-11-11 21:00:29 +1100 |
commit | c3b8ad6cfb3afcdecd516c1c23c5260505345b70 (patch) | |
tree | 8b3af6267a8756b15dc7461e6406b9a05d358966 | |
parent | f0d8ef187a76e01d1dad3b576b302f9ed445f363 (diff) | |
download | sequelpro-c3b8ad6cfb3afcdecd516c1c23c5260505345b70.tar.gz sequelpro-c3b8ad6cfb3afcdecd516c1c23c5260505345b70.tar.bz2 sequelpro-c3b8ad6cfb3afcdecd516c1c23c5260505345b70.zip |
Updated Save Process List panel sheet to 10.6+ SDK
-rw-r--r-- | Source/SPProcessListController.m | 57 |
1 files changed, 26 insertions, 31 deletions
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]; + } + } + }]; } /** @@ -395,36 +420,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. */ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem |