[PATCH 2/2] Attempt to detect time format on CSV import

Miika Turkia miika.turkia at gmail.com
Sun Jan 31 04:37:58 PST 2016


This attempts to detect the time format when initially importing a CSV
file. Well, only the minutes:seconds notation is detected currently.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 desktop-widgets/divelogimportdialog.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index c99810a..363be80 100644
--- a/desktop-widgets/divelogimportdialog.cpp
+++ b/desktop-widgets/divelogimportdialog.cpp
@@ -527,6 +527,12 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
 					} else if (date.contains('/')) {
 						ui->DateFormat->setCurrentText("mm/dd/yyyy");
 					}
+				} else if (foundHeading == QString::fromLatin1("Time") && columns.count() >= count) {
+					QString time = columns.at(count);
+					if (time.contains(':')) {
+						ui->DurationFormat->setCurrentText("Minutes:seconds");
+
+					}
 				}
 			} else {
 				headers.append("");
-- 
2.5.0



More information about the subsurface mailing list