From 4145d3d4281cfee869754b50325048228f1ee6bd Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 14 May 2018 01:51:44 +0200 Subject: Remove dead code, add types, reformat --- Source/SPDataImport.h | 47 +++++++++++++++++----------------------- Source/SPDataImport.m | 60 ++++++++++++++++++++++++++++++--------------------- 2 files changed, 56 insertions(+), 51 deletions(-) (limited to 'Source') diff --git a/Source/SPDataImport.h b/Source/SPDataImport.h index 545e02ff..ca1cd7dc 100644 --- a/Source/SPDataImport.h +++ b/Source/SPDataImport.h @@ -30,6 +30,13 @@ // More info at @class SPMySQLConnection; +@class SPFieldMapperController; +@class SPFileHandle; +@class SPDatabaseDocument; +@class SPCustomQuery; +@class SPTableData; +@class SPTableStructure; +@class SPTablesList; typedef enum { SPFieldMapperInProgress = 1, @@ -37,16 +44,14 @@ typedef enum { SPFieldMapperCancelled = 3 } SPFieldMapperSheetStatus; -@class SPFieldMapperController, SPFileHandle; - @interface SPDataImport : NSObject { - IBOutlet id tableDocumentInstance; - IBOutlet id tablesListInstance; - IBOutlet id tableSourceInstance; - IBOutlet id tableContentInstance; - IBOutlet id tableDataInstance; - IBOutlet id customQueryInstance; +#warning Outlets belong to multiple xib files! + IBOutlet SPDatabaseDocument *tableDocumentInstance; + IBOutlet SPTablesList *tablesListInstance; + IBOutlet SPTableStructure *tableSourceInstance; + IBOutlet SPTableData *tableDataInstance; + IBOutlet SPCustomQuery *customQueryInstance; IBOutlet id importView; IBOutlet id importTabView; @@ -55,7 +60,6 @@ typedef enum { IBOutlet id importFieldsEnclosedField; IBOutlet id importFieldsEscapedField; IBOutlet id importLinesTerminatedField; - IBOutlet id importFieldMapperSheetWindow; IBOutlet NSPopUpButton *importFormatPopup; IBOutlet NSPopUpButton *importEncodingPopup; @@ -67,21 +71,13 @@ typedef enum { IBOutlet NSTextView *importFromClipboardTextView; - IBOutlet id addDropTableSwitch; - IBOutlet id addCreateTableSwitch; - IBOutlet id addTableContentSwitch; - IBOutlet id addErrorsSwitch; - IBOutlet id sqlFullStreamingSwitch; - IBOutlet id sqlCompressionSwitch; - IBOutlet id csvFullStreamingSwitch; - IBOutlet id multiCSVFullStreamingSwitch; - IBOutlet id multiXMLFullStreamingSwitch; - IBOutlet id errorsSheet; - IBOutlet id errorsView; - IBOutlet id singleProgressSheet; - IBOutlet id singleProgressBar; - IBOutlet id singleProgressTitle; - IBOutlet id singleProgressText; + IBOutlet NSWindow *errorsSheet; + IBOutlet NSTextView *errorsView; + + IBOutlet NSPanel *singleProgressSheet; + IBOutlet NSProgressIndicator *singleProgressBar; + IBOutlet NSTextField *singleProgressTitle; + IBOutlet NSTextField *singleProgressText; SPMySQLConnection *mySQLConnection; @@ -108,7 +104,6 @@ typedef enum { BOOL importMethodIsUpdate; BOOL importIntoNewTable; - NSUInteger exportMode; NSUserDefaults *prefs; BOOL progressCancelled; BOOL _mainNibLoaded; @@ -119,8 +114,6 @@ typedef enum { NSMutableIndexSet *bitFieldsMapIndex; NSMutableArray *nullableNumericFields; NSMutableIndexSet *nullableNumericFieldsMapIndex; - - NSSavePanel *currentExportPanel; } // IBAction methods diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m index 17e083f1..f6b865e7 100644 --- a/Source/SPDataImport.m +++ b/Source/SPDataImport.m @@ -210,9 +210,9 @@ [NSApp beginSheet:importFromClipboardSheet modalForWindow:[tableDocumentInstance parentWindow] - modalDelegate:self + modalDelegate:self didEndSelector:@selector(importFromClipboardSheetDidEnd:returnCode:contextInfo:) - contextInfo:nil]; + contextInfo:nil]; } /** @@ -407,7 +407,11 @@ [singleProgressBar startAnimation:self]; // Open the progress sheet - [NSApp beginSheet:singleProgressSheet modalForWindow:[tableDocumentInstance parentWindow] modalDelegate:self didEndSelector:nil contextInfo:nil]; + [NSApp beginSheet:singleProgressSheet + modalForWindow:[tableDocumentInstance parentWindow] + modalDelegate:nil + didEndSelector:NULL + contextInfo:NULL]; [singleProgressSheet makeKeyWindow]; }); @@ -695,12 +699,12 @@ // Re-query the structure of all databases in the background [[tableDocumentInstance databaseStructureRetrieval] queryDbStructureInBackgroundWithUserInfo:@{@"forceUpdate" : @YES}]; - - // Import finished Growl notification - [[SPGrowlController sharedGrowlController] notifyWithTitle:@"Import Finished" - description:[NSString stringWithFormat:NSLocalizedString(@"Finished importing %@",@"description for finished importing growl notification"), [filename lastPathComponent]] - document:tableDocumentInstance - notificationName:@"Import Finished"]; + + // Import finished Growl notification + [[SPGrowlController sharedGrowlController] notifyWithTitle:@"Import Finished" + description:[NSString stringWithFormat:NSLocalizedString(@"Finished importing %@", @"description for finished importing growl notification"), [filename lastPathComponent]] + document:tableDocumentInstance + notificationName:@"Import Finished"]; } #pragma mark - @@ -791,7 +795,11 @@ [singleProgressBar startAnimation:self]; // Open the progress sheet - [NSApp beginSheet:singleProgressSheet modalForWindow:[tableDocumentInstance parentWindow] modalDelegate:self didEndSelector:nil contextInfo:nil]; + [NSApp beginSheet:singleProgressSheet + modalForWindow:[tableDocumentInstance parentWindow] + modalDelegate:nil + didEndSelector:NULL + contextInfo:NULL]; [singleProgressSheet makeKeyWindow]; }); @@ -973,7 +981,11 @@ [singleProgressBar setMaxValue:fileTotalLength]; [singleProgressBar setIndeterminate:NO]; [singleProgressBar startAnimation:self]; - [NSApp beginSheet:singleProgressSheet modalForWindow:[tableDocumentInstance parentWindow] modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; + [NSApp beginSheet:singleProgressSheet + modalForWindow:[tableDocumentInstance parentWindow] + modalDelegate:nil + didEndSelector:NULL + contextInfo:NULL]; [singleProgressSheet makeKeyWindow]; }); @@ -1210,10 +1222,10 @@ } // Import finished Growl notification - [[SPGrowlController sharedGrowlController] notifyWithTitle:NSLocalizedString(@"Import Finished" , @"title for finished importing growl notification") - description:[NSString stringWithFormat:NSLocalizedString(@"Finished importing %@",@"description for finished importing growl notification"), [filename lastPathComponent]] - document:tableDocumentInstance - notificationName:@"Import Finished"]; + [[SPGrowlController sharedGrowlController] notifyWithTitle:NSLocalizedString(@"Import Finished", @"title for finished importing growl notification") + description:[NSString stringWithFormat:NSLocalizedString(@"Finished importing %@", @"description for finished importing growl notification"), [filename lastPathComponent]] + document:tableDocumentInstance + notificationName:@"Import Finished"]; SPMainQSync(^{ if(importIntoNewTable) { @@ -1294,10 +1306,10 @@ // Show field mapper sheet and set the focus to it [NSApp beginSheet:[fieldMapperController window] - modalForWindow:[tableDocumentInstance parentWindow] - modalDelegate:self - didEndSelector:@selector(fieldMapperDidEndSheet:returnCode:contextInfo:) - contextInfo:nil]; + modalForWindow:[tableDocumentInstance parentWindow] + modalDelegate:self + didEndSelector:@selector(fieldMapperDidEndSheet:returnCode:contextInfo:) + contextInfo:NULL]; [[fieldMapperController window] makeKeyWindow]; }); @@ -1719,11 +1731,11 @@ cleanup: } [errorsView setString:message]; - [NSApp beginSheet:errorsSheet - modalForWindow:[tableDocumentInstance parentWindow] - modalDelegate:self - didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) - contextInfo:nil]; + [NSApp beginSheet:errorsSheet + modalForWindow:[tableDocumentInstance parentWindow] + modalDelegate:self + didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) + contextInfo:NULL]; [errorsSheet makeKeyWindow]; } -- cgit v1.2.3