mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
FileManager: Disable view change actions when directory is unreadable
Closes #3556.
This commit is contained in:
parent
1ccf9de6b9
commit
a0362d827c
Notes:
sideshowbarker
2024-07-18 21:38:51 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/a0362d827cd Pull-request: https://github.com/SerenityOS/serenity/pull/5678 Issue: https://github.com/SerenityOS/serenity/issues/3556
@ -169,7 +169,7 @@ void DirectoryView::setup_model()
|
||||
add_path_to_history(model().root_path());
|
||||
|
||||
if (on_path_change)
|
||||
on_path_change(failed_path, false);
|
||||
on_path_change(failed_path, false, false);
|
||||
};
|
||||
|
||||
m_model->on_complete = [this] {
|
||||
@ -186,7 +186,7 @@ void DirectoryView::setup_model()
|
||||
m_touch_action->set_enabled(can_write_in_path);
|
||||
|
||||
if (on_path_change)
|
||||
on_path_change(model().root_path(), can_write_in_path);
|
||||
on_path_change(model().root_path(), true, can_write_in_path);
|
||||
};
|
||||
|
||||
m_model->register_client(*this);
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
|
||||
void launch(const URL&, const LauncherHandler&) const;
|
||||
|
||||
Function<void(const StringView& path, bool can_write_in_path)> on_path_change;
|
||||
Function<void(const StringView& path, bool can_read_in_path, bool can_write_in_path)> on_path_change;
|
||||
Function<void(GUI::AbstractView&)> on_selection_change;
|
||||
Function<void(const GUI::ModelIndex&, const GUI::ContextMenuEvent&)> on_context_menu_request;
|
||||
Function<void(const StringView&)> on_status_message;
|
||||
|
@ -835,7 +835,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
|
||||
main_toolbar.add_action(*view_as_table_action);
|
||||
main_toolbar.add_action(*view_as_columns_action);
|
||||
|
||||
directory_view.on_path_change = [&](const String& new_path, bool can_write_in_path) {
|
||||
directory_view.on_path_change = [&](const String& new_path, bool can_read_in_path, bool can_write_in_path) {
|
||||
auto icon = GUI::FileIconProvider::icon_for_path(new_path);
|
||||
auto* bitmap = icon.bitmap_for_size(16);
|
||||
window->set_icon(bitmap);
|
||||
@ -897,9 +897,12 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
|
||||
go_forward_action->set_enabled(directory_view.path_history_position() < directory_view.path_history_size() - 1);
|
||||
go_back_action->set_enabled(directory_view.path_history_position() > 0);
|
||||
open_parent_directory_action->set_enabled(new_path != "/");
|
||||
view_as_table_action->set_enabled(can_read_in_path);
|
||||
view_as_icons_action->set_enabled(can_read_in_path);
|
||||
view_as_columns_action->set_enabled(can_read_in_path);
|
||||
};
|
||||
|
||||
directory_view.on_accepted_drop = [&]() {
|
||||
directory_view.on_accepted_drop = [&] {
|
||||
refresh_tree_view();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user