mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Reduce TabSupervisor direct usage in UserContextMenu
This commit is contained in:
parent
c5aa75d4d1
commit
a3f4012d1a
5 changed files with 25 additions and 7 deletions
|
|
@ -245,7 +245,7 @@ void UserContextMenu::warnUser_dialogFinished()
|
|||
{
|
||||
WarningDialog *dlg = static_cast<WarningDialog *>(sender());
|
||||
|
||||
if (dlg->getName().isEmpty() || QString::fromStdString(tabSupervisor->getUserInfo()->name()).simplified().isEmpty())
|
||||
if (dlg->getName().isEmpty() || tabSupervisor->getOwnUsername().simplified().isEmpty())
|
||||
return;
|
||||
|
||||
Command_WarnUser cmd;
|
||||
|
|
@ -267,13 +267,13 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
|
|||
menu->addAction(aDetails);
|
||||
menu->addAction(aShowGames);
|
||||
menu->addAction(aChat);
|
||||
if (userLevel.testFlag(ServerInfo_User::IsRegistered) && (tabSupervisor->getUserInfo()->user_level() & ServerInfo_User::IsRegistered)) {
|
||||
if (userLevel.testFlag(ServerInfo_User::IsRegistered) && tabSupervisor->isOwnUserRegistered()) {
|
||||
menu->addSeparator();
|
||||
if (tabSupervisor->getUserListsTab()->getBuddyList()->getUsers().contains(userName))
|
||||
if (tabSupervisor->isUserBuddy(userName))
|
||||
menu->addAction(aRemoveFromBuddyList);
|
||||
else
|
||||
menu->addAction(aAddToBuddyList);
|
||||
if (tabSupervisor->getUserListsTab()->getIgnoreList()->getUsers().contains(userName))
|
||||
if (tabSupervisor->isUserIgnored(userName))
|
||||
menu->addAction(aRemoveFromIgnoreList);
|
||||
else
|
||||
menu->addAction(aAddToIgnoreList);
|
||||
|
|
@ -298,7 +298,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
|
|||
menu->addAction(aPromoteToMod);
|
||||
}
|
||||
}
|
||||
bool anotherUser = userName != QString::fromStdString(tabSupervisor->getUserInfo()->name());
|
||||
bool anotherUser = userName != tabSupervisor->getOwnUsername();
|
||||
aDetails->setEnabled(true);
|
||||
aChat->setEnabled(anotherUser && online);
|
||||
aShowGames->setEnabled(online);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue