@@ -58,8 +58,8 @@ ImportCsvDialog::ImportCsvDialog(const QStringList &filenames, DBBrowserDB* db,
5858 ui->checkboxHeader ->setChecked (Settings::getValue (" importcsv" , " firstrowheader" ).toBool ());
5959 ui->checkBoxTrimFields ->setChecked (Settings::getValue (" importcsv" , " trimfields" ).toBool ());
6060 ui->checkBoxSeparateTables ->setChecked (Settings::getValue (" importcsv" , " separatetables" ).toBool ());
61- setSeparatorChar (static_cast < char32_t >( Settings::getValue (" importcsv" , " separator" ).toInt () ));
62- setQuoteChar (static_cast < char32_t >( Settings::getValue (" importcsv" , " quotecharacter" ).toInt () ));
61+ setSeparatorChar (Settings::getValue (" importcsv" , " separator" ).toChar ( ));
62+ setQuoteChar (Settings::getValue (" importcsv" , " quotecharacter" ).toChar ( ));
6363 setEncoding (Settings::getValue (" importcsv" , " encoding" ).toString ());
6464
6565 ui->checkboxHeader ->blockSignals (false );
@@ -375,7 +375,7 @@ CSVParser::ParserResult ImportCsvDialog::parseCSV(const QString &fileName, std::
375375 QFile file (fileName);
376376 file.open (QIODevice::ReadOnly);
377377
378- CSVParser csv (ui->checkBoxTrimFields ->isChecked (), currentSeparatorChar (), currentQuoteChar ());
378+ CSVParser csv (ui->checkBoxTrimFields ->isChecked (), toUtf8 ( currentSeparatorChar ()), toUtf8 ( currentQuoteChar () ));
379379
380380 // Only show progress dialog if we parse all rows. The assumption here is that if a row count limit has been set, it won't be a very high one.
381381 if (count == 0 )
@@ -704,7 +704,7 @@ bool ImportCsvDialog::importCsv(const QString& fileName, const QString& name)
704704 return true ;
705705}
706706
707- void ImportCsvDialog::setQuoteChar (char32_t c)
707+ void ImportCsvDialog::setQuoteChar (QChar c)
708708{
709709 QComboBox* combo = ui->comboQuote ;
710710 int index = combo->findText (QString (c));
@@ -719,21 +719,20 @@ void ImportCsvDialog::setQuoteChar(char32_t c)
719719 }
720720}
721721
722- char32_t ImportCsvDialog::currentQuoteChar () const
722+ QChar ImportCsvDialog::currentQuoteChar () const
723723{
724724 QString value;
725725
726726 // The last item in the combobox is the 'Other' item; if it is selected return the text of the line edit field instead
727727 if (ui->comboQuote ->currentIndex () == ui->comboQuote ->count ()-1 )
728728 value = ui->editCustomQuote ->text ().length () ? ui->editCustomQuote ->text () : " " ;
729-
730- if (ui->comboQuote ->currentText ().length ())
729+ else if (ui->comboQuote ->currentText ().length ())
731730 value = ui->comboQuote ->currentText ();
732731
733- return toUtf8 ( value);
732+ return value. size () ? value. front () : QChar ( );
734733}
735734
736- void ImportCsvDialog::setSeparatorChar (char32_t c)
735+ void ImportCsvDialog::setSeparatorChar (QChar c)
737736{
738737 QComboBox* combo = ui->comboSeparator ;
739738 QString sText = c == ' \t ' ? QString (" Tab" ) : QString (c);
@@ -749,7 +748,7 @@ void ImportCsvDialog::setSeparatorChar(char32_t c)
749748 }
750749}
751750
752- char32_t ImportCsvDialog::currentSeparatorChar () const
751+ QChar ImportCsvDialog::currentSeparatorChar () const
753752{
754753 QString value;
755754
@@ -759,7 +758,7 @@ char32_t ImportCsvDialog::currentSeparatorChar() const
759758 else
760759 value = ui->comboSeparator ->currentText () == tr (" Tab" ) ? " \t " : ui->comboSeparator ->currentText ();
761760
762- return toUtf8 ( value);
761+ return value. size () ? value. front () : QChar ( );
763762}
764763
765764void ImportCsvDialog::setEncoding (const QString& sEnc )
0 commit comments