Browse Source

LibGUI: Disable changing the view on error in the FilePicker

Prior to this change, changing the view would hide the error label
and show an empty directory.
Karol Kosek 4 years ago
parent
commit
99d46caa28
1 changed files with 8 additions and 0 deletions
  1. 8 0
      Userland/Libraries/LibGUI/FilePicker.cpp

+ 8 - 0
Userland/Libraries/LibGUI/FilePicker.cpp

@@ -219,11 +219,19 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen
     m_model->on_directory_change_error = [&](int, char const* error_string) {
         m_error_label->set_text(String::formatted("Could not open {}:\n{}", m_model->root_path(), error_string));
         m_view->set_active_widget(m_error_label);
+
+        m_view->view_as_icons_action().set_enabled(false);
+        m_view->view_as_table_action().set_enabled(false);
+        m_view->view_as_columns_action().set_enabled(false);
     };
     m_model->on_complete = [&] {
         m_view->set_active_widget(&m_view->current_view());
         for (auto location_button : m_common_location_buttons)
             location_button.button.set_checked(m_model->root_path() == location_button.path);
+
+        m_view->view_as_icons_action().set_enabled(true);
+        m_view->view_as_table_action().set_enabled(true);
+        m_view->view_as_columns_action().set_enabled(true);
     };
 
     for (auto& location : CommonLocationsProvider::common_locations()) {