diff options
author | Andreas Kling <kling@serenityos.org> | 2022-08-18 20:44:15 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-08-18 20:44:15 +0200 |
commit | 81ee870c9be0a97fbb889d16789a19f9d52a773e (patch) | |
tree | 6d4f4f4bb26a55fc7dd084f9dafb5106e1333f0b /Userland/Applications/FileManager/main.cpp | |
parent | ff37ce7408a5d049dd20a69f793e6fa291d6bcfa (diff) | |
download | serenity-81ee870c9be0a97fbb889d16789a19f9d52a773e.zip |
FileManager: Add "open child directory" action (Alt+Down)
This mirrors the "open parent directory" action, but traverses the
breadcrumbbar segments from left-to-right instead. The name is a little
bit strange, and maybe we can come up with something better.
It does feel pretty nice to use though. :^)
Diffstat (limited to 'Userland/Applications/FileManager/main.cpp')
-rw-r--r-- | Userland/Applications/FileManager/main.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index 617d91c36d..6d85735f7a 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -667,6 +667,15 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& directory_view->open_parent_directory(); }); + auto open_child_directory_action = GUI::Action::create("Open &Child Directory", { Mod_Alt, Key_Down }, [&](GUI::Action const&) { + auto segment_index = breadcrumbbar.selected_segment(); + if (!segment_index.has_value() || *segment_index >= breadcrumbbar.segment_count() - 1) + return; + breadcrumbbar.set_selected_segment(*segment_index + 1); + if (breadcrumbbar.on_segment_click) + breadcrumbbar.on_segment_click(*segment_index + 1); + }); + RefPtr<GUI::Action> layout_toolbar_action; RefPtr<GUI::Action> layout_location_action; RefPtr<GUI::Action> layout_statusbar_action; @@ -1029,6 +1038,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const& TRY(go_menu->try_add_action(go_back_action)); TRY(go_menu->try_add_action(go_forward_action)); TRY(go_menu->try_add_action(open_parent_directory_action)); + TRY(go_menu->try_add_action(open_child_directory_action)); TRY(go_menu->try_add_action(go_home_action)); TRY(go_menu->try_add_action(go_to_location_action)); TRY(go_menu->try_add_separator()); |