mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Enhancement: add a "Copy all links" option to book details
This commit is contained in:
parent
72ea69f8d9
commit
265f2d51ef
@ -451,9 +451,12 @@ def create_copy_links(menu, data=None):
|
||||
library_id = '_hex_-' + library_id.encode('utf-8').hex()
|
||||
book_id = get_gui().library_view.current_id
|
||||
|
||||
all_links = []
|
||||
def link(text, url):
|
||||
def doit():
|
||||
QApplication.instance().clipboard().setText(url)
|
||||
nonlocal all_links
|
||||
all_links.append(url)
|
||||
menu.addAction(QIcon.ic('edit-copy.png'), text, doit)
|
||||
|
||||
menu.addSeparator()
|
||||
@ -473,6 +476,13 @@ def create_copy_links(menu, data=None):
|
||||
fmt = fmt.upper()
|
||||
link(_('Link to view {} format of book').format(fmt.upper()), f'calibre://view-book/{library_id}/{book_id}/{fmt}')
|
||||
|
||||
if all_links:
|
||||
menu.addSeparator()
|
||||
mi = db.new_api.get_proxy_metadata(book_id)
|
||||
all_links.insert(0, '')
|
||||
all_links.insert(0, mi.get('title') + ' - ' + ' & '.join(mi.get('authors')))
|
||||
link(_('Copy all the above links'), '\n'.join(all_links))
|
||||
|
||||
|
||||
def details_context_menu_event(view, ev, book_info, add_popup_action=False, edit_metadata=None):
|
||||
url = view.anchorAt(ev.pos())
|
||||
|
Loading…
x
Reference in New Issue
Block a user