Partially revert moving webkit settings
This commit is contained in:
parent
4af58d39ed
commit
39976f543b
@ -124,15 +124,9 @@ class WebKitSettings(websettings.AbstractSettings):
|
|||||||
"""Set the generated user-stylesheet."""
|
"""Set the generated user-stylesheet."""
|
||||||
stylesheet = shared.get_user_stylesheet().encode('utf-8')
|
stylesheet = shared.get_user_stylesheet().encode('utf-8')
|
||||||
url = urlutils.data_url('text/css;charset=utf-8', stylesheet)
|
url = urlutils.data_url('text/css;charset=utf-8', stylesheet)
|
||||||
old = self._settings.userStyleSheetUrl()
|
|
||||||
|
|
||||||
if old == url:
|
|
||||||
return False
|
|
||||||
|
|
||||||
self._settings.setUserStyleSheetUrl(url)
|
self._settings.setUserStyleSheetUrl(url)
|
||||||
return True
|
|
||||||
|
|
||||||
def _set_cookie_accept_policy(self, value):
|
def _set_cookie_accept_policy(self):
|
||||||
"""Update the content.cookies.accept setting."""
|
"""Update the content.cookies.accept setting."""
|
||||||
mapping = {
|
mapping = {
|
||||||
'all': QWebSettings.AlwaysAllowThirdPartyCookies,
|
'all': QWebSettings.AlwaysAllowThirdPartyCookies,
|
||||||
@ -140,41 +134,29 @@ class WebKitSettings(websettings.AbstractSettings):
|
|||||||
'never': QWebSettings.AlwaysBlockThirdPartyCookies,
|
'never': QWebSettings.AlwaysBlockThirdPartyCookies,
|
||||||
'no-unknown-3rdparty': QWebSettings.AllowThirdPartyWithExistingCookies,
|
'no-unknown-3rdparty': QWebSettings.AllowThirdPartyWithExistingCookies,
|
||||||
}
|
}
|
||||||
|
value = config.val.content.cookies.accept
|
||||||
|
self._settings.setThirdPartyCookiePolicy(mapping[value])
|
||||||
|
|
||||||
old = self._settings.thirdPartyCookiePolicy()
|
def _set_cache_maximum_pages(self):
|
||||||
new = mapping[value]
|
|
||||||
|
|
||||||
if old == new:
|
|
||||||
return False
|
|
||||||
|
|
||||||
self._settings.setThirdPartyCookiePolicy(new)
|
|
||||||
return True
|
|
||||||
|
|
||||||
def _set_cache_maximum_pages(self, value):
|
|
||||||
"""Update the content.cache.maximum_pages setting."""
|
"""Update the content.cache.maximum_pages setting."""
|
||||||
old = self._settings.maximumPagesInCache()
|
value = config.val.content.cache.maximum_pages
|
||||||
|
|
||||||
if old == value:
|
|
||||||
return False
|
|
||||||
|
|
||||||
self._settings.setMaximumPagesInCache(value)
|
self._settings.setMaximumPagesInCache(value)
|
||||||
return True
|
|
||||||
|
|
||||||
def _update_setting(self, option, value):
|
def update_setting(self, option):
|
||||||
if option in ['scrollbar.hide', 'content.user_stylesheets']:
|
if option in ['scrollbar.hide', 'content.user_stylesheets']:
|
||||||
return self._set_user_stylesheet()
|
self._set_user_stylesheet()
|
||||||
elif option == 'content.cookies.accept':
|
elif option == 'content.cookies.accept':
|
||||||
return self._set_cookie_accept_policy(value)
|
self._set_cookie_accept_policy()
|
||||||
elif option == 'content.cache.maximum_pages':
|
elif option == 'content.cache.maximum_pages':
|
||||||
return self._set_cache_maximum_pages(value)
|
self._set_cache_maximum_pages()
|
||||||
else:
|
else:
|
||||||
return super()._update_setting(option, value)
|
super().update_setting(option)
|
||||||
|
|
||||||
def init_settings(self):
|
def init_settings(self):
|
||||||
super().init_settings()
|
super().init_settings()
|
||||||
self.update_setting('content.user_stylesheets')
|
self._set_user_stylesheet()
|
||||||
self.update_setting('content.cookies.accept')
|
self._set_cookie_accept_policy()
|
||||||
self.update_setting('content.cache.maximum_pages')
|
self._set_cache_maximum_pages()
|
||||||
|
|
||||||
|
|
||||||
def init(_args):
|
def init(_args):
|
||||||
|
Loading…
Reference in New Issue
Block a user