瀏覽代碼

FileManager: Calculate file action permissions for subsequent columns

Previously, the permission for the action was always calculated
according to the first column.
Karol Kosek 3 年之前
父節點
當前提交
798154fbbc
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      Userland/Applications/FileManager/DirectoryView.cpp

+ 7 - 1
Userland/Applications/FileManager/DirectoryView.cpp

@@ -551,7 +551,13 @@ void DirectoryView::do_delete(bool should_confirm)
 
 bool DirectoryView::can_modify_current_selection()
 {
-    return !current_view().selection().is_empty() && access(path().characters(), W_OK) == 0;
+    auto selections = current_view().selection().indices();
+    // FIXME: remove once Clang formats this properly.
+    // clang-format off
+    return selections.first_matching([&](auto& index) {
+        return !Core::System::access(node(index.parent()).full_path(), W_OK).is_error();
+    }).has_value();
+    // clang-format on
 }
 
 void DirectoryView::handle_selection_change()