diff options
author | Marius Ursache <marius@marius.me.uk> | 2013-11-11 02:28:11 -0800 |
---|---|---|
committer | Marius Ursache <marius@marius.me.uk> | 2013-11-11 02:28:11 -0800 |
commit | d46ab590d6a76894b7f282159663f00e5df511ef (patch) | |
tree | 1cbe404daf3c106f9809d5db540154e79e8a9b23 /Source/SPProcessListController.m | |
parent | c769bd0a420bdd1273c43b91b28a818bfd5f5008 (diff) | |
parent | df35d702fe561629fddfa66cd99d0839b8e05910 (diff) | |
download | sequelpro-d46ab590d6a76894b7f282159663f00e5df511ef.tar.gz sequelpro-d46ab590d6a76894b7f282159663f00e5df511ef.tar.bz2 sequelpro-d46ab590d6a76894b7f282159663f00e5df511ef.zip |
Merge pull request #1853 from bamse16/master
beginSheetForDirectory: updates for OSX 10.6+ SDK
Diffstat (limited to 'Source/SPProcessListController.m')
-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 |