mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
IRCClient: Use sub-menus for app channel menu and member context menu
This commit is contained in:
parent
2de843692c
commit
e87347e1d3
2 changed files with 60 additions and 55 deletions
|
@ -281,15 +281,18 @@ void IRCAppWindow::setup_menus()
|
||||||
channel_menu.add_action(*m_change_topic_action);
|
channel_menu.add_action(*m_change_topic_action);
|
||||||
channel_menu.add_action(*m_invite_user_action);
|
channel_menu.add_action(*m_invite_user_action);
|
||||||
channel_menu.add_action(*m_banlist_action);
|
channel_menu.add_action(*m_banlist_action);
|
||||||
channel_menu.add_separator();
|
|
||||||
channel_menu.add_action(*m_voice_user_action);
|
RefPtr<GUI::Menu> channel_control_menu = GUI::Menu::construct("Control");
|
||||||
channel_menu.add_action(*m_devoice_user_action);
|
channel_menu.add_submenu(*channel_control_menu);
|
||||||
channel_menu.add_action(*m_hop_user_action);
|
channel_control_menu->add_action(*m_voice_user_action);
|
||||||
channel_menu.add_action(*m_dehop_user_action);
|
channel_control_menu->add_action(*m_devoice_user_action);
|
||||||
channel_menu.add_action(*m_op_user_action);
|
channel_control_menu->add_action(*m_hop_user_action);
|
||||||
channel_menu.add_action(*m_deop_user_action);
|
channel_control_menu->add_action(*m_dehop_user_action);
|
||||||
channel_menu.add_separator();
|
channel_control_menu->add_action(*m_op_user_action);
|
||||||
channel_menu.add_action(*m_kick_user_action);
|
channel_control_menu->add_action(*m_deop_user_action);
|
||||||
|
channel_control_menu->add_separator();
|
||||||
|
channel_control_menu->add_action(*m_kick_user_action);
|
||||||
|
|
||||||
channel_menu.add_separator();
|
channel_menu.add_separator();
|
||||||
channel_menu.add_action(*m_cycle_channel_action);
|
channel_menu.add_action(*m_cycle_channel_action);
|
||||||
channel_menu.add_action(*m_part_action);
|
channel_menu.add_action(*m_part_action);
|
||||||
|
|
|
@ -90,9 +90,10 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na
|
||||||
m_client.handle_whois_action(m_client.nick_without_prefix(nick.characters()));
|
m_client.handle_whois_action(m_client.nick_without_prefix(nick.characters()));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
m_context_menu->add_separator();
|
RefPtr<GUI::Menu> m_context_control_menu = GUI::Menu::construct("Control");
|
||||||
|
m_context_menu->add_submenu(*m_context_control_menu);
|
||||||
|
|
||||||
m_context_menu->add_action(GUI::Action::create("Voice", [&](const GUI::Action&) {
|
m_context_control_menu->add_action(GUI::Action::create("Voice", [&](const GUI::Action&) {
|
||||||
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
||||||
if (nick.is_empty())
|
if (nick.is_empty())
|
||||||
return;
|
return;
|
||||||
|
@ -100,81 +101,44 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na
|
||||||
m_client.handle_voice_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()));
|
m_client.handle_voice_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
m_context_menu->add_action(GUI::Action::create("DeVoice", [&](const GUI::Action&) {
|
m_context_control_menu->add_action(GUI::Action::create("DeVoice", [&](const GUI::Action&) {
|
||||||
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
||||||
if (nick.is_empty())
|
if (nick.is_empty())
|
||||||
return;
|
return;
|
||||||
m_client.handle_devoice_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()));
|
m_client.handle_devoice_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
m_context_menu->add_action(GUI::Action::create("Hop", [&](const GUI::Action&) {
|
m_context_control_menu->add_action(GUI::Action::create("Hop", [&](const GUI::Action&) {
|
||||||
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
||||||
if (nick.is_empty())
|
if (nick.is_empty())
|
||||||
return;
|
return;
|
||||||
m_client.handle_hop_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()));
|
m_client.handle_hop_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
m_context_menu->add_action(GUI::Action::create("DeHop", [&](const GUI::Action&) {
|
m_context_control_menu->add_action(GUI::Action::create("DeHop", [&](const GUI::Action&) {
|
||||||
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
||||||
if (nick.is_empty())
|
if (nick.is_empty())
|
||||||
return;
|
return;
|
||||||
m_client.handle_dehop_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()));
|
m_client.handle_dehop_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
m_context_menu->add_action(GUI::Action::create("Op", [&](const GUI::Action&) {
|
m_context_control_menu->add_action(GUI::Action::create("Op", [&](const GUI::Action&) {
|
||||||
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
||||||
if (nick.is_empty())
|
if (nick.is_empty())
|
||||||
return;
|
return;
|
||||||
m_client.handle_op_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()));
|
m_client.handle_op_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
m_context_menu->add_action(GUI::Action::create("DeOp", [&](const GUI::Action&) {
|
m_context_control_menu->add_action(GUI::Action::create("DeOp", [&](const GUI::Action&) {
|
||||||
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
||||||
if (nick.is_empty())
|
if (nick.is_empty())
|
||||||
return;
|
return;
|
||||||
m_client.handle_deop_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()));
|
m_client.handle_deop_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
m_context_menu->add_separator();
|
m_context_control_menu->add_separator();
|
||||||
|
|
||||||
m_context_menu->add_action(GUI::Action::create("User info", [&](const GUI::Action&) {
|
m_context_control_menu->add_action(GUI::Action::create("Kick", [&](const GUI::Action&) {
|
||||||
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
|
||||||
if (nick.is_empty())
|
|
||||||
return;
|
|
||||||
m_client.handle_ctcp_user_action(m_client.nick_without_prefix(nick.characters()), "USERINFO");
|
|
||||||
}));
|
|
||||||
|
|
||||||
m_context_menu->add_action(GUI::Action::create("Finger", [&](const GUI::Action&) {
|
|
||||||
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
|
||||||
if (nick.is_empty())
|
|
||||||
return;
|
|
||||||
m_client.handle_ctcp_user_action(m_client.nick_without_prefix(nick.characters()), "FINGER");
|
|
||||||
}));
|
|
||||||
|
|
||||||
m_context_menu->add_action(GUI::Action::create("Time", [&](const GUI::Action&) {
|
|
||||||
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
|
||||||
if (nick.is_empty())
|
|
||||||
return;
|
|
||||||
m_client.handle_ctcp_user_action(m_client.nick_without_prefix(nick.characters()), "TIME");
|
|
||||||
}));
|
|
||||||
|
|
||||||
m_context_menu->add_action(GUI::Action::create("Version", [&](const GUI::Action&) {
|
|
||||||
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
|
||||||
if (nick.is_empty())
|
|
||||||
return;
|
|
||||||
m_client.handle_ctcp_user_action(m_client.nick_without_prefix(nick.characters()), "VERSION");
|
|
||||||
}));
|
|
||||||
|
|
||||||
m_context_menu->add_action(GUI::Action::create("Client info", [&](const GUI::Action&) {
|
|
||||||
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
|
||||||
if (nick.is_empty())
|
|
||||||
return;
|
|
||||||
m_client.handle_ctcp_user_action(m_client.nick_without_prefix(nick.characters()), "CLIENTINFO");
|
|
||||||
}));
|
|
||||||
|
|
||||||
m_context_menu->add_separator();
|
|
||||||
|
|
||||||
m_context_menu->add_action(GUI::Action::create("Kick", [&](const GUI::Action&) {
|
|
||||||
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
||||||
if (nick.is_empty())
|
if (nick.is_empty())
|
||||||
return;
|
return;
|
||||||
|
@ -185,6 +149,44 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na
|
||||||
m_client.handle_kick_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()), input_box->text_value());
|
m_client.handle_kick_user_action(m_name.characters(), m_client.nick_without_prefix(nick.characters()), input_box->text_value());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
RefPtr<GUI::Menu> m_context_ctcp_menu = GUI::Menu::construct("CTCP");
|
||||||
|
m_context_menu->add_submenu(*m_context_ctcp_menu);
|
||||||
|
|
||||||
|
m_context_ctcp_menu->add_action(GUI::Action::create("User info", [&](const GUI::Action&) {
|
||||||
|
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
||||||
|
if (nick.is_empty())
|
||||||
|
return;
|
||||||
|
m_client.handle_ctcp_user_action(m_client.nick_without_prefix(nick.characters()), "USERINFO");
|
||||||
|
}));
|
||||||
|
|
||||||
|
m_context_ctcp_menu->add_action(GUI::Action::create("Finger", [&](const GUI::Action&) {
|
||||||
|
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
||||||
|
if (nick.is_empty())
|
||||||
|
return;
|
||||||
|
m_client.handle_ctcp_user_action(m_client.nick_without_prefix(nick.characters()), "FINGER");
|
||||||
|
}));
|
||||||
|
|
||||||
|
m_context_ctcp_menu->add_action(GUI::Action::create("Time", [&](const GUI::Action&) {
|
||||||
|
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
||||||
|
if (nick.is_empty())
|
||||||
|
return;
|
||||||
|
m_client.handle_ctcp_user_action(m_client.nick_without_prefix(nick.characters()), "TIME");
|
||||||
|
}));
|
||||||
|
|
||||||
|
m_context_ctcp_menu->add_action(GUI::Action::create("Version", [&](const GUI::Action&) {
|
||||||
|
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
||||||
|
if (nick.is_empty())
|
||||||
|
return;
|
||||||
|
m_client.handle_ctcp_user_action(m_client.nick_without_prefix(nick.characters()), "VERSION");
|
||||||
|
}));
|
||||||
|
|
||||||
|
m_context_ctcp_menu->add_action(GUI::Action::create("Client info", [&](const GUI::Action&) {
|
||||||
|
auto nick = channel().member_model()->nick_at(member_view.selection().first());
|
||||||
|
if (nick.is_empty())
|
||||||
|
return;
|
||||||
|
m_client.handle_ctcp_user_action(m_client.nick_without_prefix(nick.characters()), "CLIENTINFO");
|
||||||
|
}));
|
||||||
|
|
||||||
m_context_menu->popup(event.screen_position());
|
m_context_menu->popup(event.screen_position());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue