mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
Add basic JSON export feature
This adds some basic functionality for exporting JSON files by extending the CSV export dialog. There is still a bit of work required for fine-tuning the JSON export feature though. But a standard export of a table s working well already. See issue #688.
This commit is contained in:
@@ -1053,7 +1053,24 @@ void MainWindow::exportTableToCSV()
|
||||
current_table = ui->comboBrowseTable->currentText();
|
||||
|
||||
// Open dialog
|
||||
ExportCsvDialog dialog(&db, this, "", current_table);
|
||||
ExportCsvDialog dialog(&db, ExportCsvDialog::ExportFormatCsv, this, "", current_table);
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void MainWindow::exportTableToJson()
|
||||
{
|
||||
// Get the current table name if we are in the Browse Data tab
|
||||
QString current_table;
|
||||
if(ui->mainTab->currentIndex() == StructureTab) {
|
||||
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() == BrowseTab)
|
||||
current_table = ui->comboBrowseTable->currentText();
|
||||
|
||||
// Open dialog
|
||||
ExportCsvDialog dialog(&db, ExportCsvDialog::ExportFormatJson, this, "", current_table);
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user