[UserContextMenu] Add confirmation dialog before kicking a player (#6987)

This commit is contained in:
kongwu
2026-06-13 02:42:55 -07:00
committed by GitHub
parent 7aaacbf347
commit f28ede7ae3
@@ -476,10 +476,15 @@ void UserContextMenu::showContextMenu(const QPoint &pos,
client->sendCommand(client->prepareSessionCommand(cmd));
} else if (actionClicked == aKick) {
Command_KickFromGame cmd;
cmd.set_player_id(playerId);
auto result = QMessageBox::question(static_cast<QWidget *>(parent()), tr("Kick Player"),
tr("Are you sure you want to kick this player from the game?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (result == QMessageBox::Yes) {
Command_KickFromGame cmd;
cmd.set_player_id(playerId);
game->getGameEventHandler()->sendGameCommand(cmd);
game->getGameEventHandler()->sendGameCommand(cmd);
}
} else if (actionClicked == aBan) {
Command_GetUserInfo cmd;
cmd.set_user_name(userName.toStdString());