aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPExportController.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-07-06 21:10:20 +0000
committerstuconnolly <stuart02@gmail.com>2010-07-06 21:10:20 +0000
commitd3d7ed84f9c56d83d4a92f6f1c40d1280502adad (patch)
treed4873f535caca1fec0c1af5f7491f78b5320ef33 /Source/SPExportController.m
parentb5fa14109a046aee489d93e39897a30579df22f4 (diff)
downloadsequelpro-d3d7ed84f9c56d83d4a92f6f1c40d1280502adad.tar.gz
sequelpro-d3d7ed84f9c56d83d4a92f6f1c40d1280502adad.tar.bz2
sequelpro-d3d7ed84f9c56d83d4a92f6f1c40d1280502adad.zip
- Make the query info/error display collapsible.
- Add a 'gear menu' with the option to export the current result set as either CSV or XML. (Note, that the collapsiable view currently suffers from the same BWToolKit issue as the table information pane).
Diffstat (limited to 'Source/SPExportController.m')
-rw-r--r--Source/SPExportController.m29
1 files changed, 26 insertions, 3 deletions
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index e8bbf1a4..6eab3a34 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -131,13 +131,13 @@
*/
- (void)export
{
- [self exportTables:nil asFormat:SPSQLExport];
+ [self exportTables:nil asFormat:SPSQLExport usingSource:SPTableExport];
}
/**
* Displays the export window with the supplied tables and export type/format selected.
*/
-- (void)exportTables:(NSArray *)exportTables asFormat:(SPExportType)format
+- (void)exportTables:(NSArray *)exportTables asFormat:(SPExportType)format usingSource:(SPExportSource)source
{
// Select the correct tab
[exportTypeTabBar selectTabViewItemAtIndex:format];
@@ -150,7 +150,7 @@
if ([exportFiles count] > 0) [exportFiles removeAllObjects];
// Select the 'selected tables' source option
- [exportInputPopUpButton selectItemAtIndex:SPTableExport];
+ [exportInputPopUpButton selectItemAtIndex:source];
// If tables were supplied, select them
if (exportTables) {
@@ -595,6 +595,17 @@
[self _toggleExportButtonOnBackgroundThread];
}
+/**
+ * Opens the export sheet, selecting custom query as the export source.
+ */
+- (IBAction)exportCustomQueryResultAsFormat:(id)sender
+{
+ [self exportTables:nil asFormat:[sender tag] usingSource:SPQueryExport];
+
+ // Ensure UI validation
+ [self switchInput:exportInputPopUpButton];
+}
+
#pragma mark -
#pragma mark Table view datasource methods
@@ -669,6 +680,18 @@
}
}
+/**
+ * Menu item validation.
+ */
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
+{
+ if ([menuItem action] == @selector(exportCustomQueryResultAsFormat:)) {
+ return ([[customQueryInstance currentResult] count] > 1);
+ }
+
+ return YES;
+}
+
#pragma mark -
/**