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) @@ -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)

5
src/widget/groupwidget.cpp

@ -198,15 +198,14 @@ Group* GroupWidget::getGroup() const @@ -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)

9
src/widget/widget.cpp

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

Loading…
Cancel
Save