diff options
author | FalseHonesty <thefalsehonesty@gmail.com> | 2020-05-27 14:25:13 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-28 10:33:20 +0200 |
commit | 112b4de430edc2056234050df09eec72c520f8f9 (patch) | |
tree | 84f72932d748eeaa99bbe3a992c7b74e2363d64f /Applications/IRCClient | |
parent | 330aecb5d8982ee3823909908993e4284cf1b7c9 (diff) | |
download | serenity-112b4de430edc2056234050df09eec72c520f8f9.zip |
IRCClient: Enable history on the message box
Diffstat (limited to 'Applications/IRCClient')
-rw-r--r-- | Applications/IRCClient/IRCWindow.cpp | 18 | ||||
-rw-r--r-- | Applications/IRCClient/IRCWindow.h | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/Applications/IRCClient/IRCWindow.cpp b/Applications/IRCClient/IRCWindow.cpp index 7557621b20..b35044efa5 100644 --- a/Applications/IRCClient/IRCWindow.cpp +++ b/Applications/IRCClient/IRCWindow.cpp @@ -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); } diff --git a/Applications/IRCClient/IRCWindow.h b/Applications/IRCClient/IRCWindow.h index 137ea90991..3f36f631e4 100644 --- a/Applications/IRCClient/IRCWindow.h +++ b/Applications/IRCClient/IRCWindow.h @@ -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 }; |