diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2016-05-05 09:26:10 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-05-05 07:27:31 -0700 |
commit | 74065ad8aabb0b43bb70df9ab3cc319dc21f9430 (patch) | |
tree | 7310cf28677d2592699abc8bbfa5e45c18231119 /desktop-widgets/mainwindow.cpp | |
parent | b2d2d13650b4536b70cddbfc0f7946821c7843e4 (diff) | |
download | subsurface-74065ad8aabb0b43bb70df9ab3cc319dc21f9430.tar.gz |
Allow parsing of .txt files on import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index c6624df5a..efe91bf23 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -1723,6 +1723,8 @@ void MainWindow::importFiles(const QStringList fileNames) void MainWindow::importTxtFiles(const QStringList fileNames) { + QStringList csvFiles; + if (fileNames.isEmpty()) return; @@ -1732,7 +1734,17 @@ void MainWindow::importTxtFiles(const QStringList fileNames) fileNamePtr = QFile::encodeName(fileNames.at(i)); csv = fileNamePtr.data(); csv.replace(strlen(csv.data()) - 3, 3, "csv"); - parse_txt_file(fileNamePtr.data(), csv); + + QFileInfo check_file(csv); + if (check_file.exists() && check_file.isFile()) + if (parse_txt_file(fileNamePtr.data(), csv) == 0) + csvFiles += fileNames.at(i); + else + csvFiles += fileNames.at(i); + } + if (csvFiles.size()) { + DiveLogImportDialog *diveLogImport = new DiveLogImportDialog(csvFiles, this); + diveLogImport->show(); } process_dives(true, false); refreshDisplay(); |