summaryrefslogtreecommitdiff
path: root/qutebrowser/browser/webkit/webpage.py
diff options
context:
space:
mode:
Diffstat (limited to 'qutebrowser/browser/webkit/webpage.py')
-rw-r--r--qutebrowser/browser/webkit/webpage.py50
1 files changed, 25 insertions, 25 deletions
diff --git a/qutebrowser/browser/webkit/webpage.py b/qutebrowser/browser/webkit/webpage.py
index 747b2d382..12b9b837d 100644
--- a/qutebrowser/browser/webkit/webpage.py
+++ b/qutebrowser/browser/webkit/webpage.py
@@ -68,8 +68,8 @@ class BrowserPage(QWebPage):
self._tabdata = tabdata
self._is_shutting_down = False
self._extension_handlers = {
- QWebPage.ErrorPageExtension: self._handle_errorpage,
- QWebPage.ChooseMultipleFilesExtension: self._handle_multiple_files,
+ QWebPage.Extension.ErrorPageExtension: self._handle_errorpage,
+ QWebPage.Extension.ChooseMultipleFilesExtension: self._handle_multiple_files,
}
self._ignore_load_started = False
self.error_occurred = False
@@ -135,16 +135,16 @@ class BrowserPage(QWebPage):
False if no error page should be displayed, True otherwise.
"""
ignored_errors = [
- (QWebPage.QtNetwork, QNetworkReply.OperationCanceledError),
+ (QWebPage.ErrorDomain.QtNetwork, QNetworkReply.NetworkError.OperationCanceledError),
# "Loading is handled by the media engine"
- (QWebPage.WebKit, 203),
+ (QWebPage.ErrorDomain.WebKit, 203),
# "Frame load interrupted by policy change"
- (QWebPage.WebKit, 102),
+ (QWebPage.ErrorDomain.WebKit, 102),
]
errpage.baseUrl = info.url
urlstr = info.url.toDisplayString()
- if (info.domain, info.error) == (QWebPage.QtNetwork,
- QNetworkReply.ProtocolUnknownError):
+ if (info.domain, info.error) == (QWebPage.ErrorDomain.QtNetwork,
+ QNetworkReply.NetworkError.ProtocolUnknownError):
# For some reason, we get a segfault when we use
# QDesktopServices::openUrl with info.url directly - however it
# works when we construct a copy of it.
@@ -155,7 +155,7 @@ class BrowserPage(QWebPage):
text="URL: <b>{}</b>".format(
html.escape(url.toDisplayString())),
yes_action=functools.partial(QDesktopServices.openUrl, url),
- url=info.url.toString(QUrl.RemovePassword | QUrl.FullyEncoded))
+ url=info.url.toString(QUrl.UrlFormattingOption.RemovePassword | QUrl.ComponentFormattingOption.FullyEncoded))
return True
elif (info.domain, info.error) in ignored_errors:
log.webview.debug("Ignored error on {}: {} (error domain: {}, "
@@ -251,7 +251,7 @@ class BrowserPage(QWebPage):
def on_print_requested(self, frame):
"""Handle printing when requested via javascript."""
printdiag = QPrintDialog()
- printdiag.setAttribute(Qt.WA_DeleteOnClose)
+ printdiag.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
printdiag.open(lambda: frame.print(printdiag.printer()))
def on_download_requested(self, request):
@@ -357,25 +357,25 @@ class BrowserPage(QWebPage):
return
options = {
- QWebPage.Notifications: 'content.notifications.enabled',
- QWebPage.Geolocation: 'content.geolocation',
+ QWebPage.Feature.Notifications: 'content.notifications.enabled',
+ QWebPage.Feature.Geolocation: 'content.geolocation',
}
messages = {
- QWebPage.Notifications: 'show notifications',
- QWebPage.Geolocation: 'access your location',
+ QWebPage.Feature.Notifications: 'show notifications',
+ QWebPage.Feature.Geolocation: 'access your location',
}
yes_action = functools.partial(
self.setFeaturePermission, frame, feature,
- QWebPage.PermissionGrantedByUser)
+ QWebPage.PermissionPolicy.PermissionGrantedByUser)
no_action = functools.partial(
self.setFeaturePermission, frame, feature,
- QWebPage.PermissionDeniedByUser)
+ QWebPage.PermissionPolicy.PermissionDeniedByUser)
url = frame.url().adjusted(cast(QUrl.FormattingOptions,
- QUrl.RemoveUserInfo |
- QUrl.RemovePath |
- QUrl.RemoveQuery |
- QUrl.RemoveFragment))
+ QUrl.UrlFormattingOption.RemoveUserInfo |
+ QUrl.UrlFormattingOption.RemovePath |
+ QUrl.UrlFormattingOption.RemoveQuery |
+ QUrl.UrlFormattingOption.RemoveFragment))
question = shared.feature_permission(
url=url,
option=options[feature], msg=messages[feature],
@@ -508,17 +508,17 @@ class BrowserPage(QWebPage):
and then conditionally opens the URL here or in another tab/window.
"""
type_map = {
- QWebPage.NavigationTypeLinkClicked:
+ QWebPage.NavigationType.NavigationTypeLinkClicked:
usertypes.NavigationRequest.Type.link_clicked,
- QWebPage.NavigationTypeFormSubmitted:
+ QWebPage.NavigationType.NavigationTypeFormSubmitted:
usertypes.NavigationRequest.Type.form_submitted,
- QWebPage.NavigationTypeFormResubmitted:
+ QWebPage.NavigationType.NavigationTypeFormResubmitted:
usertypes.NavigationRequest.Type.form_resubmitted,
- QWebPage.NavigationTypeBackOrForward:
+ QWebPage.NavigationType.NavigationTypeBackOrForward:
usertypes.NavigationRequest.Type.back_forward,
- QWebPage.NavigationTypeReload:
+ QWebPage.NavigationType.NavigationTypeReload:
usertypes.NavigationRequest.Type.reloaded,
- QWebPage.NavigationTypeOther:
+ QWebPage.NavigationType.NavigationTypeOther:
usertypes.NavigationRequest.Type.other,
}
is_main_frame = frame is self.mainFrame()