Edit book: Fix right click to edit images in the preview panel not working in books with html files and images in separate top level folders

This commit is contained in:
Kovid Goyal 2020-02-22 08:53:54 +05:30
parent 07201fc280
commit 20b2b0d5d4
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -400,15 +400,13 @@ class WebView(RestartingWebEngineView, OpenWithHandler):
if url.scheme() == FAKE_PROTOCOL:
href = url.path().lstrip('/')
c = current_container()
current_name = self.parent().current_name
if current_name:
resource_name = c.href_to_name(href, current_name)
if resource_name and c.exists(resource_name) and resource_name not in c.names_that_must_not_be_changed:
self.add_open_with_actions(menu, resource_name)
if data.mediaType() == data.MediaTypeImage:
mime = c.mime_map[resource_name]
if mime.startswith('image/'):
menu.addAction(_('Edit %s') % resource_name, partial(self.edit_image, resource_name))
resource_name = c.href_to_name(href)
if resource_name and c.exists(resource_name) and resource_name not in c.names_that_must_not_be_changed:
self.add_open_with_actions(menu, resource_name)
if data.mediaType() == data.MediaTypeImage:
mime = c.mime_map[resource_name]
if mime.startswith('image/'):
menu.addAction(_('Edit %s') % resource_name, partial(self.edit_image, resource_name))
menu.exec_(ev.globalPos())
def open_with(self, file_name, fmt, entry):