Fixed html title bug in the forum message when answering to a message in ForumMsgItem.

Fixed enabled sate of the new message buton in ForumsDialog.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4312 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-06-20 21:19:48 +00:00
parent dd17fcdcda
commit 886b366d5c
2 changed files with 35 additions and 25 deletions

View File

@ -759,7 +759,6 @@ void ForumsDialog::fillThreadFinished()
insertPost ();
CalculateIconsAndFonts();
ui.newmessageButton->setEnabled (IS_FORUM_SUBSCRIBED(subscribeFlags));
ui.newthreadButton->setEnabled (IS_FORUM_SUBSCRIBED(subscribeFlags));
}

View File

@ -351,39 +351,50 @@ void ForumMsgItem::sendMsg()
return;
}
QString name = prevSubLabel->text();
QString desc = textEdit->toHtml();
QString desc = textEdit->toHtml();
if(textEdit->toPlainText().isEmpty())
{ /* error message */
{ /* error message */
QMessageBox::warning(this, "RetroShare",tr("Please give a Text Message"),
QMessageBox::Ok, QMessageBox::Ok);
QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty Message!!
}
return; //Don't add a empty Message!!
}
ForumMsgInfo msgInfo;
ForumMsgInfo msg;
msgInfo.forumId = mForumId;
msgInfo.threadId = "";
msgInfo.parentId = mPostId;
msgInfo.msgId = "";
/* get message */
if (rsForums->getForumMessage(mForumId, mPostId, msg)) {
ForumMsgInfo msgInfo;
msgInfo.title = name.toStdWString();
msgInfo.msg = desc.toStdWString();
msgInfo.msgflags = 0;
msgInfo.forumId = mForumId;
msgInfo.threadId = "";
msgInfo.parentId = mPostId;
msgInfo.msgId = "";
if (signedcheckBox->isChecked())
{
msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ;
}
/* modify title */
QString text = QString::fromStdWString(msg.title);
if (text.startsWith("Re:", Qt::CaseInsensitive)) {
msgInfo.title = msg.title;
} else {
msgInfo.title = L"Re: " + msg.title;
}
if ((msgInfo.msg == L"") && (msgInfo.title == L""))
return; /* do nothing */
msgInfo.msg = desc.toStdWString();
msgInfo.msgflags = 0;
if (rsForums->ForumMessageSend(msgInfo) == true) {
textEdit->clear();
}
if (signedcheckBox->isChecked())
{
msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ;
}
if ((msgInfo.msg == L"") && (msgInfo.title == L""))
return; /* do nothing */
if (rsForums->ForumMessageSend(msgInfo) == true) {
textEdit->clear();
}
}
}
void ForumMsgItem::updateAvatar(const QString &peer_id)