Disable some usercontextmenu actions if the user is offline; fix #234

This commit is contained in:
Fabio Bas 2014-07-27 00:26:12 +02:00
parent ea897ee2ef
commit fe12f71b93
4 changed files with 9 additions and 7 deletions

View file

@ -102,7 +102,7 @@ void UserContextMenu::banUser_dialogFinished()
client->sendCommand(client->prepareModeratorCommand(cmd));
}
void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName, UserLevelFlags userLevel, int playerId)
void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName, UserLevelFlags userLevel, bool online, int playerId)
{
aUserName->setText(userName);
@ -132,8 +132,9 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
menu->addAction(aBan);
}
bool anotherUser = userName != QString::fromStdString(tabSupervisor->getUserInfo()->name());
aChat->setEnabled(anotherUser);
aShowGames->setEnabled(anotherUser);
aDetails->setEnabled(online);
aChat->setEnabled(anotherUser && online);
aShowGames->setEnabled(anotherUser && online);
aAddToBuddyList->setEnabled(anotherUser);
aRemoveFromBuddyList->setEnabled(anotherUser);
aAddToIgnoreList->setEnabled(anotherUser);