diff options
author | Andreas Kling <kling@serenityos.org> | 2020-09-18 18:24:49 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-18 21:29:01 +0200 |
commit | 56328409d968cd3b19e7715edb457480e6deba1a (patch) | |
tree | 51caff19331b4c826aa320411559e71abc69ab99 | |
parent | e4c23b0151622e101b8dbbcb72ecbeaf02ebc986 (diff) | |
download | serenity-56328409d968cd3b19e7715edb457480e6deba1a.zip |
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. :^)
-rw-r--r-- | Applications/FileManager/DirectoryView.cpp | 17 |
1 files 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] { |