aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorabhibeckert <abhi@abhibeckert.com>2009-01-14 23:53:20 +0000
committerabhibeckert <abhi@abhibeckert.com>2009-01-14 23:53:20 +0000
commit4316f1e1d5bb0e0a21f266f75e016934c8dce7ab (patch)
tree60db06ddbf44f4d5798e0c7673a7eaa6253dba59
parente5cbde261001731aabd456635b08ff8f2fb45785 (diff)
downloadsequelpro-4316f1e1d5bb0e0a21f266f75e016934c8dce7ab.tar.gz
sequelpro-4316f1e1d5bb0e0a21f266f75e016934c8dce7ab.tar.bz2
sequelpro-4316f1e1d5bb0e0a21f266f75e016934c8dce7ab.zip
#144 value of the "import format" popup button is now remembered in the import panel
-rw-r--r--Source/TableDump.h2
-rw-r--r--Source/TableDump.m26
2 files changed, 16 insertions, 12 deletions
diff --git a/Source/TableDump.h b/Source/TableDump.h
index c8648eb4..b759d8fa 100644
--- a/Source/TableDump.h
+++ b/Source/TableDump.h
@@ -58,7 +58,7 @@
IBOutlet id exportMultipleLinesTerminatedField;
IBOutlet id importCSVView;
- IBOutlet id importFormatPopup;
+ IBOutlet NSPopUpButton *importFormatPopup;
IBOutlet id importCSVBox;
IBOutlet id importFieldNamesSwitch;
IBOutlet id importFieldsTerminatedField;
diff --git a/Source/TableDump.m b/Source/TableDump.m
index dd2b91c0..3c34634b 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -312,8 +312,13 @@
invoked when user clicks on an import menuItem
*/
{
+ // prepare open panel and accessory view
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setAccessoryView:importCSVView];
+ if ([prefs valueForKey:@"importFormatPopupValue"]) {
+ [importFormatPopup selectItemWithTitle:[prefs valueForKey:@"importFormatPopupValue"]];
+ [self changeFormat:self];
+ }
// Show openPanel
[openPanel beginSheetForDirectory:[prefs objectForKey:@"openPath"]
@@ -610,21 +615,20 @@
notificationName:@"Import Finished"];
[pool release];
}
+
- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
-/*
- reads mysql-dumpfile
- */
-{
- [sheet orderOut:self];
-
- if ( returnCode != NSOKButton )
- return;
-
- //save path to preferences
+{
+ // save values to preferences
[prefs setObject:[sheet directory] forKey:@"openPath"];
+ [prefs setObject:[[importFormatPopup selectedItem] title] forKey:@"importFormatPopupValue"];
+ // close sheet, and check if user canceled
+ [sheet orderOut:self];
+ if (returnCode != NSOKButton)
+ return;
+
+ // begin import process
[NSThread detachNewThreadSelector:@selector(importBackgroundProcess:) toTarget:self withObject:[sheet filename]];
-
}
- (void)setupFieldMappingArray