mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-12 10:40:39 +09:00
HackStudio: Disable Delete action on insufficient permissions
Hack Studio will now disable the action when any parent of selected files do not have write permission.
This commit is contained in:
parent
85c2ad94d5
commit
6e51fe146c
Notes:
sideshowbarker
2024-07-19 17:24:54 +09:00
Author: https://github.com/krkk
Commit: 6e51fe146c
Pull-request: https://github.com/SerenityOS/serenity/pull/8755
Reviewed-by: https://github.com/gunnarbeutner
1 changed files with 7 additions and 1 deletions
|
@ -796,7 +796,13 @@ void HackStudioWidget::configure_project_tree_view()
|
|||
|
||||
m_project_tree_view->on_selection_change = [this] {
|
||||
m_open_selected_action->set_enabled(!m_project_tree_view->selection().is_empty());
|
||||
m_delete_action->set_enabled(!m_project_tree_view->selection().is_empty());
|
||||
|
||||
auto selections = m_project_tree_view->selection().indices();
|
||||
auto it = selections.find_if([&](auto selected_file) {
|
||||
return access(m_project->model().full_path(selected_file.parent()).characters(), W_OK) == 0;
|
||||
});
|
||||
bool has_permissions = it != selections.end();
|
||||
m_delete_action->set_enabled(!m_project_tree_view->selection().is_empty() && has_permissions);
|
||||
};
|
||||
|
||||
m_project_tree_view->on_activation = [this](auto& index) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue