Skip to content
Permalink
Browse files

Remove dead code, add types, reformat

  • Loading branch information...
dmoagx committed May 13, 2018
1 parent 146d45c commit 4145d3d4281cfee869754b50325048228f1ee6bd
Showing with 56 additions and 52 deletions.
  1. +0 −1 Interfaces/English.lproj/DBView.xib
  2. +20 −27 Source/SPDataImport.h
  3. +36 −24 Source/SPDataImport.m
@@ -4636,7 +4636,6 @@ Gw
<outlet property="singleProgressSheet" destination="6125" id="6139"/>
<outlet property="singleProgressText" destination="6130" id="6140"/>
<outlet property="singleProgressTitle" destination="6132" id="6238"/>
<outlet property="tableContentInstance" destination="67" id="1025"/>
<outlet property="tableDataInstance" destination="4702" id="4713"/>
<outlet property="tableDocumentInstance" destination="-2" id="534"/>
<outlet property="tableSourceInstance" destination="69" id="1172"/>
@@ -30,23 +30,28 @@
// More info at <https://github.com/sequelpro/sequelpro>

@class SPMySQLConnection;
@class SPFieldMapperController;
@class SPFileHandle;
@class SPDatabaseDocument;
@class SPCustomQuery;
@class SPTableData;
@class SPTableStructure;
@class SPTablesList;

typedef enum {
SPFieldMapperInProgress = 1,
SPFieldMapperCompleted = 2,
SPFieldMapperCancelled = 3
} SPFieldMapperSheetStatus;

@class SPFieldMapperController, SPFileHandle;

@interface SPDataImport : NSObject <NSOpenSavePanelDelegate>
{
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
@@ -210,9 +210,9 @@ - (void)importFromClipboard

[NSApp beginSheet:importFromClipboardSheet
modalForWindow:[tableDocumentInstance parentWindow]
modalDelegate:self
modalDelegate:self
didEndSelector:@selector(importFromClipboardSheetDidEnd:returnCode:contextInfo:)
contextInfo:nil];
contextInfo:nil];
}

/**
@@ -407,7 +407,11 @@ - (void)importSQLFile:(NSString *)filename
[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 @@ - (void)importSQLFile:(NSString *)filename

// 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 @@ - (void)importCSVFile:(NSString *)filename
[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 @@ - (void)importCSVFile:(NSString *)filename
[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 @@ - (void)importCSVFile:(NSString *)filename
}

// 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 @@ - (BOOL) buildFieldMappingArrayWithData:(NSArray *)importData isPreview:(BOOL)da

// 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 @@ - (void)showErrorSheetWithMessage:(NSString*)message
}

[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];
}

0 comments on commit 4145d3d

Please sign in to comment.
You can’t perform that action at this time.