Explorar el Código

LibGUI: Update FilePicker location textbox when changing directory

Fixes #2662.
Linus Groh hace 5 años
padre
commit
2e183e3292
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  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_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);