From 99922722d29d1e4e772580d14f6710726e324496 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 21 Jul 2014 20:34:15 -0300 Subject: Only use HTML if the text has a The text we generate for the diveplan has a table inside, and we must use HTML only for the dive plan. so I treat all text as HTML, look for a table item, if it doesn't have, I treat it as Simple text and set it on the notes. Works and makes linus loves me again. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 7c85825d4..87d2a1beb 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -331,7 +331,7 @@ void MainTab::clearStats() #define UPDATE_TEXT(d, field) \ if (clear || !d.field) \ - ui.field->setText(""); \ + ui.field->setText(QString()); \ else \ ui.field->setText(d.field) @@ -370,6 +370,16 @@ void MainTab::updateDiveInfo(bool clear) process_all_dives(&displayed_dive, &prevd); divePictureModel->updateDivePictures(); + + ui.notes->setText(QString()); + if (!clear) { + QString tmp(displayed_dive.notes); + if (tmp.indexOf("setHtml(tmp); + else + ui.notes->setPlainText(tmp); + } + UPDATE_TEXT(displayed_dive, notes); UPDATE_TEXT(displayed_dive, location); UPDATE_TEXT(displayed_dive, suit); @@ -1004,7 +1014,10 @@ void MainTab::on_notes_textChanged() if (editMode == IGNORE) return; free(displayed_dive.notes); - displayed_dive.notes = strdup(ui.notes->toHtml().toUtf8().data()); + if (ui.notes->toHtml().indexOf("toHtml().toUtf8().data()); + else + displayed_dive.notes = strdup(ui.notes->toPlainText().toUtf8().data()); markChangedWidget(ui.notes); } -- cgit v1.2.3-70-g09d2