mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
CSV import: use date field on profile import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
98f93be0c4
commit
a480d28afd
2 changed files with 16 additions and 3 deletions
|
@ -718,6 +718,8 @@ char *intdup(int index)
|
|||
|
||||
int DiveLogImportDialog::setup_csv_params(QStringList r, char **params, int pnr)
|
||||
{
|
||||
params[pnr++] = strdup("dateField");
|
||||
params[pnr++] = intdup(r.indexOf(tr("Date")));
|
||||
params[pnr++] = strdup("timeField");
|
||||
params[pnr++] = intdup(r.indexOf(tr("Sample time")));
|
||||
params[pnr++] = strdup("depthField");
|
||||
|
@ -819,7 +821,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
|||
sample->tts.seconds *= 60;
|
||||
}
|
||||
} else {
|
||||
char *params[39];
|
||||
char *params[41];
|
||||
int pnr = 0;
|
||||
|
||||
pnr = setup_csv_params(r, params, pnr);
|
||||
|
@ -886,7 +888,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
|||
|
||||
parse_manual_file(fileNames[i].toUtf8().data(), params, pnr - 1);
|
||||
} else {
|
||||
char *params[39];
|
||||
char *params[41];
|
||||
int pnr = 0;
|
||||
|
||||
pnr = setup_csv_params(r, params, pnr);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:include href="commonTemplates.xsl"/>
|
||||
<xsl:strip-space elements="*"/>
|
||||
<xsl:param name="dateField" select="dateField"/>
|
||||
<xsl:param name="timeField" select="timeField"/>
|
||||
<xsl:param name="depthField" select="depthField"/>
|
||||
<xsl:param name="tempField" select="tempField"/>
|
||||
|
@ -40,7 +41,17 @@
|
|||
<dives>
|
||||
<dive>
|
||||
<xsl:attribute name="date">
|
||||
<xsl:value-of select="concat(substring($date, 1, 4), '-', substring($date, 5, 2), '-', substring($date, 7, 2))"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$dateField >= 0">
|
||||
<xsl:call-template name="getFieldByIndex">
|
||||
<xsl:with-param name="index" select="$dateField"/>
|
||||
<xsl:with-param name="line" select="substring-after(substring-after(., $lf), $lf)"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat(substring($date, 1, 4), '-', substring($date, 5, 2), '-', substring($date, 7, 2))"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="time">
|
||||
<xsl:value-of select="concat(substring($time, 2, 2), ':', substring($time, 4, 2))"/>
|
||||
|
|
Loading…
Add table
Reference in a new issue