Browse Source

fix(chatForm): Fix issue with mixing friend and group id

Fix #4828
pull/4829/head
Diadlo 8 years ago
parent
commit
5bc8ef4e74
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
  1. 16
      src/widget/widget.cpp

16
src/widget/widget.cpp

@ -55,6 +55,7 @@
#include "src/model/friend.h" #include "src/model/friend.h"
#include "src/friendlist.h" #include "src/friendlist.h"
#include "src/model/group.h" #include "src/model/group.h"
#include "src/model/profile/profileinfo.h"
#include "src/grouplist.h" #include "src/grouplist.h"
#include "src/net/autoupdate.h" #include "src/net/autoupdate.h"
#include "src/nexus.h" #include "src/nexus.h"
@ -73,8 +74,6 @@
#include "src/widget/translator.h" #include "src/widget/translator.h"
#include "tool/removefrienddialog.h" #include "tool/removefrienddialog.h"
#include <src/model/profile/profileinfo.h>
bool toxActivateEventHandler(const QByteArray&) bool toxActivateEventHandler(const QByteArray&)
{ {
Widget* widget = Nexus::getDesktopGUI(); Widget* widget = Nexus::getDesktopGUI();
@ -1132,16 +1131,23 @@ void Widget::openDialog(GenericChatroomWidget* widget, bool newWindow)
GenericChatForm* form; GenericChatForm* form;
const Friend* frnd = widget->getFriend(); const Friend* frnd = widget->getFriend();
if (frnd) { if (frnd) {
form = chatForms[frnd->getId()];
id = frnd->getId(); id = frnd->getId();
form = chatForms[id];
} else { } else {
Group* g = widget->getGroup(); Group* g = widget->getGroup();
form = g->getChatForm(); form = g->getChatForm();
id = g->getId(); id = g->getId();
} }
ContentDialog::focusFriend(id); bool chatFormIsSet;
bool chatFormIsSet = ContentDialog::friendWidgetExists(id); if (frnd) {
ContentDialog::focusFriend(id);
chatFormIsSet = ContentDialog::friendWidgetExists(id);
} else {
ContentDialog::focusGroup(id);
chatFormIsSet = ContentDialog::groupWidgetExists(id);
}
if ((chatFormIsSet || form->isVisible()) && !newWindow) { if ((chatFormIsSet || form->isVisible()) && !newWindow) {
return; return;
} }

Loading…
Cancel
Save