From 4316f1e1d5bb0e0a21f266f75e016934c8dce7ab Mon Sep 17 00:00:00 2001 From: abhibeckert Date: Wed, 14 Jan 2009 23:53:20 +0000 Subject: #144 value of the "import format" popup button is now remembered in the import panel --- Source/TableDump.h | 2 +- Source/TableDump.m | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'Source') 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 -- cgit v1.2.3