IRCClient: Enable history on the message box
This commit is contained in:
parent
330aecb5d8
commit
112b4de430
Notes:
sideshowbarker
2024-07-19 06:03:10 +09:00
Author: https://github.com/FalseHonesty Commit: https://github.com/SerenityOS/serenity/commit/112b4de430e Pull-request: https://github.com/SerenityOS/serenity/pull/2419 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/bugaevc
2 changed files with 11 additions and 9 deletions
|
@ -189,18 +189,20 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na
|
|||
};
|
||||
}
|
||||
|
||||
m_text_editor = add<GUI::TextBox>();
|
||||
m_text_editor->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
m_text_editor->set_preferred_size(0, 19);
|
||||
m_text_editor->on_return_pressed = [this] {
|
||||
m_text_box = add<GUI::TextBox>();
|
||||
m_text_box->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
m_text_box->set_preferred_size(0, 19);
|
||||
m_text_box->on_return_pressed = [this] {
|
||||
if (m_type == Channel)
|
||||
m_client.handle_user_input_in_channel(m_name, m_text_editor->text());
|
||||
m_client.handle_user_input_in_channel(m_name, m_text_box->text());
|
||||
else if (m_type == Query)
|
||||
m_client.handle_user_input_in_query(m_name, m_text_editor->text());
|
||||
m_client.handle_user_input_in_query(m_name, m_text_box->text());
|
||||
else if (m_type == Server)
|
||||
m_client.handle_user_input_in_server(m_text_editor->text());
|
||||
m_text_editor->clear();
|
||||
m_client.handle_user_input_in_server(m_text_box->text());
|
||||
m_text_box->add_current_text_to_history();
|
||||
m_text_box->clear();
|
||||
};
|
||||
m_text_box->set_history_enabled(true);
|
||||
|
||||
m_client.register_subwindow(*this);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ private:
|
|||
Type m_type;
|
||||
String m_name;
|
||||
RefPtr<Web::HtmlView> m_html_view;
|
||||
RefPtr<GUI::TextEditor> m_text_editor;
|
||||
RefPtr<GUI::TextBox> m_text_box;
|
||||
RefPtr<IRCLogBuffer> m_log_buffer;
|
||||
RefPtr<GUI::Menu> m_context_menu;
|
||||
int m_unread_count { 0 };
|
||||
|
|
Loading…
Add table
Reference in a new issue