Browse Source

LibGUI: Update FilePicker location textbox when changing directory

Fixes #2662.
Linus Groh 5 years ago
parent
commit
2e183e3292
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Libraries/LibGUI/FilePicker.cpp

+ 5 - 2
Libraries/LibGUI/FilePicker.cpp

@@ -122,14 +122,17 @@ FilePicker::FilePicker(Mode mode, const StringView& file_name, const StringView&
     m_view->set_column_hidden(FileSystemModel::Column::SymlinkTarget, true);
     m_view->set_column_hidden(FileSystemModel::Column::SymlinkTarget, true);
     m_model->set_root_path(path);
     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 = [&] {
     location_textbox.on_return_pressed = [&] {
         m_model->set_root_path(location_textbox.text());
         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&) {
     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()));
         m_model->set_root_path(String::format("%s/..", m_model->root_path().characters()));
-        clear_preview();
     });
     });
     toolbar.add_action(*open_parent_directory_action);
     toolbar.add_action(*open_parent_directory_action);