diff --git a/Libraries/LibGUI/Action.cpp b/Libraries/LibGUI/Action.cpp index c0f279e6ba..56937ebbba 100644 --- a/Libraries/LibGUI/Action.cpp +++ b/Libraries/LibGUI/Action.cpp @@ -114,6 +114,11 @@ NonnullRefPtr make_reload_action(Function callback, Core: return Action::create("Reload", { Mod_Ctrl, Key_R }, Gfx::Bitmap::load_from_file("/res/icons/16x16/reload.png"), move(callback), parent); } +NonnullRefPtr make_select_all_action(Function callback, Core::Object* parent) +{ + return Action::create("Select all", { Mod_Ctrl, Key_A }, Gfx::Bitmap::load_from_file("/res/icons/16x16/select-all.png"), move(callback), parent); +} + } Action::Action(const StringView& text, Function on_activation_callback, Core::Object* parent, bool checkable) diff --git a/Libraries/LibGUI/Action.h b/Libraries/LibGUI/Action.h index 5e2e6321f4..a965dc5d8f 100644 --- a/Libraries/LibGUI/Action.h +++ b/Libraries/LibGUI/Action.h @@ -58,6 +58,7 @@ namespace CommonActions { NonnullRefPtr make_go_forward_action(Function, Core::Object* parent = nullptr); NonnullRefPtr make_go_home_action(Function callback, Core::Object* parent = nullptr); NonnullRefPtr make_reload_action(Function, Core::Object* parent = nullptr); + NonnullRefPtr make_select_all_action(Function, Core::Object* parent = nullptr); }; class Action final : public Core::Object { diff --git a/Libraries/LibGUI/TextEditor.cpp b/Libraries/LibGUI/TextEditor.cpp index c1fd1d98f0..05e2947b36 100644 --- a/Libraries/LibGUI/TextEditor.cpp +++ b/Libraries/LibGUI/TextEditor.cpp @@ -98,8 +98,7 @@ void TextEditor::create_actions() }, this); } - m_select_all_action = Action::create( - "Select all", { Mod_Ctrl, Key_A }, Gfx::Bitmap::load_from_file("/res/icons/16x16/select-all.png"), [this](auto&) { select_all(); }, this); + m_select_all_action = CommonActions::make_select_all_action([this](auto&) { select_all(); }, this); } void TextEditor::set_text(const StringView& text)