Fix a few bugs in the CSV import

Start numbering the rows in the preview table view of the ImportCSVForm
with #1 instead of 0.

Don't create too many columns when filling the preview table view.

Keep the UI responsive when reading a CSV file. This way the progress
dialog can be seen, too.

Don't crash when reading files without an empty line at their end.
This commit is contained in:
Martin Kleusberg
2013-01-05 14:37:58 +01:00
parent a836837b57
commit 9e2beb6c81
2 changed files with 5 additions and 6 deletions

View File

@@ -733,8 +733,8 @@ QStringList DBBrowserDB::decodeCSV(const QString & csvfilename, char sep, char q
QProgressDialog progress("Decoding CSV file...", "Cancel", 0, file.size());
progress.setWindowModality(Qt::ApplicationModal);
char c=0;
while ( c!=-1) {
file.getChar(&c);
while(file.getChar(&c))
{
if (c==quote){
if (inquotemode){
if (inescapemode){
@@ -778,6 +778,7 @@ QStringList DBBrowserDB::decodeCSV(const QString & csvfilename, char sep, char q
}
recs++;
progress.setValue(file.pos());
qApp->processEvents();
if (progress.wasCanceled()) break;
if ((recs>maxrecords)&&(maxrecords!=-1)) {
break;