From 734225977f3b4b2148bc5d94f3b82db5f4899c11 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Tue, 18 Nov 2025 20:38:10 -0500 Subject: [PATCH] Tracker: Fix minor logic error in Paste item disabled status ... and exclude some more folders from Paste. Gating is consolidated in "Paste into folder". Use TargetIsReadOnly() to get parent, not selection. We want the opposite logic compared to "Paste into folder", we want to ignore the selected folder or volume's read-only status and get the read-only status of the parent. For example File => Paste on config volume in home should be allowed even though config is a read-only volume. We're _not_ pasting to config, we're pasting to home which is writable. We want the opposite logic of "Paste in folder" (selection). Change-Id: Ib13b3a007b86b8d355c994f252f7beb320494c8c Reviewed-on: https://review.haiku-os.org/c/haiku/+/9895 Tested-by: Commit checker robot Reviewed-by: John Scipione Haiku-Format: Haiku-format Bot --- src/kits/tracker/Shortcuts.cpp | 10 +++++++++- src/kits/tracker/Shortcuts.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/kits/tracker/Shortcuts.cpp b/src/kits/tracker/Shortcuts.cpp index 093e6adc84..a6b5838af8 100644 --- a/src/kits/tracker/Shortcuts.cpp +++ b/src/kits/tracker/Shortcuts.cpp @@ -1296,7 +1296,8 @@ TShortcuts::UpdatePasteItem(BMenuItem* item) item->SetShortcut(item->Shortcut(), B_COMMAND_KEY | (modifiers() & B_SHIFT_KEY)); if (fInWindow) { - bool isPastable = FSClipboardHasRefs() && !SelectionIsReadOnly() && !IsTrash(); + bool isPastable = FSClipboardHasRefs() && TargetIsReadOnly() == false + && !(IsPrintersDir() || IsRoot() || IsTrash() || InTrash() || IsVirtualDirectory()); item->SetEnabled(IsCurrentFocusOnTextView() || isPastable); item->SetTarget(fContainerWindow); @@ -1421,6 +1422,13 @@ TShortcuts::IsDesktop() const } +bool +TShortcuts::IsPrintersDir() const +{ + return fInWindow && PoseView()->TargetModel()->IsPrintersDir(); +} + + bool TShortcuts::IsQuery() const { diff --git a/src/kits/tracker/Shortcuts.h b/src/kits/tracker/Shortcuts.h index 581566070f..98a571c646 100644 --- a/src/kits/tracker/Shortcuts.h +++ b/src/kits/tracker/Shortcuts.h @@ -199,6 +199,7 @@ public: bool IsCurrentFocusOnTextView() const; bool IsDesktop() const; + bool IsPrintersDir() const; bool IsQuery() const; bool IsQueryTemplate() const; bool IsRoot() const;