From 93501bdc1269fe0a9c36e6ac40d7af5ed28b9fcf Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 19 Nov 2012 21:35:48 +0000 Subject: [PATCH] patch from AC to perform html optimization of forum posts using the canonical function optimizeHtml() git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5847 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/feeds/ForumMsgItem.cpp | 5 +++-- retroshare-gui/src/gui/forums/CreateForumMsg.cpp | 6 +++--- retroshare-gui/src/gui/forumsv2/CreateForumV2Msg.cpp | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/retroshare-gui/src/gui/feeds/ForumMsgItem.cpp b/retroshare-gui/src/gui/feeds/ForumMsgItem.cpp index 32ca0c34a..2a4fadde6 100644 --- a/retroshare-gui/src/gui/feeds/ForumMsgItem.cpp +++ b/retroshare-gui/src/gui/feeds/ForumMsgItem.cpp @@ -353,8 +353,6 @@ void ForumMsgItem::sendMsg() return; } - QString desc = textEdit->toHtml(); - if(textEdit->toPlainText().isEmpty()) { /* error message */ QMessageBox::warning(this, "RetroShare",tr("Please give a Text Message"), @@ -382,6 +380,9 @@ void ForumMsgItem::sendMsg() msgInfo.title = L"Re: " + msg.title; } + QString desc; + RsHtml::optimizeHtml(textEdit, desc); + msgInfo.msg = desc.toStdWString(); msgInfo.msgflags = 0; diff --git a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp index a222daaff..747d89dd3 100644 --- a/retroshare-gui/src/gui/forums/CreateForumMsg.cpp +++ b/retroshare-gui/src/gui/forums/CreateForumMsg.cpp @@ -35,6 +35,7 @@ #include "gui/RetroShareLink.h" #include "gui/common/Emoticons.h" +#include "util/HandleRichText.h" #include "util/misc.h" #include @@ -153,10 +154,9 @@ void CreateForumMsg::newMsg() void CreateForumMsg::createMsg() { QString name = misc::removeNewLine(ui.forumSubject->text()); - QString desc = ui.forumMessage->toHtml(); + QString desc; - if(desc == QTextDocument(ui.forumMessage->toPlainText()).toHtml()) - desc = ui.forumMessage->toPlainText() ; + RsHtml::optimizeHtml(ui.forumMessage, desc); if(name.isEmpty()) { /* error message */ diff --git a/retroshare-gui/src/gui/forumsv2/CreateForumV2Msg.cpp b/retroshare-gui/src/gui/forumsv2/CreateForumV2Msg.cpp index b6a0ec6d6..5bc3af714 100644 --- a/retroshare-gui/src/gui/forumsv2/CreateForumV2Msg.cpp +++ b/retroshare-gui/src/gui/forumsv2/CreateForumV2Msg.cpp @@ -35,6 +35,7 @@ #include "gui/RetroShareLink.h" #include "gui/common/Emoticons.h" +#include "util/HandleRichText.h" #include "util/misc.h" #include @@ -224,10 +225,9 @@ void CreateForumV2Msg::loadFormInformation() void CreateForumV2Msg::createMsg() { QString name = misc::removeNewLine(ui.forumSubject->text()); - QString desc = ui.forumMessage->toHtml(); + QString desc; - if(desc == QTextDocument(ui.forumMessage->toPlainText()).toHtml()) - desc = ui.forumMessage->toPlainText() ; + RsHtml::optimizeHtml(ui.forumMessage, desc); if(name.isEmpty()) { /* error message */