diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-01-16 16:34:49 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-16 23:32:23 +0100 |
commit | cf3e6a6af1bffc04a138cfa8b7adc8aed8f4e105 (patch) | |
tree | 4b9c04ee37b3f5517e4a9b34a4158f8cdc2619c3 /Source/WebKit/qt/Api/qwebsettings.cpp | |
parent | 1ca1ca150c8a362980bb11123d416ff136da155c (diff) | |
download | qtwebkit-cf3e6a6af1bffc04a138cfa8b7adc8aed8f4e105.tar.gz |
Make indexed database follow Qt web settings if enabled
Forwards the websettings for offline database storage which so far
has been used for web SQL database to indexed database.
Note that this does not add new API and does not make it possible to
control web sql database and indexed database separately.
The patch also adds a config test for leveldb which indexed db requires.
Change-Id: I8808356c9910848c43c5f47e6279a1c632f17ad1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebKit/qt/Api/qwebsettings.cpp')
-rw-r--r-- | Source/WebKit/qt/Api/qwebsettings.cpp | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index 242404055..f8e4d42ed 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -28,6 +28,7 @@ #include "FileSystem.h" #include "FontCache.h" #include "GCController.h" +#include "GroupSettings.h" #include "IconDatabase.h" #include "Image.h" #if ENABLE(ICONDATABASE) @@ -67,8 +68,10 @@ QWEBKIT_EXPORT void qt_networkAccessAllowed(bool isAllowed) class QWebSettingsPrivate { public: - QWebSettingsPrivate(WebCore::Settings* wcSettings = 0) - : settings(wcSettings) + QWebSettingsPrivate(WebCore::Settings* wcSettings = 0, WebCore::GroupSettings* wcGroupSettings = 0) + : offlineStorageDefaultQuota(0) + , settings(wcSettings) + , groupSettings(wcGroupSettings) { } @@ -79,11 +82,13 @@ public: QString defaultTextEncoding; QString localStoragePath; QString offlineWebApplicationCachePath; + QString offlineDatabasePath; QString mediaType; qint64 offlineStorageDefaultQuota; QWebSettings::ThirdPartyCookiePolicy thirdPartyCookiePolicy; void apply(); WebCore::Settings* settings; + WebCore::GroupSettings* groupSettings; }; Q_GLOBAL_STATIC(QList<QWebSettingsPrivate*>, allSettings); @@ -237,12 +242,23 @@ void QWebSettingsPrivate::apply() global->attributes.value(QWebSettings::PrintElementBackgrounds)); settings->setShouldPrintBackgrounds(value); -#if ENABLE(SQL_DATABASE) value = attributes.value(QWebSettings::OfflineStorageDatabaseEnabled, global->attributes.value(QWebSettings::OfflineStorageDatabaseEnabled)); +#if ENABLE(SQL_DATABASE) WebCore::DatabaseManager::manager().setIsAvailable(value); #endif +#if ENABLE(INDEXED_DATABASE) + QString path = !offlineDatabasePath.isEmpty() ? offlineDatabasePath : global->offlineDatabasePath; + Q_ASSERT(groupSettings); + // Setting the path to empty string disables persistent storage of the indexed database. + if (!value) + path = QString(); + groupSettings->setIndexedDBDatabasePath(path); + qint64 quota = offlineStorageDefaultQuota ? offlineStorageDefaultQuota : global->offlineStorageDefaultQuota; + groupSettings->setIndexedDBQuotaBytes(quota); +#endif + value = attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled, global->attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled)); settings->setOfflineWebApplicationCacheEnabled(value); @@ -564,10 +580,9 @@ QWebSettings::QWebSettings() /*! \internal */ -QWebSettings::QWebSettings(WebCore::Settings* settings) - : d(new QWebSettingsPrivate(settings)) +QWebSettings::QWebSettings(WebCore::Settings* settings, WebCore::GroupSettings* groupSettings) + : d(new QWebSettingsPrivate(settings, groupSettings)) { - d->settings = settings; d->apply(); allSettings()->append(d); } @@ -1050,6 +1065,7 @@ void QWebSettings::resetAttribute(WebAttribute attr) void QWebSettings::setOfflineStoragePath(const QString& path) { WebCore::initializeWebCoreQt(); + QWebSettings::globalSettings()->d->offlineDatabasePath = path; #if ENABLE(SQL_DATABASE) WebCore::DatabaseManager::manager().setDatabaseDirectoryPath(path); #endif @@ -1066,11 +1082,7 @@ void QWebSettings::setOfflineStoragePath(const QString& path) QString QWebSettings::offlineStoragePath() { WebCore::initializeWebCoreQt(); -#if ENABLE(SQL_DATABASE) - return WebCore::DatabaseManager::manager().databaseDirectoryPath(); -#else - return QString(); -#endif + return QWebSettings::globalSettings()->d->offlineDatabasePath; } /*! @@ -1184,7 +1196,7 @@ void QWebSettings::setLocalStoragePath(const QString& path) \since 4.6 Returns the path for HTML5 local storage. - + \sa setLocalStoragePath() */ QString QWebSettings::localStoragePath() const |