Tracker: Reduce differences between NavMenu and SlowContextPopup.
No functional change intended. Change-Id: Iaa9b821462ec97b74de538aa2c489762bf413311 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6872 Reviewed-by: waddlesplash <waddlesplash@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
parent
c14bd9b2e7
commit
d57510c0ff
@ -392,9 +392,7 @@ BNavMenu::ClearMenuBuildingState()
|
||||
// item list is non-owning, need to delete the items because
|
||||
// they didn't get added to the menu
|
||||
if (fItemList != NULL) {
|
||||
int32 count = fItemList->CountItems();
|
||||
for (int32 index = count - 1; index >= 0; index--)
|
||||
delete RemoveItem(index);
|
||||
RemoveItems(0, fItemList->CountItems(), true);
|
||||
|
||||
delete fItemList;
|
||||
fItemList = NULL;
|
||||
@ -429,14 +427,14 @@ BNavMenu::StartBuildingItemList()
|
||||
if (startModel.InitCheck() != B_OK || !startModel.IsContainer())
|
||||
return false;
|
||||
|
||||
if (startModel.IsQuery())
|
||||
if (startModel.IsQuery()) {
|
||||
fContainer = new QueryEntryListCollection(&startModel);
|
||||
else if (startModel.IsVirtualDirectory())
|
||||
} else if (startModel.IsVirtualDirectory()) {
|
||||
fContainer = new VirtualDirectoryEntryList(&startModel);
|
||||
else if (startModel.IsDesktop()) {
|
||||
} else if (startModel.IsDesktop()) {
|
||||
fIteratingDesktop = true;
|
||||
fContainer = DesktopPoseView::InitDesktopDirentIterator(
|
||||
0, startModel.EntryRef());
|
||||
fContainer = DesktopPoseView::InitDesktopDirentIterator(0,
|
||||
startModel.EntryRef());
|
||||
AddRootItemsIfNeeded();
|
||||
AddTrashItem();
|
||||
} else if (startModel.IsTrash()) {
|
||||
|
@ -126,6 +126,7 @@ BSlowContextMenu::DetachedFromWindow()
|
||||
{
|
||||
// see note above in AttachedToWindow
|
||||
fIsShowing = false;
|
||||
|
||||
// does this need to set this to null?
|
||||
// the parent, handling dnd should set this
|
||||
// appropriately
|
||||
@ -236,11 +237,12 @@ BSlowContextMenu::StartBuildingItemList()
|
||||
return false;
|
||||
}
|
||||
|
||||
fItemList = new BObjectList<BMenuItem>(50);
|
||||
|
||||
fIteratingDesktop = false;
|
||||
|
||||
BDirectory parent;
|
||||
status_t err = entry.GetParent(&parent);
|
||||
fItemList = new BObjectList<BMenuItem>(50);
|
||||
|
||||
// if ref is the root item then build list of volume root dirs
|
||||
fVolsOnly = (err == B_ENTRY_NOT_FOUND);
|
||||
@ -249,36 +251,34 @@ BSlowContextMenu::StartBuildingItemList()
|
||||
return true;
|
||||
|
||||
Model startModel(&entry, true);
|
||||
if (startModel.InitCheck() == B_OK) {
|
||||
if (!startModel.IsContainer())
|
||||
return false;
|
||||
if (startModel.InitCheck() != B_OK || !startModel.IsContainer())
|
||||
return false;
|
||||
|
||||
if (startModel.IsQuery())
|
||||
fContainer = new QueryEntryListCollection(&startModel);
|
||||
else if (startModel.IsVirtualDirectory())
|
||||
fContainer = new VirtualDirectoryEntryList(&startModel);
|
||||
else if (startModel.IsDesktop()) {
|
||||
fIteratingDesktop = true;
|
||||
fContainer = DesktopPoseView::InitDesktopDirentIterator(0,
|
||||
startModel.EntryRef());
|
||||
AddRootItemsIfNeeded();
|
||||
AddTrashItem();
|
||||
} else {
|
||||
BDirectory* directory = dynamic_cast<BDirectory*>(
|
||||
startModel.Node());
|
||||
if (startModel.IsQuery()) {
|
||||
fContainer = new QueryEntryListCollection(&startModel);
|
||||
} else if (startModel.IsVirtualDirectory()) {
|
||||
fContainer = new VirtualDirectoryEntryList(&startModel);
|
||||
} else if (startModel.IsDesktop()) {
|
||||
fIteratingDesktop = true;
|
||||
fContainer = DesktopPoseView::InitDesktopDirentIterator(0,
|
||||
startModel.EntryRef());
|
||||
AddRootItemsIfNeeded();
|
||||
AddTrashItem();
|
||||
} else {
|
||||
BDirectory* directory = dynamic_cast<BDirectory*>(
|
||||
startModel.Node());
|
||||
|
||||
ASSERT(directory != NULL);
|
||||
ASSERT(directory != NULL);
|
||||
|
||||
if (directory != NULL)
|
||||
fContainer = new DirectoryEntryList(*directory);
|
||||
}
|
||||
|
||||
if (fContainer->InitCheck() != B_OK)
|
||||
return false;
|
||||
|
||||
fContainer->Rewind();
|
||||
if (directory != NULL)
|
||||
fContainer = new DirectoryEntryList(*directory);
|
||||
}
|
||||
|
||||
if (fContainer->InitCheck() != B_OK)
|
||||
return false;
|
||||
|
||||
fContainer->Rewind();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -290,13 +290,13 @@ BSlowContextMenu::AddRootItemsIfNeeded()
|
||||
roster.Rewind();
|
||||
BVolume volume;
|
||||
while (roster.GetNextVolume(&volume) == B_OK) {
|
||||
|
||||
BDirectory root;
|
||||
BEntry entry;
|
||||
if (!volume.IsPersistent()
|
||||
|| volume.GetRootDirectory(&root) != B_OK
|
||||
|| root.GetEntry(&entry) != B_OK)
|
||||
|| root.GetEntry(&entry) != B_OK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Model model(&entry);
|
||||
AddOneItem(&model);
|
||||
|
Loading…
Reference in New Issue
Block a user