mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 18:35:07 +00:00
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. :^)
This commit is contained in:
parent
e4c23b0151
commit
56328409d9
1 changed files with 8 additions and 9 deletions
|
@ -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] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue