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 <[email protected]> Reviewed-by: John Scipione <[email protected]> Haiku-Format: Haiku-format Bot <[email protected]>
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -199,6 +199,7 @@ public:
|
||||
|
||||
bool IsCurrentFocusOnTextView() const;
|
||||
bool IsDesktop() const;
|
||||
bool IsPrintersDir() const;
|
||||
bool IsQuery() const;
|
||||
bool IsQueryTemplate() const;
|
||||
bool IsRoot() const;
|
||||
|
||||
Reference in New Issue
Block a user