diff options
Diffstat (limited to 'subsurface-core/qthelper.cpp')
-rw-r--r-- | subsurface-core/qthelper.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/subsurface-core/qthelper.cpp b/subsurface-core/qthelper.cpp index 091e714de..5b499b068 100644 --- a/subsurface-core/qthelper.cpp +++ b/subsurface-core/qthelper.cpp @@ -214,15 +214,25 @@ void Dive::put_temp() void Dive::put_notes() { + m_notes = QString::fromUtf8(dive->notes); + if (m_notes.isEmpty()) { + m_notes = "--"; + return; + } if (same_string(dive->dc.model, "planned dive")) { QTextDocument notes; - notes.setHtml(QString::fromUtf8(dive->notes)); + QString notesFormatted = m_notes; +#define _NOTES_BR "\n" + notesFormatted = notesFormatted.replace("<thead>", "<thead>"_NOTES_BR); + notesFormatted = notesFormatted.replace("<br>", "<br>"_NOTES_BR); + notesFormatted = notesFormatted.replace("<tr>", "<tr>"_NOTES_BR); + notesFormatted = notesFormatted.replace("</tr>", "</tr>"_NOTES_BR); + notes.setHtml(notesFormatted); m_notes = notes.toPlainText(); + m_notes.replace(_NOTES_BR, "<br>"); +#undef _NOTES_BR } else { - m_notes = QString::fromUtf8(dive->notes); - } - if (m_notes.isEmpty()) { - m_notes = "--"; + m_notes.replace("\n", "<br>"); } } |