diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/TableDump.h | 2 | ||||
-rw-r--r-- | Source/TableDump.m | 26 |
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 |