QTfrontend/ui/widget/chatwidget.cpp
branchwebgl
changeset 9950 2759212a27de
parent 9728 320f89e0b28c
child 9979 710e0f92c2ab
equal deleted inserted replaced
9521:8054d9d775fd 9950:2759212a27de
   859     if(mil.size())
   859     if(mil.size())
   860         nick = mil[0].data().toString();
   860         nick = mil[0].data().toString();
   861     else
   861     else
   862         nick = m_clickedNick;
   862         nick = m_clickedNick;
   863 
   863 
       
   864     bool isOnline = (mil.size() > 0);
       
   865 
   864     QSortFilterProxyModel * playersSortFilterModel = qobject_cast<QSortFilterProxyModel *>(chatNicks->model());
   866     QSortFilterProxyModel * playersSortFilterModel = qobject_cast<QSortFilterProxyModel *>(chatNicks->model());
   865     if(!playersSortFilterModel)
   867     if(!playersSortFilterModel)
   866         return;
   868         return;
   867 
   869 
   868     PlayersListModel * players = qobject_cast<PlayersListModel *>(playersSortFilterModel->sourceModel());
   870     PlayersListModel * players = qobject_cast<PlayersListModel *>(playersSortFilterModel->sourceModel());
   869 
   871 
   870     if(!players)
   872     if(!players)
   871         return;
   873         return;
   872 
   874 
   873     bool isSelf = (nick == m_userNick);
   875     bool isSelf = (nick == m_userNick);
   874 
   876     bool isInRoom = players->isFlagSet(nick, PlayersListModel::InRoom);
   875     acFollow->setVisible(!isSelf);
   877 
       
   878     acFollow->setVisible(!isSelf && isInRoom);
       
   879 
       
   880     acInfo->setVisible(isOnline);
   876 
   881 
   877     // update context menu labels according to possible action
   882     // update context menu labels according to possible action
   878     if(players->isFlagSet(nick, PlayersListModel::Ignore))
   883     if(players->isFlagSet(nick, PlayersListModel::Ignore))
   879     {
   884     {
   880         acIgnore->setText(QAction::tr("Unignore"));
   885         acIgnore->setText(QAction::tr("Unignore"));
   899         acFriend->setVisible(!isSelf);
   904         acFriend->setVisible(!isSelf);
   900     }
   905     }
   901 
   906 
   902     if (m_isAdmin)
   907     if (m_isAdmin)
   903     {
   908     {
   904         acKick->setVisible(!isSelf);
   909         acKick->setVisible(!isSelf && isOnline);
   905         acBan->setVisible(!isSelf);
   910         acBan->setVisible(!isSelf);
   906     }
   911     }
   907 
   912 
   908     m_nicksMenu->clear();
   913     m_nicksMenu->clear();
   909 
   914