Skip to content

Commit d2df90d

Browse files
authored
Merge pull request xbmc#24543 from enen92/python_context
[ContextMenus] Don't populate python context items if browsing sub-menus
2 parents a018bcd + 5d5a104 commit d2df90d

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

xbmc/ContextMenuItem.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ bool CContextMenuItem::IsGroup() const
4747
return !m_groupId.empty();
4848
}
4949

50+
bool CContextMenuItem::HasParent() const
51+
{
52+
return !m_parent.empty();
53+
}
54+
5055
bool CContextMenuItem::Execute(const std::shared_ptr<CFileItem>& item) const
5156
{
5257
if (!item || m_library.empty() || IsGroup())

xbmc/ContextMenuItem.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class IContextMenuItem
3333
virtual bool Execute(const std::shared_ptr<CFileItem>& item) const = 0;
3434
virtual std::string GetLabel(const CFileItem& item) const = 0;
3535
virtual bool IsGroup() const { return false; }
36+
virtual bool HasParent() const { return false; }
3637
};
3738

3839

@@ -56,6 +57,7 @@ class CContextMenuItem : public IContextMenuItem
5657
bool IsVisible(const CFileItem& item) const override ;
5758
bool IsParentOf(const CContextMenuItem& menuItem) const;
5859
bool IsGroup() const override ;
60+
bool HasParent() const override;
5961
bool Execute(const std::shared_ptr<CFileItem>& item) const override;
6062
bool operator==(const CContextMenuItem& other) const;
6163
std::string ToString() const;

xbmc/ContextMenuManager.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ bool CONTEXTMENU::ShowFor(const std::shared_ptr<CFileItem>& fileItem, const CCon
298298

299299
CContextButtons buttons;
300300
// compute fileitem property-based contextmenu items
301+
// unless we're browsing a child menu item
302+
if (!root.HasParent())
301303
{
302304
int i = 0;
303305
while (fileItem->HasProperty(StringUtils::Format("contextmenulabel({})", i)))

0 commit comments

Comments
 (0)