mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
Allow for interactive CSV file import
- Tweak input checker - Preserve old file import as not to cause any unforeseen breaks - Allow ignoring file name when importing multiple files to tables - Mass toggle several files for import
This commit is contained in:
@@ -1094,16 +1094,20 @@ void MainWindow::mainTabSelected(int tabindex)
|
||||
|
||||
void MainWindow::importTableFromCSV()
|
||||
{
|
||||
QString wFile = FileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Choose a text file"),
|
||||
tr("Text files(*.csv *.txt);;All files(*)"));
|
||||
QStringList wFiles = FileDialog::getOpenFileNames(
|
||||
this,
|
||||
tr("Choose text files"),
|
||||
tr("Text files(*.csv *.txt);;All files(*)"));
|
||||
|
||||
if (QFile::exists(wFile) )
|
||||
{
|
||||
ImportCsvDialog dialog(wFile, &db, this);
|
||||
if(dialog.exec())
|
||||
{
|
||||
QStringList validFiles;
|
||||
foreach(auto file, wFiles) {
|
||||
if (QFile::exists(file))
|
||||
validFiles.append(file);
|
||||
}
|
||||
|
||||
if (!validFiles.isEmpty()) {
|
||||
ImportCsvDialog dialog(validFiles, &db, this);
|
||||
if (dialog.exec()) {
|
||||
populateTable();
|
||||
QMessageBox::information(this, QApplication::applicationName(), tr("Import completed"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user