aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPExportInitializer.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-11-20 03:51:18 +0100
committerMax <post@wickenrode.com>2015-11-20 03:51:18 +0100
commit5568af642c2fc738f175e0be4729fd3e1fe2263a (patch)
treef950a5093c833ee886d9d8361d0ec6d4482c5e28 /Source/SPExportInitializer.m
parentb8ff5b4209a45cfb8cc836125debc26041f7c00e (diff)
downloadsequelpro-5568af642c2fc738f175e0be4729fd3e1fe2263a.tar.gz
sequelpro-5568af642c2fc738f175e0be4729fd3e1fe2263a.tar.bz2
sequelpro-5568af642c2fc738f175e0be4729fd3e1fe2263a.zip
* move some duplicate code into it's own method
* remove some duplicate onMainThread calls * if an exporter needs a certain charset it'll have to set that itself now
Diffstat (limited to 'Source/SPExportInitializer.m')
-rw-r--r--Source/SPExportInitializer.m29
1 files changed, 21 insertions, 8 deletions
diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m
index 045e5046..15e9de66 100644
--- a/Source/SPExportInitializer.m
+++ b/Source/SPExportInitializer.m
@@ -46,6 +46,7 @@
#import "SPExportFilenameUtilities.h"
#import "SPExportFileNameTokenObject.h"
#import "SPConnectionControllerDelegateProtocol.h"
+#import "SPExportController+SharedPrivateAPI.h"
#import <SPMySQL/SPMySQL.h>
@@ -74,14 +75,9 @@
contextInfo:nil];
}
- // If using an export type that requires the connection to start in UTF8, cache the current connection
- // encoding and then set it here.
- if (exportType == SPSQLExport || exportType == SPDotExport) {
- previousConnectionEncoding = [[NSString alloc] initWithString:[connection encoding]];
- previousConnectionEncodingViaLatin1 = [connection encodingUsesLatin1Transport];
-
- [tableDocumentInstance setConnectionEncoding:@"utf8" reloadingViews:NO];
- }
+ // cache the current connection encoding so the exporter can do what it wants.
+ previousConnectionEncoding = [[NSString alloc] initWithString:[connection encoding]];
+ previousConnectionEncodingViaLatin1 = [connection encodingUsesLatin1Transport];
// Add the first exporter to the operation queue
[operationQueue addOperation:[exporters objectAtIndex:0]];
@@ -92,6 +88,23 @@
}
/**
+ * @see _queueIsEmptyAfterCancelling:
+ */
+- (void)exportEnded
+{
+ [self _hideExportProgress];
+
+ // Restore query mode
+ [tableDocumentInstance setQueryMode:SPInterfaceQueryMode];
+
+ // Display Growl notification
+ [self displayExportFinishedGrowlNotification];
+
+ // Restore the connection encoding to it's pre-export value
+ [tableDocumentInstance setConnectionEncoding:[NSString stringWithFormat:@"%@%@", previousConnectionEncoding, (previousConnectionEncodingViaLatin1) ? @"-" : @""] reloadingViews:NO];
+}
+
+/**
* Initializes the export process by analysing the selected criteria.
*/
- (void)initializeExportUsingSelectedOptions