1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge remote-tracking branch 'thenain38/fix-HTML-username-status'

This commit is contained in:
agilob 2015-10-06 19:01:45 +01:00
commit 6c26262ba3
No known key found for this signature in database
GPG Key ID: 296F0B764741106C
6 changed files with 17 additions and 10 deletions

View File

@ -58,7 +58,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
{
case ACTION:
senderText = "*";
text = wrapDiv(QString("%1 %2").arg(sender, text), "action");
text = wrapDiv(QString("%1 %2").arg(sender.toHtmlEscaped(), text), "action");
msg->setAsAction();
break;
case ALERT:

View File

@ -858,6 +858,9 @@ QSplitter:handle{
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
<item>
@ -937,6 +940,9 @@ QSplitter:handle{
<pointsize>8</pointsize>
</font>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
</layout>

View File

@ -1003,7 +1003,7 @@ void ChatForm::setFriendTyping(bool isTyping)
chatWidget->setTypingNotificationVisible(isTyping);
Text* text = static_cast<Text*>(chatWidget->getTypingNotification()->getContent(1));
text->setText("<div class=typing>" + QString("%1 is typing").arg(f->getDisplayedName()) + "</div>");
text->setText("<div class=typing>" + QString("%1 is typing").arg(f->getDisplayedName().toHtmlEscaped()) + "</div>");
}
void ChatForm::show(ContentLayout* contentLayout)

View File

@ -254,7 +254,7 @@ QDate GenericChatForm::getLatestDate() const
void GenericChatForm::setName(const QString &newName)
{
nameLabel->setText(newName);
nameLabel->setToolTip(newName); // for overlength names
nameLabel->setToolTip(newName.toHtmlEscaped()); // for overlength names
}
void GenericChatForm::show(ContentLayout* contentLayout)
@ -294,17 +294,18 @@ void GenericChatForm::onChatContextMenuRequested(QPoint pos)
ChatMessage::Ptr GenericChatForm::addMessage(const ToxId& author, const QString &message, bool isAction,
const QDateTime &datetime, bool isSent)
{
QString authorStr = author.isActiveProfile() ? Core::getInstance()->getUsername() : resolveToxId(author);
bool authorIsActiveProfile = author.isActiveProfile();
QString authorStr = authorIsActiveProfile ? Core::getInstance()->getUsername() : resolveToxId(author);
ChatMessage::Ptr msg;
if (isAction)
{
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::ACTION, false);
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::ACTION, authorIsActiveProfile);
previousId.clear();
}
else
{
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::NORMAL, author.isActiveProfile());
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::NORMAL, authorIsActiveProfile);
if ( (author == previousId) && (prevMsgDateTime.secsTo(QDateTime::currentDateTime()) < getChatLog()->repNameAfter) )
msg->hideSender();

View File

@ -8,7 +8,7 @@ RemoveFriendDialog::RemoveFriendDialog(QWidget *parent, const Friend *f)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setAttribute(Qt::WA_QuitOnClose, false);
ui.setupUi(this);
ui.label->setText(ui.label->text().replace("&lt;name&gt;", f->getDisplayedName()));
ui.label->setText(ui.label->text().replace("&lt;name&gt;", f->getDisplayedName().toHtmlEscaped()));
auto removeButton = ui.buttonBox->button(QDialogButtonBox::Ok);
auto cancelButton = ui.buttonBox->button(QDialogButtonBox::Cancel);
removeButton->setText(tr("Remove"));

View File

@ -801,7 +801,7 @@ void Widget::setUsername(const QString& username)
else
{
ui->nameLabel->setText(username);
ui->nameLabel->setToolTip(username); // for overlength names
ui->nameLabel->setToolTip(username.toHtmlEscaped()); // for overlength names
}
QString sanename = username;
@ -826,7 +826,7 @@ void Widget::setStatusMessage(const QString &statusMessage)
else
{
ui->statusLabel->setText(statusMessage);
ui->statusLabel->setToolTip(statusMessage); // for overlength messsages
ui->statusLabel->setToolTip(statusMessage.toHtmlEscaped()); // for overlength messsages
}
}
@ -1425,7 +1425,7 @@ void Widget::onGroupInviteReceived(int32_t friendId, uint8_t type, QByteArray in
{
if (type == TOX_GROUPCHAT_TYPE_TEXT || type == TOX_GROUPCHAT_TYPE_AV)
{
if (GUI::askQuestion(tr("Group invite", "popup title"), tr("%1 has invited you to a groupchat. Would you like to join?", "popup text").arg(Nexus::getCore()->getFriendUsername(friendId)), true, false))
if (GUI::askQuestion(tr("Group invite", "popup title"), tr("%1 has invited you to a groupchat. Would you like to join?", "popup text").arg(Nexus::getCore()->getFriendUsername(friendId).toHtmlEscaped()), true, false))
{
int groupId = Nexus::getCore()->joinGroupchat(friendId, type, (uint8_t*)invite.data(), invite.length());
if (groupId < 0)