From 99d46caa28c99e63ccc85e2a9677ea0e04549d2d Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Tue, 27 Jul 2021 15:48:02 +0200 Subject: [PATCH] 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. --- Userland/Libraries/LibGUI/FilePicker.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index f3e97cdbe3..cb9f7b9b94 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/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()) {