From 782fbf00a75962587377a4c04d7126bc7bc4cf05 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 17 Jan 2010 17:35:06 +0000 Subject: [PATCH] Overlooked this with my previous Trash-related changes: updated NavMenu to be behaviorally in sync - it now hides the root volume Trash dir like PoseView, and adds the Trash entry as needed when navigating down the Desktop. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35125 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/tracker/NavMenu.h | 1 + src/kits/tracker/NavMenu.cpp | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/headers/private/tracker/NavMenu.h b/headers/private/tracker/NavMenu.h index 310c1a7f05..127d94f255 100644 --- a/headers/private/tracker/NavMenu.h +++ b/headers/private/tracker/NavMenu.h @@ -128,6 +128,7 @@ class BNavMenu : public BSlowMenu { void AddOneItem(Model *); void AddRootItemsIfNeeded(); + void AddTrashItem(); static void SetTrackingHookDeep(BMenu *, bool (*)(BMenu *, void *), void *); entry_ref fNavDir; diff --git a/src/kits/tracker/NavMenu.cpp b/src/kits/tracker/NavMenu.cpp index 5399b2f00e..2a0ade5e97 100644 --- a/src/kits/tracker/NavMenu.cpp +++ b/src/kits/tracker/NavMenu.cpp @@ -412,6 +412,7 @@ BNavMenu::StartBuildingItemList() fIteratingDesktop = true; fContainer = DesktopPoseView::InitDesktopDirentIterator(0, startModel.EntryRef()); AddRootItemsIfNeeded(); + AddTrashItem(); } else if (FSIsTrashDir(&entry)) { // the trash window needs to display a union of all the // trash folders from all the mounted volumes @@ -464,6 +465,18 @@ BNavMenu::AddRootItemsIfNeeded() } +void +BNavMenu::AddTrashItem() +{ + BPath path; + if (find_directory(B_TRASH_DIRECTORY, &path) == B_OK) { + BEntry entry(path.Path()); + Model model(&entry); + AddOneItem(&model); + } +} + + bool BNavMenu::AddNextItem() { @@ -510,7 +523,9 @@ BNavMenu::AddNextItem() // item might be in invisible // ToDo: // use more of PoseView's filtering here - if (fIteratingDesktop && !ShouldShowDesktopPose(fNavDir.device, + if ((size == sizeof(poseInfo) + && !BPoseView::PoseVisible(&model, &poseInfo, false)) + || fIteratingDesktop && !ShouldShowDesktopPose(fNavDir.device, &model, &poseInfo)) { // PRINT(("not showing hidden item %s\n", model.Name())); return true; @@ -572,6 +587,13 @@ BNavMenu::NewModelItem(Model *model, const BMessage *invokeMessage, result->CloseNode(); + if (size == sizeof(poseInfo) && !BPoseView::PoseVisible(result, + &poseInfo, false)) { + // link target does not want to be visible + delete newResolvedModel; + return NULL; + } + ref = *result->EntryRef(); container = result->IsContainer(); }