diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 3eb3aa3373..21186b6226 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -616,10 +616,21 @@ class TagsView(QTreeView): # {{{ da.setToolTip('*') pa.setToolTip('*') + if index.isValid() and self.model().rowCount(index) > 0: + self.context_menu.addSeparator() + self.context_menu.addAction(_('E&xpand all children'), partial(self.expand_node_and_descendants, index)) + if not self.context_menu.isEmpty(): self.context_menu.popup(self.mapToGlobal(point)) return True + def expand_node_and_descendants(self, index): + if not index.isValid(): + return + self.expand(index) + for r in xrange(self.model().rowCount(index)): + self.expand_node_and_descendants(index.child(r, 0)) + def collapse_menu_hovered(self, action): tip = action.toolTip() if tip == '*':