Allow to set cookies-store at runtime with Qt 5.9

Fixes #2588
This commit is contained in:
Florian Bruhin 2017-04-28 17:39:36 +02:00
parent c8090b5388
commit 76ec465f67
4 changed files with 14 additions and 8 deletions

View File

@ -50,6 +50,8 @@ Changed
- When ui -> message-timeout is set to 0, messages are now never cleared.
- Middle/right-clicking the blank parts of the tab bar (when vertical) now
closes the current tab.
- With Qt 5.9, `content -> cookies-store` can now be set on QtWebEngine without
a restart.
Fixed
~~~~~

View File

@ -175,7 +175,7 @@
|<<content-local-content-can-access-remote-urls,local-content-can-access-remote-urls>>|Whether locally loaded documents are allowed to access remote urls.
|<<content-local-content-can-access-file-urls,local-content-can-access-file-urls>>|Whether locally loaded documents are allowed to access other local urls.
|<<content-cookies-accept,cookies-accept>>|Control which cookies to accept.
|<<content-cookies-store,cookies-store>>|Whether to store cookies. Note this option needs a restart with QtWebEngine.
|<<content-cookies-store,cookies-store>>|Whether to store cookies. Note this option needs a restart with QtWebEngine on Qt < 5.9.
|<<content-host-block-lists,host-block-lists>>|List of URLs of lists which contain hosts to block.
|<<content-host-blocking-enabled,host-blocking-enabled>>|Whether host blocking is enabled.
|<<content-host-blocking-whitelist,host-blocking-whitelist>>|List of domains that should always be loaded, despite being ad-blocked.
@ -1616,7 +1616,7 @@ This setting is only available with the QtWebKit backend.
[[content-cookies-store]]
=== cookies-store
Whether to store cookies. Note this option needs a restart with QtWebEngine.
Whether to store cookies. Note this option needs a restart with QtWebEngine on Qt < 5.9.
Valid values:

View File

@ -34,7 +34,8 @@ from PyQt5.QtWebEngineWidgets import (QWebEngineSettings, QWebEngineProfile,
from qutebrowser.browser import shared
from qutebrowser.config import config, websettings
from qutebrowser.utils import objreg, utils, standarddir, javascript, log
from qutebrowser.utils import (objreg, utils, standarddir, javascript, log,
qtutils)
class Attribute(websettings.Attribute):
@ -177,7 +178,8 @@ def init(args):
_init_stylesheet(profile)
# We need to do this here as a WORKAROUND for
# https://bugreports.qt.io/browse/QTBUG-58650
PersistentCookiePolicy().set(config.get('content', 'cookies-store'))
if not qtutils.version_check('5.9'):
PersistentCookiePolicy().set(config.get('content', 'cookies-store'))
Attribute(QWebEngineSettings.FullScreenSupportEnabled).set(True)
@ -221,9 +223,6 @@ MAPPINGS = {
Attribute(QWebEngineSettings.LocalContentCanAccessRemoteUrls),
'local-content-can-access-file-urls':
Attribute(QWebEngineSettings.LocalContentCanAccessFileUrls),
# https://bugreports.qt.io/browse/QTBUG-58650
# 'cookies-store':
# PersistentCookiePolicy(),
'webgl':
Attribute(QWebEngineSettings.WebGLEnabled),
},
@ -301,3 +300,8 @@ try:
except AttributeError:
# Added in Qt 5.8
pass
if qtutils.version_check('5.9'):
# https://bugreports.qt.io/browse/QTBUG-58650
MAPPINGS['content']['cookies-store'] = PersistentCookiePolicy()

View File

@ -915,7 +915,7 @@ def data(readonly=False):
('cookies-store',
SettingValue(typ.Bool(), 'true'),
"Whether to store cookies. Note this option needs a restart with "
"QtWebEngine."),
"QtWebEngine on Qt < 5.9."),
('host-block-lists',
SettingValue(