From 56328409d968cd3b19e7715edb457480e6deba1a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 18 Sep 2020 18:24:49 +0200 Subject: [PATCH] FileManager: Update GUI when "entering" an inaccessible directory When we enter an inaccessible directory, we still allow that directory to become selected in the left-side treeview, so we need to update the location box and window title to reflect the new current path. This is not perfectly factored and there's a bit of duplication between the model's on_error and on_complete hook callbacks in DirectoryView. Needs more work. :^) --- Applications/FileManager/DirectoryView.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Applications/FileManager/DirectoryView.cpp b/Applications/FileManager/DirectoryView.cpp index fcce7c178a..d22a21aee8 100644 --- a/Applications/FileManager/DirectoryView.cpp +++ b/Applications/FileManager/DirectoryView.cpp @@ -161,18 +161,17 @@ void DirectoryView::setup_model() m_model->on_error = [this](int, const char* error_string) { auto failed_path = m_model->root_path(); - bool quit = false; - if (m_path_history.size()) - open(m_path_history.at(m_path_history_position)); - else - quit = true; - - if (quit) - exit(1); - auto error_message = String::format("Could not read %s:\n%s", failed_path.characters(), error_string); m_error_label->set_text(error_message); set_active_widget(m_error_label); + + m_mkdir_action->set_enabled(false); + m_touch_action->set_enabled(false); + + add_path_to_history(model().root_path()); + + if (on_path_change) + on_path_change(failed_path, false); }; m_model->on_complete = [this] {