Add command line option for setting table to browse after opening · skyformat99/sqlitebrowser@272671d · GitHub
Skip to content

Commit 272671d

Browse files
committed
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 sqlitebrowser#509.
1 parent 5d0f254 commit 272671d

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

‎src/Application.cpp‎

Lines changed: 12 additions & 1 deletion

‎src/MainWindow.cpp‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,12 +2271,17 @@ void MainWindow::editEncryption()
22712271
#endif
22722272
}
22732273

2274-
void MainWindow::switchToBrowseDataTab()
2274+
void MainWindow::switchToBrowseDataTab(QString tableToBrowse)
22752275
{
2276-
if(!ui->dbTreeWidget->selectionModel()->hasSelection())
2277-
return;
2276+
// If no table name was provided get the currently selected table fromt he structure tab
2277+
if(tableToBrowse.isEmpty())
2278+
{
2279+
// Cancel here if there is no selection
2280+
if(!ui->dbTreeWidget->selectionModel()->hasSelection())
2281+
return;
22782282

2279-
QString tableToBrowse = ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), 0)).toString();
2283+
tableToBrowse = ui->dbTreeWidget->model()->data(ui->dbTreeWidget->currentIndex().sibling(ui->dbTreeWidget->currentIndex().row(), 0)).toString();
2284+
}
22802285

22812286
resetBrowser(false);
22822287
ui->comboBrowseTable->setCurrentIndex(ui->comboBrowseTable->findText(tableToBrowse));

‎src/MainWindow.h‎

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)