diff options
Diffstat (limited to 'Source/SPCSVExporterDelegate.m')
-rw-r--r-- | Source/SPCSVExporterDelegate.m | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/Source/SPCSVExporterDelegate.m b/Source/SPCSVExporterDelegate.m index e51fe978..38176776 100644 --- a/Source/SPCSVExporterDelegate.m +++ b/Source/SPCSVExporterDelegate.m @@ -30,31 +30,31 @@ #import "SPCSVExporter.h" #import "SPCSVExporterDelegate.h" -#import "SPDatabaseDocument.h" #import "SPExportFile.h" +#import "SPExportInitializer.h" @implementation SPExportController (SPCSVExporterDelegate) - (void)csvExportProcessWillBegin:(SPCSVExporter *)exporter -{ - [[exportProgressText onMainThread] displayIfNeeded]; - - [[exportProgressIndicator onMainThread] setIndeterminate:YES]; - [[exportProgressIndicator onMainThread] setUsesThreadedAnimation:YES]; - [[exportProgressIndicator onMainThread] startAnimation:self]; - +{ + [exportProgressText displayIfNeeded]; + + [exportProgressIndicator setIndeterminate:YES]; + [exportProgressIndicator setUsesThreadedAnimation:YES]; + [exportProgressIndicator startAnimation:self]; + // Only update the progress text if this is a table export if (exportSource == SPTableExport) { // Update the current table export index currentTableExportIndex = (exportTableCount - [exporters count]); - - [[exportProgressText onMainThread] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %lu of %lu (%@): Fetching data...", @"export label showing that the app is fetching data for a specific table"), currentTableExportIndex, exportTableCount, [exporter csvTableName]]]; + + [exportProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %lu of %lu (%@): Fetching data...", @"export label showing that the app is fetching data for a specific table"), currentTableExportIndex, exportTableCount, [exporter csvTableName]]]; } else { - [[exportProgressText onMainThread] setStringValue:NSLocalizedString(@"Fetching data...", @"export label showing that the app is fetching data")]; + [exportProgressText setStringValue:NSLocalizedString(@"Fetching data...", @"export label showing that the app is fetching data")]; } - - [[exportProgressText onMainThread] displayIfNeeded]; + + [exportProgressText displayIfNeeded]; } - (void)csvExportProcessComplete:(SPCSVExporter *)exporter @@ -93,15 +93,8 @@ else { // Close the last exporter's file handle [[exporter exportOutputFile] close]; - - [NSApp endSheet:exportProgressWindow returnCode:0]; - [exportProgressWindow orderOut:self]; - - // Restore query mode - [tableDocumentInstance setQueryMode:SPInterfaceQueryMode]; - - // Display Growl notification - [self displayExportFinishedGrowlNotification]; + + [self exportEnded]; } } @@ -109,22 +102,22 @@ { // Only update the progress text if this is a table export if (exportSource == SPTableExport) { - [[exportProgressText onMainThread] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %lu of %lu (%@): Writing data...", @"export label showing app if writing data for a specific table"), currentTableExportIndex, exportTableCount, [exporter csvTableName]]]; + [exportProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %lu of %lu (%@): Writing data...", @"export label showing app if writing data for a specific table"), currentTableExportIndex, exportTableCount, [exporter csvTableName]]]; } else { - [[exportProgressText onMainThread] setStringValue:NSLocalizedString(@"Writing data...", @"export label showing app is writing data")]; + [exportProgressText setStringValue:NSLocalizedString(@"Writing data...", @"export label showing app is writing data")]; } - - [[exportProgressText onMainThread] displayIfNeeded]; - - [[exportProgressIndicator onMainThread] stopAnimation:self]; - [[exportProgressIndicator onMainThread] setUsesThreadedAnimation:NO]; - [[exportProgressIndicator onMainThread] setIndeterminate:NO]; - [[exportProgressIndicator onMainThread] setDoubleValue:0]; + + [exportProgressText displayIfNeeded]; + + [exportProgressIndicator stopAnimation:self]; + [exportProgressIndicator setUsesThreadedAnimation:NO]; + [exportProgressIndicator setIndeterminate:NO]; + [exportProgressIndicator setDoubleValue:0]; } - (void)csvExportProcessProgressUpdated:(SPCSVExporter *)exporter -{ +{ [exportProgressIndicator setDoubleValue:[exporter exportProgressValue]]; } |