mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
Fixes #2065614 [Another unescaped ampersand](https://bugs.launchpad.net/calibre/+bug/2065614) Fixes #2065544 [{Enhancement)] Add Open With action menu to Tag browser Formats entries](https://bugs.launchpad.net/calibre/+bug/2065544)
This commit is contained in:
commit
075fbe767b
@ -101,7 +101,7 @@ class TagBrowserMixin: # {{{
|
|||||||
current_cat = model.column_map[col]
|
current_cat = model.column_map[col]
|
||||||
if current_cat in ('authors', 'series', 'publisher', 'tags') or current_cat in cust_cats:
|
if current_cat in ('authors', 'series', 'publisher', 'tags') or current_cat in cust_cats:
|
||||||
cdn = cat_display_name(current_cat) or current_cat
|
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()))
|
proxy_md = db.new_api.get_proxy_metadata(db.id(idx.row()))
|
||||||
items = proxy_md.get(current_cat)
|
items = proxy_md.get(current_cat)
|
||||||
if isinstance(items, str):
|
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))):
|
for cat in sorted(cust_cats, key=lambda v: sort_key(cat_display_name(v))):
|
||||||
if cat == current_cat:
|
if cat == current_cat:
|
||||||
continue
|
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):
|
def init_tag_browser_mixin(self, db):
|
||||||
self.library_view.model().count_changed_signal.connect(self.tags_view.recount_with_position_based_index)
|
self.library_view.model().count_changed_signal.connect(self.tags_view.recount_with_position_based_index)
|
||||||
|
@ -778,6 +778,14 @@ class TagsView(QTreeView): # {{{
|
|||||||
gui = get_gui()
|
gui = get_gui()
|
||||||
gui.iactions['Remove Books'].remove_format_from_selected_books(key)
|
gui.iactions['Remove Books'].remove_format_from_selected_books(key)
|
||||||
return
|
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
|
reset_filter_categories = True
|
||||||
if action == 'hide':
|
if action == 'hide':
|
||||||
@ -1133,8 +1141,13 @@ class TagsView(QTreeView): # {{{
|
|||||||
partial(self.context_menu_handler, action='manage_searches',
|
partial(self.context_menu_handler, action='manage_searches',
|
||||||
category=tag.name if tag else None))
|
category=tag.name if tag else None))
|
||||||
elif key == 'formats' and tag is not 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.addAction(_('Remove the {} format from selected books').format(tag.name),
|
||||||
self.context_menu_handler, action='remove_format', key=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
|
# Hide/Show/Restore categories
|
||||||
self.context_menu.addSeparator()
|
self.context_menu.addSeparator()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user