aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDump.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/TableDump.m')
-rw-r--r--Source/TableDump.m68
1 files changed, 61 insertions, 7 deletions
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 3f543d4b..5d1cb19e 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -90,12 +90,24 @@
ends the modal session
*/
{
+ [NSApp endSheet:exportWindow];
[NSApp stopModalWithCode:[sender tag]];
}
#pragma mark -
#pragma mark export methods
+- (void)export
+{
+ [self reloadTables:self];
+ [NSApp beginSheet:exportWindow modalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:nil];
+}
+
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+{
+ [sheet orderOut:self];
+}
+
- (void)exportFile:(int)tag
/*
invoked when user clicks on an export menuItem
@@ -735,7 +747,7 @@
[fieldMappingButtonOptions setArray:[importArray objectAtIndex:currentRow]];
for (i = 0; i < [fieldMappingButtonOptions count]; i++) {
if ([[fieldMappingButtonOptions objectAtIndex:i] isNSNull]) {
- [fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. %@", i+1, [prefs objectForKey:@"nullValue"]]];
+ [fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. %@", i+1, [prefs objectForKey:@"NullValue"]]];
} else {
[fieldMappingButtonOptions replaceObjectAtIndex:i withObject:[NSString stringWithFormat:@"%i. %@", i+1, [fieldMappingButtonOptions objectAtIndex:i]]];
}
@@ -1090,7 +1102,7 @@
NSMutableString *csvCell = [NSMutableString string];
NSMutableArray *csvRow = [NSMutableArray array];
NSMutableString *csvString = [NSMutableString string];
- NSString *nullString = [NSString stringWithString:[prefs objectForKey:@"nullValue"]];
+ NSString *nullString = [NSString stringWithString:[prefs objectForKey:@"NullValue"]];
NSString *escapedEscapeString, *escapedFieldSeparatorString, *escapedEnclosingString, *escapedLineEndString;
NSString *dataConversionString;
NSScanner *csvNumericTester;
@@ -1381,14 +1393,14 @@
fieldCount = [tempRowArray count];
} else {
while ( [tempRowArray count] < fieldCount ) {
- [tempRowArray addObject:[NSString stringWithString:[prefs objectForKey:@"nullValue"]]];
+ [tempRowArray addObject:[NSString stringWithString:[prefs objectForKey:@"NullValue"]]];
}
}
for ( i = 0 ; i < [tempRowArray count] ; i++ ) {
// Insert a NSNull object if the cell contains an unescaped null character or an unescaped string
// which matches the NULL string set in preferences.
- if ( [[tempRowArray objectAtIndex:i] isEqualToString:@"\\N"] || [[tempRowArray objectAtIndex:i] isEqualToString:[prefs objectForKey:@"nullValue"]] ) {
+ if ( [[tempRowArray objectAtIndex:i] isEqualToString:@"\\N"] || [[tempRowArray objectAtIndex:i] isEqualToString:[prefs objectForKey:@"NullValue"]] ) {
[tempRowArray replaceObjectAtIndex:i withObject:[NSNull null]];
} else {
@@ -1889,7 +1901,7 @@
[[exportDumpTableView tableColumnWithIdentifier:@"switch"] setDataCell:switchButton];
[[exportMultipleCSVTableView tableColumnWithIdentifier:@"switch"] setDataCell:switchButton];
[[exportMultipleXMLTableView tableColumnWithIdentifier:@"switch"] setDataCell:switchButton];
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ if ( [prefs boolForKey:@"UseMonospacedFonts"] ) {
[[[exportDumpTableView tableColumnWithIdentifier:@"tables"] dataCell]
setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
[[[exportMultipleCSVTableView tableColumnWithIdentifier:@"tables"] dataCell]
@@ -1930,7 +1942,7 @@
forTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
- if ( [[NSUserDefaults standardUserDefaults] boolForKey:@"useMonospacedFonts"] ) {
+ if ( [[NSUserDefaults standardUserDefaults] boolForKey:@"UseMonospacedFonts"] ) {
[aCell setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
}
else
@@ -2007,6 +2019,13 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
#pragma mark -
#pragma mark other
+
+- (void)awakeFromNib
+{
+ [self switchTab:[[exportToolbar items] objectAtIndex:0]];
+ [exportToolbar setSelectedItemIdentifier:[[[exportToolbar items] objectAtIndex:0] itemIdentifier]];
+}
+
//last but not least
- (id)init;
{
@@ -2028,7 +2047,7 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
[fieldMappingArray release];
[savePath release];
[openPath release];
- [prefs release];
+ [prefs release];
[super dealloc];
}
@@ -2038,4 +2057,39 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
progressCancelled = YES;
}
+- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
+{
+ NSArray *array = [toolbar items];
+ NSMutableArray *items = [NSMutableArray arrayWithCapacity:6];
+
+ for (NSToolbarItem *item in array)
+ {
+ [items addObject:[item itemIdentifier]];
+ }
+
+ return items;
+}
+
+#pragma mark New Export methods
+
+- (IBAction)switchTab:(id)sender
+{
+ if ([sender isKindOfClass:[NSToolbarItem class]]) {
+ [exportTabBar selectTabViewItemWithIdentifier:[[sender label] lowercaseString]];
+ }
+}
+
+- (IBAction)switchInput:(id)sender
+{
+ if ([sender isKindOfClass:[NSMatrix class]]) {
+ [exportTableList setEnabled:([[sender selectedCell] tag] == 3)];
+ }
+}
+
+
+- (BOOL)validateToolbarItem:(NSToolbarItem *)toolbarItem
+{
+ return YES;
+}
+
@end