mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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.
This commit is contained in:
parent
cd0a7f740d
commit
48cb4b5f05
@ -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):
|
def render_author_link(default_author_link, author, book_title=None, author_sort=None):
|
||||||
book_title = book_title or ''
|
book_title = book_title or ''
|
||||||
if default_author_link == NO_SEARCH_LINK:
|
if default_author_link == NO_SEARCH_LINK:
|
||||||
return '',''
|
return NO_SEARCH_LINK, _('Author search links are disabled')
|
||||||
elif default_author_link.startswith('search-'):
|
elif default_author_link.startswith('search-'):
|
||||||
which_src = default_author_link.partition('-')[2]
|
which_src = default_author_link.partition('-')[2]
|
||||||
link, lt = author_search_href(which_src, title=book_title, author=author)
|
link, lt = author_search_href(which_src, title=book_title, author=author)
|
||||||
|
@ -39,7 +39,7 @@ from qt.core import (
|
|||||||
|
|
||||||
from calibre import fit_image, sanitize_file_name
|
from calibre import fit_image, sanitize_file_name
|
||||||
from calibre.constants import config_dir, iswindows
|
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 import BOOK_EXTENSIONS
|
||||||
from calibre.ebooks.metadata.book.base import Metadata, field_metadata
|
from calibre.ebooks.metadata.book.base import Metadata, field_metadata
|
||||||
from calibre.ebooks.metadata.book.render import mi_to_html
|
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
|
data['reindex_fmt_added'] = True
|
||||||
elif dt == 'author':
|
elif dt == 'author':
|
||||||
author = data['name']
|
author = data['name']
|
||||||
if data['url'] != 'calibre':
|
if data['url'] not in ('calibre', NO_SEARCH_LINK):
|
||||||
ac = book_info.copy_link_action
|
ac = book_info.copy_link_action
|
||||||
ac.current_url = data['url']
|
ac.current_url = data['url']
|
||||||
ac.setText(_('&Author link'))
|
ac.setText(_('&Author link'))
|
||||||
@ -1480,6 +1480,8 @@ class BookDetails(DetailsLayout, DropMixin): # {{{
|
|||||||
|
|
||||||
if typ == 'action':
|
if typ == 'action':
|
||||||
data = json_loads(from_hex_bytes(val))
|
data = json_loads(from_hex_bytes(val))
|
||||||
|
if data['url'] == NO_SEARCH_LINK:
|
||||||
|
return
|
||||||
dt = data['type']
|
dt = data['type']
|
||||||
if dt == 'search':
|
if dt == 'search':
|
||||||
field = data.get('field')
|
field = data.get('field')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user