diff --git a/src/widget/friendwidget.cpp b/src/widget/friendwidget.cpp index 05f9e2453..53d897b58 100644 --- a/src/widget/friendwidget.cpp +++ b/src/widget/friendwidget.cpp @@ -363,15 +363,14 @@ void FriendWidget::search(const QString& searchString, bool hide) circleWidget->search(searchString); } +// TODO: Remove bool FriendWidget::chatFormIsSet(bool focus) const { - Friend* f = FriendList::findFriend(friendId); if (focus) { ContentDialog::focusFriend(friendId); } - bool exist = ContentDialog::friendWidgetExists(friendId); - return exist || f->getChatForm()->isVisible(); + return ContentDialog::friendWidgetExists(friendId); } void FriendWidget::setChatForm(ContentLayout* contentLayout) diff --git a/src/widget/groupwidget.cpp b/src/widget/groupwidget.cpp index a65492043..2a5f808cc 100644 --- a/src/widget/groupwidget.cpp +++ b/src/widget/groupwidget.cpp @@ -198,15 +198,14 @@ Group* GroupWidget::getGroup() const return GroupList::findGroup(groupId); } +// TODO: Remove bool GroupWidget::chatFormIsSet(bool focus) const { - Group* g = GroupList::findGroup(groupId); if (focus) { ContentDialog::focusGroup(groupId); } - bool exist = ContentDialog::groupWidgetExists(groupId); - return exist || g->getChatForm()->isVisible(); + return ContentDialog::groupWidgetExists(groupId); } void GroupWidget::setChatForm(ContentLayout* contentLayout) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 774a19727..5fd2ac885 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -1117,7 +1117,14 @@ void Widget::openDialog(GenericChatroomWidget* widget, bool newWindow) widget->resetEventFlags(); widget->updateStatusLight(); - if (widget->chatFormIsSet(true) && !newWindow) { + GenericChatForm* form; + if (widget->getFriend()) { + form = widget->getFriend()->getChatForm(); + } else { + form = widget->getGroup()->getChatForm(); + } + + if ((widget->chatFormIsSet(true) || form->isVisible()) && !newWindow) { return; }