From 9bc1ff61eb83b606a4c15966e89895053448d3e0 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Thu, 30 Nov 2023 23:39:29 -0500 Subject: [PATCH] Tracker: Allow Get info without selection in File menu If you don't have a selection, Get info on the window instead. Change-Id: I83db030798788a487ce3123bb8b2c25056d4fbf2 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7170 Reviewed-by: waddlesplash Tested-by: Commit checker robot Reviewed-by: Adrien Destugues --- src/kits/tracker/ContainerWindow.cpp | 1 - src/kits/tracker/FilePanelPriv.cpp | 5 ----- src/kits/tracker/PoseView.cpp | 11 +++++++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index 8c9a552160..2e8ef90cd7 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -3277,7 +3277,6 @@ BContainerWindow::UpdateMenu(BMenu* menu, UpdateMenuContext context) if (context == kMenuBarContext) { EnableNamedMenuItem(menu, kOpenSelection, selectCount > 0); - EnableNamedMenuItem(menu, kGetInfo, selectCount > 0); EnableNamedMenuItem(menu, kIdentifyEntry, selectCount > 0); EnableNamedMenuItem(menu, kRestoreFromTrash, selectCount > 0); EnableNamedMenuItem(menu, kDelete, diff --git a/src/kits/tracker/FilePanelPriv.cpp b/src/kits/tracker/FilePanelPriv.cpp index 082990b31f..b76b134bd8 100644 --- a/src/kits/tracker/FilePanelPriv.cpp +++ b/src/kits/tracker/FilePanelPriv.cpp @@ -1076,15 +1076,12 @@ TFilePanel::MenusBeginning() PoseView()->CommitActivePose(); } - int32 selectCount = PoseView()->CountSelected(); - EnableNamedMenuItem(fMenuBar, kNewFolder, !TargetModel()->IsRoot() && !PoseView()->TargetVolumeIsReadOnly()); EnableNamedMenuItem(fMenuBar, kDuplicateSelection, PoseView()->CanMoveToTrashOrDuplicate()); EnableNamedMenuItem(fMenuBar, kMoveToTrash, PoseView()->CanMoveToTrashOrDuplicate()); - EnableNamedMenuItem(fMenuBar, kGetInfo, selectCount > 0); EnableNamedMenuItem(fMenuBar, kEditItem, PoseView()->CanEditName()); SetCutItem(fMenuBar); @@ -1120,7 +1117,6 @@ TFilePanel::ShowContextMenu(BPoint where, const entry_ref* ref) // Volume context menu fContextMenu = fVolumeContextMenu; EnableNamedMenuItem(fContextMenu, kOpenSelection, true); - EnableNamedMenuItem(fContextMenu, kGetInfo, true); EnableNamedMenuItem(fContextMenu, kEditItem, PoseView()->CanEditName()); @@ -1128,7 +1124,6 @@ TFilePanel::ShowContextMenu(BPoint where, const entry_ref* ref) } else { // File context menu fContextMenu = fFileContextMenu; - EnableNamedMenuItem(fContextMenu, kGetInfo, true); EnableNamedMenuItem(fContextMenu, kEditItem, PoseView()->CanEditName()); EnableNamedMenuItem(fContextMenu, kDuplicateSelection, diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index c63f2565cb..f44959cd9d 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -8600,8 +8600,15 @@ BPoseView::OpenInfoWindows() alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); alert->Go(); return; - } - SendSelectionAsRefs(kGetInfo); + } + + if (fSelectionList != NULL && fSelectionList->CountItems() > 0) + SendSelectionAsRefs(kGetInfo); + else if (TargetModel()->EntryRef() != NULL) { + BMessage message(kGetInfo); + message.AddRef("refs", TargetModel()->EntryRef()); + BMessenger(kTrackerSignature).SendMessage(&message); + } }