Add command line option for setting table to browse after opening

Add a new command line option -t/--table for directly jumping to a table
after opening the database.

See issue #509.
This commit is contained in:
Martin Kleusberg
2016-02-04 19:37:17 +01:00
parent 5d0f2546b9
commit 272671d7f0
3 changed files with 22 additions and 6 deletions

View File

@@ -2271,12 +2271,17 @@ void MainWindow::editEncryption()
#endif
}
void MainWindow::switchToBrowseDataTab()
void MainWindow::switchToBrowseDataTab(QString tableToBrowse)
{
if(!ui->dbTreeWidget->selectionModel()->hasSelection())
return;
// If no table name was provided get the currently selected table fromt he structure tab
if(tableToBrowse.isEmpty())
{
// Cancel here if there is no selection
if(!ui->dbTreeWidget->selectionModel()->hasSelection())
return;
QString tableToBrowse = ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), 0)).toString();
tableToBrowse = ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), 0)).toString();
}
resetBrowser(false);
ui->comboBrowseTable->setCurrentIndex(ui->comboBrowseTable->findText(tableToBrowse));