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':
|
elif field == 'formats':
|
||||||
if isdevice:
|
if isdevice:
|
||||||
continue
|
continue
|
||||||
path = ''
|
path = mi.path or ''
|
||||||
if mi.path:
|
bpath = ''
|
||||||
h, t = os.path.split(mi.path)
|
if path:
|
||||||
path = '/'.join((os.path.basename(h), t))
|
h, t = os.path.split(path)
|
||||||
|
bpath = '/'.join((os.path.basename(h), t))
|
||||||
data = ({
|
data = ({
|
||||||
'fmt':x, 'path':a(path or ''), 'fname':a(mi.format_files.get(x, '')),
|
'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)
|
} 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))))
|
ans.append((field, row % (name, u', '.join(fmts))))
|
||||||
elif field == 'identifiers':
|
elif field == 'identifiers':
|
||||||
urls = urls_from_identifiers(mi.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(_('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))
|
m.addAction(_('Edit Open With applications...'), partial(edit_programs, fmt, self))
|
||||||
menu.addMenu(m)
|
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:
|
else:
|
||||||
el = r.linkElement()
|
el = r.linkElement()
|
||||||
author = el.toPlainText() if unicode(el.attribute('calibre-data')) == u'authors' else None
|
author = el.toPlainText() if unicode(el.attribute('calibre-data')) == u'authors' else None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user