aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMarius Ursache <marius@marius.me.uk>2013-11-11 02:28:11 -0800
committerMarius Ursache <marius@marius.me.uk>2013-11-11 02:28:11 -0800
commitd46ab590d6a76894b7f282159663f00e5df511ef (patch)
tree1cbe404daf3c106f9809d5db540154e79e8a9b23 /Source
parentc769bd0a420bdd1273c43b91b28a818bfd5f5008 (diff)
parentdf35d702fe561629fddfa66cd99d0839b8e05910 (diff)
downloadsequelpro-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')
-rw-r--r--Source/SPDatabaseDocument.m34
-rw-r--r--Source/SPExportController.m26
-rw-r--r--Source/SPProcessListController.m57
-rw-r--r--Source/SPQueryController.m20
-rw-r--r--Source/SPServerVariablesController.m35
5 files changed, 68 insertions, 104 deletions
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];
+ }
+ }
+ }];
}
/**
@@ -3686,27 +3697,6 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase";
}
/**
- * 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
*/
- (NSWindow *)getCreateTableSyntaxWindow
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];
+ }
+ }];
}
/**
@@ -699,17 +700,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.
*/
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
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
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
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];
+ }
+ }
+ }];
}
@@ -164,25 +178,6 @@
}
/**
- * 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.
*/
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem