From 5f6729844ad2af23f006153150f3d41ab71634c1 Mon Sep 17 00:00:00 2001 From: Marius Ursache Date: Mon, 11 Nov 2013 20:43:27 +1100 Subject: Updated ConsoleLog panel sheet to 10.6 code --- Source/SPQueryController.m | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'Source') diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 929de617..8febfd2b 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -228,7 +228,13 @@ static SPQueryController *sharedQueryController = nil; [panel setAccessoryView:saveLogView]; - [panel beginSheetForDirectory:nil file:NSLocalizedString(@"ConsoleLog", @"Console : Save as : Initial filename") modalForWindow:[self window] modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; + [panel setNameFieldStringValue:NSLocalizedString(@"ConsoleLog", @"Console : Save as : Initial filename")]; + [panel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger returnCode) { + if (returnCode == NSOKButton) { + [[self _getConsoleStringWithTimeStamps:[includeTimeStampsButton state] + connections:[includeConnectionButton state]] writeToFile:[[panel URL] path] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; + } + }]; #endif } @@ -310,18 +316,6 @@ static SPQueryController *sharedQueryController = nil; #endif } -/** - * Called when the NSSavePanel sheet ends. Writes the console's current content to the selected file if required. - */ -- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo -{ -#ifndef SP_CODA - if (returnCode == NSOKButton) { - [[self _getConsoleStringWithTimeStamps:[includeTimeStampsButton state] connections:[includeConnectionButton state]] writeToFile:[[sheet URL] path] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; - } -#endif -} - #pragma mark - #pragma mark Other -- cgit v1.2.3 From f0d8ef187a76e01d1dad3b576b302f9ed445f363 Mon Sep 17 00:00:00 2001 From: Marius Ursache Date: Mon, 11 Nov 2013 20:54:44 +1100 Subject: Updated Save Create Syntax panel sheet to 10.6+ SDK --- Source/SPDatabaseDocument.m | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'Source') diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 05c25e92..6a3e4151 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -2305,7 +2305,18 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [panel setAllowsOtherFileTypes:YES]; [panel setCanSelectHiddenExtension:YES]; - [panel beginSheetForDirectory:nil file:@"CreateSyntax" modalForWindow:createTableSyntaxWindow modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:SPCreateSyntx]; + [panel setNameFieldStringValue:[NSString stringWithFormat:@"CreateSyntax-%@", [self table]]]; + [panel beginSheetModalForWindow:createTableSyntaxWindow completionHandler:^(NSInteger returnCode) { + if (returnCode == NSOKButton) { + NSString *createSyntax = [createTableSyntaxTextView string]; + + if ([createSyntax length] > 0) { + NSString *output = [NSString stringWithFormat:@"-- %@ '%@'\n\n%@\n", NSLocalizedString(@"Create syntax for", @"create syntax for table comment"), [self table], createSyntax]; + + [output writeToURL:[panel URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; + } + } + }]; } /** @@ -3685,27 +3696,6 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; #endif } -/** - * Called when the NSSavePanel sheet ends. Writes the server variables to the selected file if required. - */ -- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo -{ -#ifndef SP_CODA - if (returnCode == NSOKButton) { - if ([contextInfo isEqualToString:SPCreateSyntx]) { - - NSString *createSyntax = [createTableSyntaxTextView string]; - - if ([createSyntax length] > 0) { - NSString *output = [NSString stringWithFormat:@"-- %@ '%@'\n\n%@\n", NSLocalizedString(@"Create syntax for", @"create syntax for table comment"), [self table], createSyntax]; - - [output writeToURL:[sheet URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; - } - } - } -#endif -} - /** * Return the createTableSyntaxWindow */ -- cgit v1.2.3 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') 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 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(-) (limited to 'Source') 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 From df35d702fe561629fddfa66cd99d0839b8e05910 Mon Sep 17 00:00:00 2001 From: Marius Ursache Date: Mon, 11 Nov 2013 21:20:26 +1100 Subject: Updated Change Export Directory panel sheet to 10.6+ SDK --- Source/SPExportController.m | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'Source') diff --git a/Source/SPExportController.m b/Source/SPExportController.m index 3fc5fbf0..4ffbe085 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -399,13 +399,14 @@ static const NSString *SPSQLExportDropEnabled = @"SQLExportDropEnabled"; [panel setCanChooseFiles:NO]; [panel setCanChooseDirectories:YES]; [panel setCanCreateDirectories:YES]; - - [panel beginSheetForDirectory:[exportPathField stringValue] - file:nil - modalForWindow:[self window] - modalDelegate:self - didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) - contextInfo:nil]; + + [panel setDirectoryURL:[NSURL URLWithString:[exportPathField stringValue]]]; + [panel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger returnCode) { + if (returnCode == NSOKButton) { + [exportPathField setStringValue:[[panel directoryURL] path]]; + [prefs setObject:[[panel directoryURL] path] forKey:SPExportLastDirectory]; + } + }]; } /** @@ -698,17 +699,6 @@ static const NSString *SPSQLExportDropEnabled = @"SQLExportDropEnabled"; } } -/** - * Invoked when the user dismisses the save panel. Updates the selected directory if they clicked OK. - */ -- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo -{ - if (returnCode == NSOKButton) { - [exportPathField setStringValue:[panel directory]]; - [prefs setObject:[panel directory] forKey:SPExportLastDirectory]; - } -} - /** * Menu item validation. */ -- cgit v1.2.3