From 0f88fac26f19ec0b80353b8657ac0e794e0a2ffd Mon Sep 17 00:00:00 2001 From: Vladislav Tronko Date: Thu, 21 Jul 2016 18:32:00 +0300 Subject: [PATCH] Check selection before exporting to CSV --- src/MainWindow.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 9c0bc438..eac7274b 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1058,8 +1058,11 @@ void MainWindow::exportTableToCSV() { // Get the current table name if we are in the Browse Data tab QString current_table; - if(ui->mainTab->currentIndex() == 0) - current_table = ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), 0)).toString(); + if(ui->mainTab->currentIndex() == 0) { + QString type = ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), 1)).toString(); + if(type == "table" || type == "view") + 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();