Selaa lähdekoodia

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. :^)
Andreas Kling 4 vuotta sitten
vanhempi
commit
56328409d9
1 muutettua tiedostoa jossa 8 lisäystä ja 9 poistoa
  1. 8 9
      Applications/FileManager/DirectoryView.cpp

+ 8 - 9
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] {