From 2d37e199905cbec5740779c10b83afa7ec19d656 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Thu, 23 May 2024 15:02:07 +0100 Subject: [PATCH 1/2] Bug #2065614: Another unescaped ampersand --- src/calibre/gui2/tag_browser/ui.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tag_browser/ui.py b/src/calibre/gui2/tag_browser/ui.py index 56837b1fc9..4de70a6701 100644 --- a/src/calibre/gui2/tag_browser/ui.py +++ b/src/calibre/gui2/tag_browser/ui.py @@ -101,7 +101,7 @@ class TagBrowserMixin: # {{{ current_cat = model.column_map[col] if current_cat in ('authors', 'series', 'publisher', 'tags') or current_cat in cust_cats: cdn = cat_display_name(current_cat) or current_cat - m.addAction(get_icon(current_cat), cdn, menu_func(current_cat, None)) + m.addAction(get_icon(current_cat), cdn.replace('&', '&&'), menu_func(current_cat, None)) proxy_md = db.new_api.get_proxy_metadata(db.id(idx.row())) items = proxy_md.get(current_cat) if isinstance(items, str): @@ -130,7 +130,7 @@ class TagBrowserMixin: # {{{ for cat in sorted(cust_cats, key=lambda v: sort_key(cat_display_name(v))): if cat == current_cat: continue - m.addAction(get_icon(cat), cat_display_name(cat), menu_func(cat, None)) + m.addAction(get_icon(cat), cat_display_name(cat).replace('&', '&&'), menu_func(cat, None)) def init_tag_browser_mixin(self, db): self.library_view.model().count_changed_signal.connect(self.tags_view.recount_with_position_based_index) From b38bf68f452dfd1e03acdf70188a1c3d23459c2c Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Thu, 23 May 2024 15:46:43 +0100 Subject: [PATCH 2/2] 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()