Browse Source

refactor: Remove Friend::getChatForm using

reviewable/pr4484/r1
Diadlo 8 years ago
parent
commit
31d35ecc62
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
  1. 5
      src/widget/friendwidget.cpp
  2. 5
      src/widget/groupwidget.cpp
  3. 9
      src/widget/widget.cpp

5
src/widget/friendwidget.cpp

@ -363,15 +363,14 @@ void FriendWidget::search(const QString& searchString, bool hide)
circleWidget->search(searchString); circleWidget->search(searchString);
} }
// TODO: Remove
bool FriendWidget::chatFormIsSet(bool focus) const bool FriendWidget::chatFormIsSet(bool focus) const
{ {
Friend* f = FriendList::findFriend(friendId);
if (focus) { if (focus) {
ContentDialog::focusFriend(friendId); ContentDialog::focusFriend(friendId);
} }
bool exist = ContentDialog::friendWidgetExists(friendId); return ContentDialog::friendWidgetExists(friendId);
return exist || f->getChatForm()->isVisible();
} }
void FriendWidget::setChatForm(ContentLayout* contentLayout) void FriendWidget::setChatForm(ContentLayout* contentLayout)

5
src/widget/groupwidget.cpp

@ -198,15 +198,14 @@ Group* GroupWidget::getGroup() const
return GroupList::findGroup(groupId); return GroupList::findGroup(groupId);
} }
// TODO: Remove
bool GroupWidget::chatFormIsSet(bool focus) const bool GroupWidget::chatFormIsSet(bool focus) const
{ {
Group* g = GroupList::findGroup(groupId);
if (focus) { if (focus) {
ContentDialog::focusGroup(groupId); ContentDialog::focusGroup(groupId);
} }
bool exist = ContentDialog::groupWidgetExists(groupId); return ContentDialog::groupWidgetExists(groupId);
return exist || g->getChatForm()->isVisible();
} }
void GroupWidget::setChatForm(ContentLayout* contentLayout) void GroupWidget::setChatForm(ContentLayout* contentLayout)

9
src/widget/widget.cpp

@ -1117,7 +1117,14 @@ void Widget::openDialog(GenericChatroomWidget* widget, bool newWindow)
widget->resetEventFlags(); widget->resetEventFlags();
widget->updateStatusLight(); 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; return;
} }

Loading…
Cancel
Save