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 (); insertPost ();
CalculateIconsAndFonts(); CalculateIconsAndFonts();
ui.newmessageButton->setEnabled (IS_FORUM_SUBSCRIBED(subscribeFlags));
ui.newthreadButton->setEnabled (IS_FORUM_SUBSCRIBED(subscribeFlags)); ui.newthreadButton->setEnabled (IS_FORUM_SUBSCRIBED(subscribeFlags));
} }

View File

@ -351,39 +351,50 @@ void ForumMsgItem::sendMsg()
return; return;
} }
QString name = prevSubLabel->text(); QString desc = textEdit->toHtml();
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"),
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; /* get message */
msgInfo.threadId = ""; if (rsForums->getForumMessage(mForumId, mPostId, msg)) {
msgInfo.parentId = mPostId; ForumMsgInfo msgInfo;
msgInfo.msgId = "";
msgInfo.title = name.toStdWString(); msgInfo.forumId = mForumId;
msgInfo.msg = desc.toStdWString(); msgInfo.threadId = "";
msgInfo.msgflags = 0; msgInfo.parentId = mPostId;
msgInfo.msgId = "";
if (signedcheckBox->isChecked()) /* modify title */
{ QString text = QString::fromStdWString(msg.title);
msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ; if (text.startsWith("Re:", Qt::CaseInsensitive)) {
} msgInfo.title = msg.title;
} else {
msgInfo.title = L"Re: " + msg.title;
}
if ((msgInfo.msg == L"") && (msgInfo.title == L"")) msgInfo.msg = desc.toStdWString();
return; /* do nothing */ msgInfo.msgflags = 0;
if (rsForums->ForumMessageSend(msgInfo) == true) { if (signedcheckBox->isChecked())
textEdit->clear(); {
} 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) void ForumMsgItem::updateAvatar(const QString &peer_id)