Commit b96604d8 authored by Gavin Bisesi's avatar Gavin Bisesi
Browse files

Merge pull request #854 from ctrlaltca/pvtmsg_tab_name

Private Chat Tab Update
parents 894a4316 1f33e34d
......@@ -51,7 +51,7 @@ void TabMessage::addMentionTag(QString mentionTag) {
void TabMessage::retranslateUi()
{
messageMenu->setTitle(tr("Personal &talk"));
messageMenu->setTitle(tr("Private &chat"));
aLeave->setText(tr("&Leave"));
}
......@@ -68,7 +68,7 @@ QString TabMessage::getUserName() const
QString TabMessage::getTabText() const
{
return tr("Talking to %1").arg(QString::fromStdString(otherUserInfo->name()));
return tr("%1 - Private chat").arg(QString::fromStdString(otherUserInfo->name()));
}
void TabMessage::closeRequest()
......
......@@ -126,7 +126,10 @@ void TabSupervisor::retranslateUi()
for (int i = 0; i < tabs.size(); ++i)
if (tabs[i]) {
setTabText(indexOf(tabs[i]), sanitizeTabName(tabs[i]->getTabText()));
int idx = indexOf(tabs[i]);
QString tabText = tabs[i]->getTabText();
setTabText(idx, sanitizeTabName(tabText));
setTabToolTip(idx, sanitizeHtml(tabText));
tabs[i]->retranslateUi();
}
}
......@@ -158,11 +161,25 @@ QString TabSupervisor::sanitizeTabName(QString dirty) const
return dirty.replace("&", "&&");
}
QString TabSupervisor::sanitizeHtml(QString dirty) const
{
return dirty
.replace("&", "&amp;")
.replace("<", "&lt;")
.replace(">", "&gt;")
.replace("\"", "&quot;");
}
int TabSupervisor::myAddTab(Tab *tab)
{
connect(tab, SIGNAL(userEvent(bool)), this, SLOT(tabUserEvent(bool)));
connect(tab, SIGNAL(tabTextChanged(Tab *, QString)), this, SLOT(updateTabText(Tab *, QString)));
return addTab(tab, sanitizeTabName(tab->getTabText()));
QString tabText = tab->getTabText();
int idx = addTab(tab, sanitizeTabName(tabText));
setTabToolTip(idx, sanitizeHtml(tabText));
return idx;
}
void TabSupervisor::start(const ServerInfo_User &_userInfo)
......@@ -457,7 +474,9 @@ void TabSupervisor::tabUserEvent(bool globalEvent)
void TabSupervisor::updateTabText(Tab *tab, const QString &newTabText)
{
setTabText(indexOf(tab), newTabText);
int idx = indexOf(tab);
setTabText(idx, sanitizeTabName(newTabText));
setTabToolTip(idx, sanitizeHtml(newTabText));
}
void TabSupervisor::processRoomEvent(const RoomEvent &event)
......
......@@ -59,6 +59,7 @@ private:
int myAddTab(Tab *tab);
void addCloseButtonToTab(Tab *tab, int tabIndex);
QString sanitizeTabName(QString dirty) const;
QString sanitizeHtml(QString dirty) const;
public:
TabSupervisor(AbstractClient *_client, QWidget *parent = 0);
~TabSupervisor();
......
......@@ -38,7 +38,7 @@ UserContextMenu::UserContextMenu(const TabSupervisor *_tabSupervisor, QWidget *p
void UserContextMenu::retranslateUi()
{
aDetails->setText(tr("User &details"));
aChat->setText(tr("Direct &chat"));
aChat->setText(tr("Private &chat"));
aShowGames->setText(tr("Show this user's &games"));
aAddToBuddyList->setText(tr("Add to &buddy list"));
aRemoveFromBuddyList->setText(tr("Remove from &buddy list"));
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment