From c69672365023d3dfb5739d104fcb98af8b44f60a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 6 Jun 2017 14:16:19 +0200 Subject: [PATCH] Merge storage -> offline-storage-database into local-storage setting Looks like it's the same with QtWebEngine too - setting LocalStorageEnabled also toggles WebSQL there. --- CHANGELOG.asciidoc | 1 + doc/help/settings.asciidoc | 18 ++---------------- qutebrowser/browser/webkit/webkitsettings.py | 5 ++--- qutebrowser/config/config.py | 1 + qutebrowser/config/configdata.py | 8 +------- qutebrowser/config/websettings.py | 13 +++++++------ 6 files changed, 14 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index a31359046..5a565e986 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -96,6 +96,7 @@ Changed - `storage -> offline-web-application-cache-quota` (defaults to no quota) - `storage -> object-cache-capacities` (default depends on disk space) - `content -> css-regions` (now always turned off) + - `storage -> offline-storage-database` (merged into `storage -> local-storage`) Fixed diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 5cb1742f6..18e205064 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -145,9 +145,8 @@ |<>|Whether to prompt the user for the download location. |<>|Whether to remember the last used download directory. |<>|The maximum number of pages to hold in the global memory page cache. -|<>|Whether support for the HTML 5 offline storage feature is enabled. |<>|Whether support for the HTML 5 web application cache feature is enabled. -|<>|Whether support for the HTML 5 local storage feature is enabled. +|<>|Whether support for HTML 5 local storage and Web SQL is enabled. |<>|Size of the HTTP network cache. Empty to use the default value. |============== @@ -1320,19 +1319,6 @@ Default: +pass:[0]+ This setting is only available with the QtWebKit backend. -[[storage-offline-storage-database]] -=== offline-storage-database -Whether support for the HTML 5 offline storage feature is enabled. - -Valid values: - - * +true+ - * +false+ - -Default: +pass:[true]+ - -This setting is only available with the QtWebKit backend. - [[storage-offline-web-application-storage]] === offline-web-application-storage Whether support for the HTML 5 web application cache feature is enabled. @@ -1352,7 +1338,7 @@ This setting is only available with the QtWebKit backend. [[storage-local-storage]] === local-storage -Whether support for the HTML 5 local storage feature is enabled. +Whether support for HTML 5 local storage and Web SQL is enabled. Valid values: diff --git a/qutebrowser/browser/webkit/webkitsettings.py b/qutebrowser/browser/webkit/webkitsettings.py index 63bb86d0f..96dc531bc 100644 --- a/qutebrowser/browser/webkit/webkitsettings.py +++ b/qutebrowser/browser/webkit/webkitsettings.py @@ -228,12 +228,11 @@ MAPPINGS = { # Attribute(QWebSettings.TiledBackingStoreEnabled), }, 'storage': { - 'offline-storage-database': - Attribute(QWebSettings.OfflineStorageDatabaseEnabled), 'offline-web-application-storage': Attribute(QWebSettings.OfflineWebApplicationCacheEnabled), 'local-storage': - Attribute(QWebSettings.LocalStorageEnabled), + Attribute(QWebSettings.LocalStorageEnabled, + QWebSettings.OfflineStorageDatabaseEnabled), 'maximum-pages-in-cache': StaticSetter(QWebSettings.setMaximumPagesInCache), }, diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index ae8c2b171..f4f3a4b48 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -409,6 +409,7 @@ class ConfigManager(QObject): ('hints', 'opacity'), ('completion', 'auto-open'), ('storage', 'object-cache-capacities'), + ('storage', 'offline-storage-database'), ('storage', 'offline-storage-default-quota'), ('storage', 'offline-web-application-cache-quota'), ('content', 'css-regions'), diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 321eafcbc..34a755dc6 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -767,12 +767,6 @@ def data(readonly=False): "For more information about the feature, please refer to: " "http://webkit.org/blog/427/webkit-page-cache-i-the-basics/"), - ('offline-storage-database', - SettingValue(typ.Bool(), 'true', - backends=[usertypes.Backend.QtWebKit]), - "Whether support for the HTML 5 offline storage feature is " - "enabled."), - ('offline-web-application-storage', SettingValue(typ.Bool(), 'true', backends=[usertypes.Backend.QtWebKit]), @@ -787,7 +781,7 @@ def data(readonly=False): ('local-storage', SettingValue(typ.Bool(), 'true'), - "Whether support for the HTML 5 local storage feature is " + "Whether support for HTML 5 local storage and Web SQL is " "enabled."), ('cache-size', diff --git a/qutebrowser/config/websettings.py b/qutebrowser/config/websettings.py index 4aab6a220..2e51b0392 100644 --- a/qutebrowser/config/websettings.py +++ b/qutebrowser/config/websettings.py @@ -99,23 +99,24 @@ class Attribute(Base): """A setting set via QWeb(Engine)Settings::setAttribute. Attributes: - self._attribute: A QWeb(Engine)Settings::WebAttribute instance. + self._attributes: A list of QWeb(Engine)Settings::WebAttribute members. """ ENUM_BASE = None - def __init__(self, attribute, default=UNSET): + def __init__(self, *attributes, default=UNSET): super().__init__(default=default) - self._attribute = attribute + self._attributes = list(attributes) def __repr__(self): return utils.get_repr( - self, attribute=debug.qenum_key(self.ENUM_BASE, self._attribute), - constructor=True) + self, attributes=[debug.qenum_key(self.ENUM_BASE, attr) + for attr in self._attributes], constructor=True) def _set(self, value, settings=None): for obj in self._get_settings(settings): - obj.setAttribute(self._attribute, value) + for attribute in self._attributes: + obj.setAttribute(attribute, value) class Setter(Base):