Remove nick from anchor names, causes problems

- Nicknames that contain " could break the formatting
- Nicknames containing chars like < or > were converted to html entities
  by the QTextBrowser so the anchor was no longer identical with the
  anchor stored in the _listMsg list
This commit is contained in:
AsamK 2015-08-31 01:38:09 +02:00
parent de92c06f0b
commit 5f81d8efc8
2 changed files with 2 additions and 3 deletions

View File

@ -257,9 +257,8 @@ void ChatLobbyUserNotify::chatLobbyNewMessage(ChatLobbyId lobby_id, QDateTime ti
if ((bGetNickName || bFoundTextToNotify || _bCountUnRead)){
QString strAnchor = time.toString(Qt::ISODate);
strAnchor.append("_").append(senderName);
MsgData msgData;
msgData.text=msg;
msgData.text=senderName + ": " + msg;
msgData.unread=!(bGetNickName || bFoundTextToNotify);
_listMsg[lobby_id][strAnchor]=msgData;

View File

@ -902,7 +902,7 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const QDateTime
QString formatMsg = chatStyle.formatMessage(type, name, dtTimestamp, formattedMessage, formatFlag);
QString timeStamp = dtTimestamp.toString(Qt::ISODate);
formatMsg.prepend(QString("<a name=\"%1_%2\"/>").arg(timeStamp).arg(name));
formatMsg.prepend(QString("<a name=\"%1\"/>").arg(timeStamp));
//To call this anchor do: ui->textBrowser->scrollToAnchor(QString("%1_%2").arg(timeStamp).arg(name));
QTextCursor textCursor = QTextCursor(ui->textBrowser->textCursor());
textCursor.movePosition(QTextCursor::End);