mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Dont output spurious blocked navigation message for opened URLs
This commit is contained in:
parent
9c42e1f7cc
commit
007e40b5b8
@ -36,7 +36,7 @@ from qt.webengine import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from calibre import as_unicode, prints
|
from calibre import as_unicode, prints
|
||||||
from calibre.constants import FAKE_HOST, FAKE_PROTOCOL, __version__, in_develop_mode, is_running_from_develop, ismacos, iswindows
|
from calibre.constants import DEBUG, FAKE_HOST, FAKE_PROTOCOL, __version__, in_develop_mode, is_running_from_develop, ismacos, iswindows
|
||||||
from calibre.ebooks.metadata.book.base import field_metadata
|
from calibre.ebooks.metadata.book.base import field_metadata
|
||||||
from calibre.ebooks.oeb.polish.utils import guess_type
|
from calibre.ebooks.oeb.polish.utils import guess_type
|
||||||
from calibre.gui2 import choose_images, config, error_dialog, safe_open_url
|
from calibre.gui2 import choose_images, config, error_dialog, safe_open_url
|
||||||
@ -397,8 +397,11 @@ class WebPage(QWebEnginePage):
|
|||||||
if url.scheme() in (FAKE_PROTOCOL, 'data'):
|
if url.scheme() in (FAKE_PROTOCOL, 'data'):
|
||||||
return True
|
return True
|
||||||
if url.scheme() in ('http', 'https', 'calibre') and req_type == QWebEnginePage.NavigationType.NavigationTypeLinkClicked:
|
if url.scheme() in ('http', 'https', 'calibre') and req_type == QWebEnginePage.NavigationType.NavigationTypeLinkClicked:
|
||||||
|
if DEBUG:
|
||||||
|
prints('Open URL from book:', url.toString())
|
||||||
safe_open_url(url)
|
safe_open_url(url)
|
||||||
prints('Blocking navigation request to:', url.toString())
|
else:
|
||||||
|
prints('Blocking navigation request to:', url.toString(), file=sys.stderr)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def go_to_anchor(self, anchor):
|
def go_to_anchor(self, anchor):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user