From 232f0fb2d36bd1e6aad1dc7ab3b1fc6b3decb5a4 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Thu, 22 Jul 2021 00:41:24 +0200 Subject: [PATCH] LibGUI: Add keyboard shortcuts to FilePicker Taken from FileManager. --- Userland/Libraries/LibGUI/FilePicker.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index fee2f76185..daaf2df9b1 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -123,7 +123,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen toolbar.add_separator(); auto mkdir_action = Action::create( - "New directory...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"), [this](const Action&) { + "New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"), [this](const Action&) { String value; if (InputBox::show(this, value, "Enter name:", "New directory") == InputBox::ExecOK && !value.is_empty()) { auto new_dir_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", m_model->root_path(), value)); @@ -171,10 +171,12 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen }; m_context_menu = GUI::Menu::construct(); - m_context_menu->add_action(GUI::Action::create_checkable("Show dotfiles", [&](auto& action) { - m_model->set_should_show_dotfiles(action.is_checked()); - m_model->update(); - })); + m_context_menu->add_action(GUI::Action::create_checkable( + "Show dotfiles", { Mod_Ctrl, Key_H }, [&](auto& action) { + m_model->set_should_show_dotfiles(action.is_checked()); + m_model->update(); + }, + this)); m_view->on_context_menu_request = [&](const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) { if (!index.is_valid()) {