Tracker: Minor simplifications, remove overload methods.
Change-Id: I4f1c270039d8d863bbd109250bd204672cc4b179 Reviewed-on: https://review.haiku-os.org/c/haiku/+/9894 Reviewed-by: John Scipione <[email protected]>
This commit is contained in:
@@ -2004,13 +2004,6 @@ BContainerWindow::SetupNavigationMenu(BMenu* parent, const entry_ref* ref)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BContainerWindow::SetupEditQueryItem(BMenu* parent)
|
||||
{
|
||||
SetupEditQueryItem(parent, TargetModel()->EntryRef());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BContainerWindow::SetupEditQueryItem(BMenu* parent, const entry_ref* ref)
|
||||
{
|
||||
@@ -2039,13 +2032,6 @@ BContainerWindow::SetupEditQueryItem(BMenu* parent, const entry_ref* ref)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BContainerWindow::SetupOpenWithMenu(BMenu* parent)
|
||||
{
|
||||
SetupOpenWithMenu(parent, TargetModel()->EntryRef());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BContainerWindow::SetupOpenWithMenu(BMenu* parent, const entry_ref* ref)
|
||||
{
|
||||
@@ -2150,13 +2136,6 @@ BContainerWindow::SetupNewTemplatesMenu(BMenu* parent, MenuContext context)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BContainerWindow::SetupMountMenu(BMenu* parent, MenuContext context)
|
||||
{
|
||||
SetupMountMenu(parent, context, TargetModel()->EntryRef());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BContainerWindow::SetupMountMenu(BMenu* parent, MenuContext context, const entry_ref* ref)
|
||||
{
|
||||
@@ -2169,9 +2148,10 @@ BContainerWindow::SetupMountMenu(BMenu* parent, MenuContext context, const entry
|
||||
if (ref == NULL)
|
||||
ref = TargetModel()->EntryRef();
|
||||
|
||||
Model model(ref);
|
||||
ASSERT(ref != NULL);
|
||||
|
||||
// bail out if not Desktop, root or volume
|
||||
Model model(ref);
|
||||
if (!(model.IsDesktop() || model.IsRoot() || model.IsVolume()))
|
||||
return;
|
||||
|
||||
@@ -2902,12 +2882,9 @@ BContainerWindow::UpdateFileMenuOrPoseContextMenu(BMenu* menu, MenuContext conte
|
||||
ref = TargetModel()->EntryRef();
|
||||
|
||||
// "Open with..." menu inserted after Open
|
||||
if (context == kPosePopUpContext) {
|
||||
if (ShouldHaveOpenWithMenu(ref))
|
||||
SetupOpenWithMenu(menu, ref);
|
||||
} else if (context == kFileMenuContext) {
|
||||
if (ShouldHaveOpenWithMenu())
|
||||
SetupOpenWithMenu(menu);
|
||||
if (ShouldHaveOpenWithMenu(ref)
|
||||
&& (context == kPosePopUpContext || context == kFileMenuContext)) {
|
||||
SetupOpenWithMenu(menu, ref);
|
||||
}
|
||||
|
||||
// "Mount >" menu and "Unmount" are inserted here
|
||||
@@ -2915,19 +2892,13 @@ BContainerWindow::UpdateFileMenuOrPoseContextMenu(BMenu* menu, MenuContext conte
|
||||
Model model(ref);
|
||||
if (model.IsRoot() || model.IsVolume())
|
||||
SetupMountMenu(menu, kPosePopUpContext, ref);
|
||||
} else if (context == kFileMenuContext) {
|
||||
if (TargetModel()->IsRoot())
|
||||
SetupMountMenu(menu, kFileMenuContext);
|
||||
} else if (context == kFileMenuContext && TargetModel()->IsRoot()) {
|
||||
SetupMountMenu(menu, kFileMenuContext, ref);
|
||||
}
|
||||
|
||||
// "Edit query" inserted before "Open with..."
|
||||
if (context == kPosePopUpContext) {
|
||||
if (ShouldHaveEditQueryItem(ref))
|
||||
SetupEditQueryItem(menu, ref);
|
||||
} else {
|
||||
if (ShouldHaveEditQueryItem())
|
||||
SetupEditQueryItem(menu);
|
||||
}
|
||||
if (ShouldHaveEditQueryItem(ref))
|
||||
SetupEditQueryItem(menu, ref);
|
||||
|
||||
// "Move To", "Copy To", "Create Link" menus inserted after "Move to Trash"
|
||||
if (ShouldHaveMoveCopyMenus(ref))
|
||||
@@ -2954,7 +2925,7 @@ BContainerWindow::UpdateWindowContextMenu(BMenu* menu)
|
||||
|
||||
// "Mount >" menu is inserted at the bottom
|
||||
if (PoseView()->IsDesktopView() || TargetModel()->IsRoot())
|
||||
SetupMountMenu(menu, kWindowPopUpContext);
|
||||
SetupMountMenu(menu, kWindowPopUpContext, TargetModel()->EntryRef());
|
||||
|
||||
if (ShouldHaveAddOnMenus())
|
||||
BuildAddOnsMenu(menu);
|
||||
@@ -3113,21 +3084,16 @@ BContainerWindow::ShouldHaveMoveCopyMenus(const entry_ref* ref)
|
||||
ref = TargetModel()->EntryRef();
|
||||
|
||||
Model model(ref);
|
||||
if (model.IsPrintersDir())
|
||||
return false;
|
||||
|
||||
return !(model.IsTrash() || model.InTrash());
|
||||
return !(model.IsPrintersDir() || model.IsRoot() || model.IsTrash() || model.InTrash());
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BContainerWindow::ShouldHaveNewFolderItem()
|
||||
{
|
||||
if (TargetModel()->IsPrintersDir())
|
||||
return false;
|
||||
|
||||
return !(TargetModel()->IsQuery() || TargetModel()->IsRoot() || TargetModel()->IsTrash()
|
||||
|| TargetModel()->InTrash() || TargetModel()->IsVirtualDirectory());
|
||||
return !(TargetModel()->IsQuery() || TargetModel()->IsPrintersDir()
|
||||
|| TargetModel()->IsRoot() || TargetModel()->IsTrash() || TargetModel()->InTrash()
|
||||
|| TargetModel()->IsVirtualDirectory());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -253,13 +253,10 @@ protected:
|
||||
virtual void PopulateMoveCopyNavMenu(BNavMenu*, uint32,
|
||||
const entry_ref*, bool);
|
||||
|
||||
virtual void SetupOpenWithMenu(BMenu*);
|
||||
virtual void SetupOpenWithMenu(BMenu*, const entry_ref* ref);
|
||||
virtual void SetupNewTemplatesMenu(BMenu*, MenuContext context);
|
||||
virtual void SetupEditQueryItem(BMenu*);
|
||||
virtual void SetupEditQueryItem(BMenu*, const entry_ref* ref);
|
||||
virtual void SetupDiskMenu(BMenu*);
|
||||
virtual void SetupMountMenu(BMenu*, MenuContext context);
|
||||
virtual void SetupMountMenu(BMenu*, MenuContext context, const entry_ref* ref);
|
||||
BMenuItem* DetachMountMenu();
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ OpenWithContainerWindow::EntryList() const
|
||||
void
|
||||
OpenWithContainerWindow::OpenWithSelection()
|
||||
{
|
||||
int32 count = PoseView()->SelectionList()->CountItems();
|
||||
int32 count = PoseView()->CountSelected();
|
||||
ASSERT(count == 1);
|
||||
if (count == 0)
|
||||
return;
|
||||
@@ -259,7 +259,7 @@ SetDefaultAppForOneType(const BString& element, void* castToEntryRef)
|
||||
void
|
||||
OpenWithContainerWindow::MakeDefaultAndOpen()
|
||||
{
|
||||
int32 count = PoseView()->SelectionList()->CountItems();
|
||||
int32 count = PoseView()->CountSelected();
|
||||
ASSERT(count == 1);
|
||||
if (count == 0)
|
||||
return;
|
||||
@@ -705,7 +705,7 @@ OpenWithPoseView::OpenSelection(BPose* pose, int32*)
|
||||
{
|
||||
OpenWithContainerWindow* window = ContainerWindow();
|
||||
|
||||
int32 count = SelectionList()->CountItems();
|
||||
int32 count = CountSelected();
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
@@ -774,7 +774,7 @@ OpenWithPoseView::Pulse()
|
||||
|
||||
OpenWithContainerWindow* window = ContainerWindow();
|
||||
|
||||
if (!SelectionList()->CountItems()) {
|
||||
if (!CountSelected()) {
|
||||
window->SetCanSetAppAsDefault(false);
|
||||
window->SetCanOpen(false);
|
||||
_inherited::Pulse();
|
||||
@@ -799,7 +799,7 @@ OpenWithPoseView::Pulse()
|
||||
return;
|
||||
}
|
||||
|
||||
ASSERT(SelectionList()->CountItems() == 1);
|
||||
ASSERT(CountSelected() == 1);
|
||||
|
||||
// enable the Open and make default if selected application different
|
||||
// from preferred app ref
|
||||
|
||||
Reference in New Issue
Block a user