From 3558fee0667274f8ae325d0354ac6e31b2144db9 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Thu, 15 Jul 2010 12:08:13 +0000 Subject: Make the 'Export' menu item in the 'File' menu behave more like the export context menu by checking only the selecting tables. If no tables are selected all of them are checked by default (the same as before). Fixes issue #755. --- Source/SPDatabaseDocument.h | 2 +- Source/SPDatabaseDocument.m | 24 +++++++++++------------- Source/SPExportController.h | 1 - Source/SPExportController.m | 8 -------- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h index e16a6b5c..9f04fc71 100644 --- a/Source/SPDatabaseDocument.h +++ b/Source/SPDatabaseDocument.h @@ -257,6 +257,7 @@ - (IBAction)copyCreateTableSyntaxFromSheet:(id)sender; - (IBAction)focusOnTableContentFilter:(id)sender; - (IBAction)focusOnTableListFilter:(id)sender; +- (IBAction)export:(id)sender; - (IBAction)exportSelectedTablesAs:(id)sender; // Other methods @@ -306,7 +307,6 @@ - (IBAction)saveConnectionSheet:(id)sender; - (IBAction)import:(id)sender; - (IBAction)importFromClipboard:(id)sender; -- (IBAction)export:(id)sender; - (IBAction)exportTable:(id)sender; - (IBAction)exportMultipleTables:(id)sender; - (IBAction)viewStructure:(id)sender; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index d6c17b5e..75e18ff3 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -2341,6 +2341,17 @@ [tablesListInstance performSelector:@selector(makeTableListFilterHaveFocus) withObject:nil afterDelay:0.1]; } +/** + * Opens the export dialog on the SQL dump tab with the selected tables checked for export. If no tables + * are selected then all tables are checked. + */ +- (IBAction)export:(id)sender +{ + NSArray *tables = [tablesListInstance selectedTableItems]; + + [exportControllerInstance exportTables:([tables count]) ? tables : nil asFormat:SPSQLExport usingSource:SPTableExport]; +} + /** * Exports the selected tables in the chosen file format. */ @@ -3436,19 +3447,6 @@ [tableDumpInstance importFromClipboard]; } -/** - * Passes the request to the dataImport object - */ -- (IBAction)export:(id)sender -{ - if ([sender tag] == -1) { - [exportControllerInstance export]; - } - else { - [tableDumpInstance exportFile:[sender tag]]; - } -} - - (IBAction)exportTable:(id)sender { return [self export:sender]; diff --git a/Source/SPExportController.h b/Source/SPExportController.h index 83b21525..cedebdc3 100644 --- a/Source/SPExportController.h +++ b/Source/SPExportController.h @@ -237,7 +237,6 @@ */ @property(readwrite, assign) MCPConnection *connection; -- (void)export; - (void)exportTables:(NSArray *)table asFormat:(SPExportType)format usingSource:(SPExportSource)source; - (void)openExportErrorsSheetWithString:(NSString *)errors; - (void)displayExportFinishedGrowlNotification; diff --git a/Source/SPExportController.m b/Source/SPExportController.m index 6aa2c3a6..7ccd296d 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -126,14 +126,6 @@ #pragma mark - #pragma mark IB action methods -/** - * Display the export window allowing the user to select what and of what type to export. - */ -- (void)export -{ - [self exportTables:nil asFormat:SPSQLExport usingSource:SPTableExport]; -} - /** * Displays the export window with the supplied tables and export type/format selected. */ -- cgit v1.2.3