Merge pull request #689 from Cockatrice/fix-688
Fix #688. Reuse chat tabs when user opens more chat with same user
This commit is contained in:
commit
059a62a00d
1 changed files with 10 additions and 1 deletions
|
@ -371,7 +371,16 @@ TabMessage *TabSupervisor::addMessageTab(const QString &receiverName, bool focus
|
||||||
otherUser = twi->getUserInfo();
|
otherUser = twi->getUserInfo();
|
||||||
else
|
else
|
||||||
otherUser.set_name(receiverName.toStdString());
|
otherUser.set_name(receiverName.toStdString());
|
||||||
TabMessage *tab = new TabMessage(this, client, *userInfo, otherUser);
|
|
||||||
|
TabMessage *tab;
|
||||||
|
tab = messageTabs.value(QString::fromStdString(otherUser.name()));
|
||||||
|
if (tab) {
|
||||||
|
if (focus)
|
||||||
|
setCurrentWidget(tab);
|
||||||
|
return tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
tab = new TabMessage(this, client, *userInfo, otherUser);
|
||||||
connect(tab, SIGNAL(talkClosing(TabMessage *)), this, SLOT(talkLeft(TabMessage *)));
|
connect(tab, SIGNAL(talkClosing(TabMessage *)), this, SLOT(talkLeft(TabMessage *)));
|
||||||
int tabIndex = myAddTab(tab);
|
int tabIndex = myAddTab(tab);
|
||||||
addCloseButtonToTab(tab, tabIndex);
|
addCloseButtonToTab(tab, tabIndex);
|
||||||
|
|
Loading…
Reference in a new issue