From b38bf68f452dfd1e03acdf70188a1c3d23459c2c Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Thu, 23 May 2024 15:46:43 +0100 Subject: [PATCH] Enhancement #2065544: Add Open With action menu to Tag browser Formats entries --- src/calibre/gui2/tag_browser/view.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 623b7db857..a75d845915 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -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()