LibGUI: Update FilePicker location textbox when changing directory

Fixes #2662.
This commit is contained in:
Linus Groh 2020-06-30 09:25:45 +01:00 committed by Andreas Kling
parent 5acc457c06
commit 2e183e3292
Notes: sideshowbarker 2024-07-19 05:19:11 +09:00

View file

@ -122,14 +122,17 @@ FilePicker::FilePicker(Mode mode, const StringView& file_name, const StringView&
m_view->set_column_hidden(FileSystemModel::Column::SymlinkTarget, true);
m_model->set_root_path(path);
m_model->on_update = [&] {
location_textbox.set_text(m_model->root_path());
clear_preview();
};
location_textbox.on_return_pressed = [&] {
m_model->set_root_path(location_textbox.text());
clear_preview();
};
auto open_parent_directory_action = Action::create("Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"), [this](const Action&) {
m_model->set_root_path(String::format("%s/..", m_model->root_path().characters()));
clear_preview();
});
toolbar.add_action(*open_parent_directory_action);