mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Correctly handle dive notes in maintab.cpp
Remove duplicate and incorrect setPlainText call via macro for dive notes. Deal correctly with ASCII line breaks "\n" in dive notes with html markup (replace them with <br>). Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
parent
00e3346835
commit
b7806d1b94
1 changed files with 8 additions and 5 deletions
|
@ -426,12 +426,13 @@ void MainTab::updateDiveInfo(bool clear)
|
|||
ui.notes->setText(QString());
|
||||
if (!clear) {
|
||||
QString tmp(displayed_dive.notes);
|
||||
if (tmp.indexOf("<table") != -1)
|
||||
if (tmp.indexOf("<table") != -1) {
|
||||
tmp.replace(QString("\n"), QString("<br>"));
|
||||
ui.notes->setHtml(tmp);
|
||||
else
|
||||
} else {
|
||||
ui.notes->setPlainText(tmp);
|
||||
}
|
||||
}
|
||||
UPDATE_TEXT(displayed_dive, notes);
|
||||
UPDATE_TEXT(displayed_dive, suit);
|
||||
UPDATE_TEXT(displayed_dive, divemaster);
|
||||
UPDATE_TEXT(displayed_dive, buddy);
|
||||
|
@ -1494,10 +1495,12 @@ void MainTab::showAndTriggerEditSelective(struct dive_components what)
|
|||
SHOW_SELECTIVE(suit);
|
||||
if (what.notes) {
|
||||
QString tmp(displayed_dive.notes);
|
||||
if (tmp.contains("<table"))
|
||||
if (tmp.contains("<table")) {
|
||||
tmp.replace(QString("\n"), QString("<br>"));
|
||||
ui.notes->setHtml(tmp);
|
||||
else
|
||||
} else {
|
||||
ui.notes->setPlainText(tmp);
|
||||
}
|
||||
}
|
||||
if (what.rating)
|
||||
ui.rating->setCurrentStars(displayed_dive.rating);
|
||||
|
|
Loading…
Reference in a new issue