1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

IRCClient: Add application and context menu items to hop/dehop users

This commit is contained in:
Brendan Coles 2020-04-08 17:12:37 +00:00 committed by Andreas Kling
parent 755b206618
commit 5c90cfa90f
5 changed files with 64 additions and 0 deletions

View file

@ -196,6 +196,26 @@ void IRCAppWindow::setup_actions()
m_client->handle_devoice_user_action(window->channel().name(), input_box->text_value());
});
m_hop_user_action = GUI::Action::create("Hop user", [this](auto&) {
auto* window = m_client->current_window();
if (!window || window->type() != IRCWindow::Type::Channel) {
return;
}
auto input_box = GUI::InputBox::construct("Enter nick:", "Hop user", this);
if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty())
m_client->handle_hop_user_action(window->channel().name(), input_box->text_value());
});
m_dehop_user_action = GUI::Action::create("DeHop user", [this](auto&) {
auto* window = m_client->current_window();
if (!window || window->type() != IRCWindow::Type::Channel) {
return;
}
auto input_box = GUI::InputBox::construct("Enter nick:", "DeHop user", this);
if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty())
m_client->handle_dehop_user_action(window->channel().name(), input_box->text_value());
});
m_op_user_action = GUI::Action::create("Op user", [this](auto&) {
auto* window = m_client->current_window();
if (!window || window->type() != IRCWindow::Type::Channel) {
@ -264,6 +284,8 @@ void IRCAppWindow::setup_menus()
channel_menu.add_separator();
channel_menu.add_action(*m_voice_user_action);
channel_menu.add_action(*m_devoice_user_action);
channel_menu.add_action(*m_hop_user_action);
channel_menu.add_action(*m_dehop_user_action);
channel_menu.add_action(*m_op_user_action);
channel_menu.add_action(*m_deop_user_action);
channel_menu.add_separator();
@ -341,6 +363,8 @@ void IRCAppWindow::update_gui_actions()
m_banlist_action->set_enabled(is_open_channel);
m_voice_user_action->set_enabled(is_open_channel);
m_devoice_user_action->set_enabled(is_open_channel);
m_hop_user_action->set_enabled(is_open_channel);
m_dehop_user_action->set_enabled(is_open_channel);
m_op_user_action->set_enabled(is_open_channel);
m_deop_user_action->set_enabled(is_open_channel);
m_kick_user_action->set_enabled(is_open_channel);