From 48cb4b5f051597714189df49ee8643e9b56f339f Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Tue, 1 Apr 2025 18:13:26 +0100 Subject: [PATCH] In book_details: in order to make the context menu available, change NO_AUTHOR_LINK into a link that is clickable but does nothing when clicked. The content server behavior is unchanged. No link is shown. --- src/calibre/ebooks/metadata/book/render.py | 2 +- src/calibre/gui2/book_details.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/metadata/book/render.py b/src/calibre/ebooks/metadata/book/render.py index 742f35fc3e..03c94aa655 100644 --- a/src/calibre/ebooks/metadata/book/render.py +++ b/src/calibre/ebooks/metadata/book/render.py @@ -127,7 +127,7 @@ def author_search_href(which, title=None, author=None): def render_author_link(default_author_link, author, book_title=None, author_sort=None): book_title = book_title or '' if default_author_link == NO_SEARCH_LINK: - return '','' + return NO_SEARCH_LINK, _('Author search links are disabled') elif default_author_link.startswith('search-'): which_src = default_author_link.partition('-')[2] link, lt = author_search_href(which_src, title=book_title, author=author) diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index 27b9f0ce81..77f6933f1a 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -39,7 +39,7 @@ from qt.core import ( from calibre import fit_image, sanitize_file_name from calibre.constants import config_dir, iswindows -from calibre.db.constants import DATA_DIR_NAME, DATA_FILE_PATTERN, RESOURCE_URL_SCHEME +from calibre.db.constants import DATA_DIR_NAME, DATA_FILE_PATTERN, NO_SEARCH_LINK, RESOURCE_URL_SCHEME from calibre.ebooks import BOOK_EXTENSIONS from calibre.ebooks.metadata.book.base import Metadata, field_metadata from calibre.ebooks.metadata.book.render import mi_to_html @@ -501,7 +501,7 @@ def add_item_specific_entries(menu, data, book_info, copy_menu, search_menu): data['reindex_fmt_added'] = True elif dt == 'author': author = data['name'] - if data['url'] != 'calibre': + if data['url'] not in ('calibre', NO_SEARCH_LINK): ac = book_info.copy_link_action ac.current_url = data['url'] ac.setText(_('&Author link')) @@ -1480,6 +1480,8 @@ class BookDetails(DetailsLayout, DropMixin): # {{{ if typ == 'action': data = json_loads(from_hex_bytes(val)) + if data['url'] == NO_SEARCH_LINK: + return dt = data['type'] if dt == 'search': field = data.get('field')