aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDocument.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-08-04 19:14:36 +0000
committerBibiko <bibiko@eva.mpg.de>2009-08-04 19:14:36 +0000
commit4ce2164c519d4382b67255523c96c9e03f7fdcc6 (patch)
tree9e6dfab905735ecb5d30268248a52a9dc81db43a /Source/TableDocument.m
parent2b92e1f1ddefdde3d341b88f0f09421e05e02953 (diff)
downloadsequelpro-4ce2164c519d4382b67255523c96c9e03f7fdcc6.tar.gz
sequelpro-4ce2164c519d4382b67255523c96c9e03f7fdcc6.tar.bz2
sequelpro-4ce2164c519d4382b67255523c96c9e03f7fdcc6.zip
• initial support for open/save connection files (*.spf)
- Open/Save menu items are hidden • initial support for drag&drop files *.spf and *.sql to SP's icon or double-click at *.sql or *.spf files in Finder - SP starts if not already running - sql files will be executed in the Custom Query if at least one connection is open - spf files not yet supported -
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r--Source/TableDocument.m53
1 files changed, 53 insertions, 0 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index d4a4a53d..e6346ece 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1481,6 +1481,59 @@
#pragma mark Menu methods
/**
+ * Opens connection file(s)
+ */
+- (IBAction)openConnectionSheet:(id)sender
+{
+
+ NSOpenPanel *panel = [NSOpenPanel openPanel];
+ [panel setCanSelectHiddenExtension:YES];
+ [panel setCanChooseDirectories:NO];
+ [panel setAllowsMultipleSelection:YES];
+ [panel setResolvesAliases:YES];
+
+ [panel beginSheetForDirectory:nil
+ file:@""
+ types:[NSArray arrayWithObjects:@"spf", nil]
+ modalForWindow:tableWindow
+ modalDelegate:self didEndSelector:@selector(openConnectionPanelDidEnd:returnCode:contextInfo:)
+ contextInfo:NULL];
+
+}
+- (void)openConnectionPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
+{
+ if ( returnCode ) {
+ NSArray *fileName = [panel filenames];
+ NSLog(@"open: '%@'", [fileName description]);
+ }
+}
+/**
+ * Saves connection(s) to file
+ */
+- (IBAction)saveConnectionSheet:(id)sender
+{
+
+ NSSavePanel *panel = [NSSavePanel savePanel];
+ [panel setAllowedFileTypes:[NSArray arrayWithObjects:@"spf", nil]];
+ [panel setAllowsOtherFileTypes:NO];
+ [panel setCanSelectHiddenExtension:YES];
+
+ [panel beginSheetForDirectory:nil
+ file:[NSString stringWithFormat:@"%@", [self name]]
+ modalForWindow:tableWindow
+ modalDelegate:self
+ didEndSelector:@selector(saveConnectionPanelDidEnd:returnCode:contextInfo:)
+ contextInfo:NULL];
+}
+- (void)saveConnectionPanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
+{
+
+ if ( returnCode ) {
+ NSString *fileName = [panel filename];
+ NSLog(@"save as: '%@'", fileName);
+ }
+}
+/**
* Passes the request to the tableDump object
*/
- (IBAction)import:(id)sender