diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-10-07 17:22:22 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-10-07 17:22:22 +0000 |
commit | 88cb14acd9182ac19a1be2e8ad34b2be6b12b939 (patch) | |
tree | 1f94e59dc904cd3c276eb70f98872e96fc2315c6 /Source | |
parent | 7b4be7a61fff578dbc3bc6ea0b72cb681c841630 (diff) | |
download | sequelpro-88cb14acd9182ac19a1be2e8ad34b2be6b12b939.tar.gz sequelpro-88cb14acd9182ac19a1be2e8ad34b2be6b12b939.tar.bz2 sequelpro-88cb14acd9182ac19a1be2e8ad34b2be6b12b939.zip |
• outsourced ImportCSV accessory view to fix the disappearing of combobox values after re-invoking it
- store the accessory settings in SP's preferences
Diffstat (limited to 'Source')
-rw-r--r-- | Source/TableDump.m | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/TableDump.m b/Source/TableDump.m index 4bc867a8..209cd382 100644 --- a/Source/TableDump.m +++ b/Source/TableDump.m @@ -417,6 +417,21 @@ { // prepare open panel and accessory view NSOpenPanel *openPanel = [NSOpenPanel openPanel]; + + // Load accessory nib each time + if(![NSBundle loadNibNamed:@"ImportAccessory" owner:self]) { + NSBeep(); + NSLog(@"ImportAccessory accessory dialog could not be loaded."); + return; + } + + // Preset the accessory view with prefs defaults + [importFieldsTerminatedField setStringValue:[prefs objectForKey:@"CSVImportFieldTerminator"]]; + [importLinesTerminatedField setStringValue:[prefs objectForKey:@"CSVImportLineTerminator"]]; + [importFieldsEscapedField setStringValue:[prefs objectForKey:@"CSVImportFieldEscapeCharacter"]]; + [importFieldsEnclosedField setStringValue:[prefs objectForKey:@"CSVImportFieldEnclosedBy"]]; + [importFieldNamesSwitch setState:[[prefs objectForKey:@"CSVImportFirstLineIsHeader"] boolValue]]; + [openPanel setAccessoryView:importCSVView]; [openPanel setDelegate:self]; if ([prefs valueForKey:@"importFormatPopupValue"]) { @@ -764,6 +779,13 @@ // other two must therefore be performed where possible. csvParser = [[SPCSVParser alloc] init]; + // Store settings in prefs + [prefs setObject:[importFieldsEnclosedField stringValue] forKey:@"CSVImportFieldEnclosedBy"]; + [prefs setObject:[importFieldsEscapedField stringValue] forKey:@"CSVImportFieldEscapeCharacter"]; + [prefs setObject:[importLinesTerminatedField stringValue] forKey:@"CSVImportLineTerminator"]; + [prefs setObject:[importFieldsTerminatedField stringValue] forKey:@"CSVImportFieldTerminator"]; + [prefs setBool:[importFieldNamesSwitch state] forKey:@"CSVImportFirstLineIsHeader"]; + // Take CSV import setting from accessory view [csvParser setFieldTerminatorString:[importFieldsTerminatedField stringValue] convertDisplayStrings:YES]; [csvParser setLineTerminatorString:[importLinesTerminatedField stringValue] convertDisplayStrings:YES]; |