@@ -38,7 +38,7 @@ QChar ImportCsvDialog::getSettingsChar(const std::string& group, const std::stri
3838 return value.toChar ();
3939}
4040
41- ImportCsvDialog::ImportCsvDialog (const std::vector<QString>& filenames, DBBrowserDB* db, QWidget* parent)
41+ ImportCsvDialog::ImportCsvDialog (const std::vector<QString>& filenames, DBBrowserDB* db, QWidget* parent, const QString& table )
4242 : QDialog(parent),
4343 ui(new Ui::ImportCsvDialog),
4444 csvFilenames(filenames),
@@ -49,10 +49,14 @@ ImportCsvDialog::ImportCsvDialog(const std::vector<QString>& filenames, DBBrowse
4949 // Hide "Advanced" section of the settings
5050 toggleAdvancedSection (false );
5151
52- // Get the actual file name out of the provided path and use it as the default table name for import
53- // For importing several files at once, the fields have to be the same so we can safely use the first
54- QFileInfo file (filenames.front ());
55- ui->editName ->setText (file.baseName ());
52+ if (!table.isEmpty ()) {
53+ ui->editName ->setText (table);
54+ } else {
55+ // Get the actual file name out of the provided path and use it as the default table name for import
56+ // For importing several files at once, the fields have to be the same so we can safely use the first
57+ QFileInfo file (filenames.front ());
58+ ui->editName ->setText (file.baseName ());
59+ }
5660
5761 // Create a list of all available encodings and create an auto completion list from them
5862 encodingCompleter = new QCompleter (toStringList (QTextCodec::availableCodecs ()), this );
@@ -526,7 +530,7 @@ bool ImportCsvDialog::importCsv(const QString& fileName, const QString& name)
526530 switch (answer) {
527531 case QMessageBox::No:
528532 return true ;
529-
533+
530534 // Stop now if the Cancel button has been clicked. But also indicate, that the entire import process should be stopped.
531535 case QMessageBox::Cancel:
532536 return false ;
0 commit comments