mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Book details panel: Allow copying full path to ebook files by right clicking on the format link. See #1437756 ([Enhancement] Option to create and place a link to a selected book.)
This commit is contained in:
parent
999cfd81bd
commit
24d43645ab
@ -131,15 +131,16 @@ def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers=
|
||||
elif field == 'formats':
|
||||
if isdevice:
|
||||
continue
|
||||
path = ''
|
||||
if mi.path:
|
||||
h, t = os.path.split(mi.path)
|
||||
path = '/'.join((os.path.basename(h), t))
|
||||
path = mi.path or ''
|
||||
bpath = ''
|
||||
if path:
|
||||
h, t = os.path.split(path)
|
||||
bpath = '/'.join((os.path.basename(h), t))
|
||||
data = ({
|
||||
'fmt':x, 'path':a(path or ''), 'fname':a(mi.format_files.get(x, '')),
|
||||
'ext':x.lower(), 'id':mi.id
|
||||
'ext':x.lower(), 'id':mi.id, 'bpath':bpath,
|
||||
} for x in mi.formats)
|
||||
fmts = [u'<a title="{path}/{fname}.{ext}" href="format:{id}:{fmt}">{fmt}</a>'.format(**x) for x in data]
|
||||
fmts = [u'<a data-full-path="{path}/{fname}.{ext}" title="{bpath}/{fname}.{ext}" href="format:{id}:{fmt}">{fmt}</a>'.format(**x) for x in data]
|
||||
ans.append((field, row % (name, u', '.join(fmts))))
|
||||
elif field == 'identifiers':
|
||||
urls = urls_from_identifiers(mi.identifiers)
|
||||
|
@ -441,6 +441,11 @@ class BookInfo(QWebView):
|
||||
m.addAction(_('Add other application for %s files...') % fmt.upper(), partial(self.choose_open_with, book_id, fmt))
|
||||
m.addAction(_('Edit Open With applications...'), partial(edit_programs, fmt, self))
|
||||
menu.addMenu(m)
|
||||
ac = self.copy_link_action
|
||||
ac.current_url = r.linkElement().attribute('data-full-path')
|
||||
if ac.current_url:
|
||||
ac.setText(_('&Copy path to file'))
|
||||
menu.addAction(ac)
|
||||
else:
|
||||
el = r.linkElement()
|
||||
author = el.toPlainText() if unicode(el.attribute('calibre-data')) == u'authors' else None
|
||||
|
Loading…
x
Reference in New Issue
Block a user