Enhancement #2065544: Add Open With action menu to Tag browser Formats entries

This commit is contained in:
Charles Haley 2024-05-23 15:46:43 +01:00
parent 2d37e19990
commit b38bf68f45

View File

@ -778,6 +778,14 @@ class TagsView(QTreeView): # {{{
gui = get_gui()
gui.iactions['Remove Books'].remove_format_from_selected_books(key)
return
if action == 'edit_open_with_apps':
from calibre.gui2.open_with import edit_programs
edit_programs(key, self)
return
if action == 'add_open_with_apps':
from calibre.gui2.open_with import choose_program
choose_program(key, self)
return
reset_filter_categories = True
if action == 'hide':
@ -1133,8 +1141,13 @@ class TagsView(QTreeView): # {{{
partial(self.context_menu_handler, action='manage_searches',
category=tag.name if tag else None))
elif key == 'formats' and tag is not None:
self.context_menu.addAction(_('Remove the {} format from selected books').format(tag.name), partial(
self.context_menu_handler, action='remove_format', key=tag.name))
self.context_menu.addAction(_('Remove the {} format from selected books').format(tag.name),
partial(self.context_menu_handler, action='remove_format', key=tag.name))
self.context_menu.addSeparator()
self.context_menu.addAction(_('Add other application for %s files') % format(tag.name.upper()),
partial(self.context_menu_handler, action='add_open_with_apps', key=tag.name))
self.context_menu.addAction(_('Edit Open with applications for {} files').format(tag.name),
partial(self.context_menu_handler, action='edit_open_with_apps', key=tag.name))
# Hide/Show/Restore categories
self.context_menu.addSeparator()