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
This commit is contained in:
csoler 2012-11-19 21:35:48 +00:00
parent e6563eba52
commit 93501bdc12
3 changed files with 9 additions and 8 deletions

View File

@ -353,8 +353,6 @@ void ForumMsgItem::sendMsg()
return; return;
} }
QString desc = textEdit->toHtml();
if(textEdit->toPlainText().isEmpty()) if(textEdit->toPlainText().isEmpty())
{ /* error message */ { /* error message */
QMessageBox::warning(this, "RetroShare",tr("Please give a Text Message"), QMessageBox::warning(this, "RetroShare",tr("Please give a Text Message"),
@ -382,6 +380,9 @@ void ForumMsgItem::sendMsg()
msgInfo.title = L"Re: " + msg.title; msgInfo.title = L"Re: " + msg.title;
} }
QString desc;
RsHtml::optimizeHtml(textEdit, desc);
msgInfo.msg = desc.toStdWString(); msgInfo.msg = desc.toStdWString();
msgInfo.msgflags = 0; msgInfo.msgflags = 0;

View File

@ -35,6 +35,7 @@
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "gui/common/Emoticons.h" #include "gui/common/Emoticons.h"
#include "util/HandleRichText.h"
#include "util/misc.h" #include "util/misc.h"
#include <sys/stat.h> #include <sys/stat.h>
@ -153,10 +154,9 @@ void CreateForumMsg::newMsg()
void CreateForumMsg::createMsg() void CreateForumMsg::createMsg()
{ {
QString name = misc::removeNewLine(ui.forumSubject->text()); QString name = misc::removeNewLine(ui.forumSubject->text());
QString desc = ui.forumMessage->toHtml(); QString desc;
if(desc == QTextDocument(ui.forumMessage->toPlainText()).toHtml()) RsHtml::optimizeHtml(ui.forumMessage, desc);
desc = ui.forumMessage->toPlainText() ;
if(name.isEmpty()) if(name.isEmpty())
{ /* error message */ { /* error message */

View File

@ -35,6 +35,7 @@
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "gui/common/Emoticons.h" #include "gui/common/Emoticons.h"
#include "util/HandleRichText.h"
#include "util/misc.h" #include "util/misc.h"
#include <sys/stat.h> #include <sys/stat.h>
@ -224,10 +225,9 @@ void CreateForumV2Msg::loadFormInformation()
void CreateForumV2Msg::createMsg() void CreateForumV2Msg::createMsg()
{ {
QString name = misc::removeNewLine(ui.forumSubject->text()); QString name = misc::removeNewLine(ui.forumSubject->text());
QString desc = ui.forumMessage->toHtml(); QString desc;
if(desc == QTextDocument(ui.forumMessage->toPlainText()).toHtml()) RsHtml::optimizeHtml(ui.forumMessage, desc);
desc = ui.forumMessage->toPlainText() ;
if(name.isEmpty()) if(name.isEmpty())
{ /* error message */ { /* error message */