aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-09-14 18:07:10 +0000
committerstuconnolly <stuart02@gmail.com>2010-09-14 18:07:10 +0000
commitddeed0fc32f92b86f18c31d2a1efb152cf81609f (patch)
treeaeea14ae24dd11ccdfa90c9226627989a395f7e4 /Source
parent088a71acc4ec70eeae49b30910aaa59245995876 (diff)
downloadsequelpro-ddeed0fc32f92b86f18c31d2a1efb152cf81609f.tar.gz
sequelpro-ddeed0fc32f92b86f18c31d2a1efb152cf81609f.tar.bz2
sequelpro-ddeed0fc32f92b86f18c31d2a1efb152cf81609f.zip
- Remember to manually update the export source when updating the UI programmatically as doing so does not fire the controls action. Fixes issue #821.
- Improve UI validation on the export dialog when switching between export types.
Diffstat (limited to 'Source')
-rw-r--r--Source/SPExportController.m26
1 files changed, 19 insertions, 7 deletions
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index 9ba9ccfa..ff7a9143 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -239,7 +239,7 @@
BOOL isCustomQuerySelected = ([tableDocumentInstance isCustomQuerySelected] && ([[customQueryInstance currentResult] count] > 1));
BOOL isContentSelected = ([[tableDocumentInstance selectedToolbarItemIdentifier] isEqualToString:SPMainToolbarTableContent] && ([[tableContentInstance currentResult] count] > 1));
- if (isContentSelected) {
+ if (isContentSelected) {
tables = nil;
exportType = SPCSVExport;
exportSource = SPFilteredExport;
@@ -292,7 +292,7 @@
// Determine what data to use (filtered result, custom query result or selected table(s)) for the export operation
exportSource = (exportType == SPDotExport) ? SPTableExport : [exportInputPopUpButton indexOfSelectedItem];
-
+
BOOL isSelectedTables = ([sender indexOfSelectedItem] == SPTableExport);
[exportFilePerTableCheck setHidden:(!isSelectedTables) || (exportType == SPSQLExport)];
@@ -664,7 +664,7 @@
// Determine what data to use (filtered result, custom query result or selected table(s)) for the export operation
exportSource = (exportType == SPDotExport) ? SPTableExport : [exportInputPopUpButton indexOfSelectedItem];
-
+
[exportOptionsTabBar selectTabViewItemWithIdentifier:type];
BOOL isSQL = (exportType == SPSQLExport);
@@ -686,10 +686,22 @@
[exportInputPopUpButton setEnabled:(!isDot)];
- // Enable/disable the 'filtered result' and 'query result' options
- // Note that the result count check is always greater than one as the first row is always the field names
- [[[exportInputPopUpButton menu] itemAtIndex:SPFilteredExport] setEnabled:((enable) && ([[tableContentInstance currentResult] count] > 1))];
- [[[exportInputPopUpButton menu] itemAtIndex:SPQueryExport] setEnabled:((enable) && ([[customQueryInstance currentResult] count] > 1))];
+ // When exporting to SQL, only the selected tables option should be enabled
+ if (isSQL) {
+ // Programmatically changing the selected item of a popup button does not fire it's action, so updated
+ // the selected export source manually.
+ exportSource = SPTableExport;
+
+ [exportInputPopUpButton selectItemAtIndex:SPTableExport];
+ [[[exportInputPopUpButton menu] itemAtIndex:SPFilteredExport] setEnabled:NO];
+ [[[exportInputPopUpButton menu] itemAtIndex:SPQueryExport] setEnabled:NO];
+ }
+ else {
+ // Enable/disable the 'filtered result' and 'query result' options
+ // Note that the result count check is always greater than one as the first row is always the field names
+ [[[exportInputPopUpButton menu] itemAtIndex:SPFilteredExport] setEnabled:((enable) && ([[tableContentInstance currentResult] count] > 1))];
+ [[[exportInputPopUpButton menu] itemAtIndex:SPQueryExport] setEnabled:((enable) && ([[customQueryInstance currentResult] count] > 1))];
+ }
[[exportTableList tableColumnWithIdentifier:@"structure"] setHidden:(isSQL) ? (![exportSQLIncludeStructureCheck state]) : YES];
[[exportTableList tableColumnWithIdentifier:@"drop"] setHidden:(isSQL) ? (![exportSQLIncludeDropSyntaxCheck state]) : YES];