diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 566d33d7..e1899ad2 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -95,8 +95,9 @@ void MainWindow::init() // Create popup menus popupTableMenu = new QMenu(this); popupTableMenu->addAction(ui->editModifyTableAction); - popupTableMenu->addSeparator(); popupTableMenu->addAction(ui->editDeleteObjectAction); + popupTableMenu->addSeparator(); + popupTableMenu->addAction(ui->actionExportCsvPopup); // Set state of checkable menu actions ui->viewMenu->insertAction(ui->viewDBToolbarAction, ui->dockLog->toggleViewAction()); @@ -740,7 +741,9 @@ void MainWindow::exportTableToCSV() { // Get the current table name if we are in the Browse Data tab QString current_table; - if(ui->mainTab->currentIndex() == 1) + if(ui->mainTab->currentIndex() == 0) + current_table = ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), 0)).toString(); + else if(ui->mainTab->currentIndex() == 1) current_table = ui->comboBrowseTable->currentText(); // Open dialog @@ -908,6 +911,7 @@ void MainWindow::changeTreeSelection() } else if(type == "view" || type == "trigger" || type == "index") { ui->editDeleteObjectAction->setEnabled(true); } + ui->actionExportCsvPopup->setEnabled(type == "table" || type == "view"); } void MainWindow::openRecentFile() diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 9dee3a1f..479ec76b 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -272,7 +272,7 @@ 0 0 - 763 + 278 444 @@ -1267,6 +1267,17 @@ Ctrl+F5 + + + false + + + Export as CSV file + + + Export table as comma separated values file + + @@ -1983,6 +1994,22 @@ + + actionExportCsvPopup + triggered() + MainWindow + exportTableToCSV() + + + -1 + -1 + + + 399 + 299 + + + fileOpen()