diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp index fb94d55..76bea0c 100644 --- a/WebKit/qt/Api/qwebsettings.cpp +++ b/WebKit/qt/Api/qwebsettings.cpp @@ -57,6 +57,8 @@ public: QString localStorageDatabasePath; QString offlineWebApplicationCachePath; qint64 offlineStorageDefaultQuota; + QString applicationCachePath; + qint64 applicationCacheQuota; void apply(); WebCore::Settings* settings; @@ -358,7 +360,6 @@ QWebSettings::QWebSettings() d->attributes.insert(QWebSettings::LocalStorageDatabaseEnabled, true); d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, true); d->offlineStorageDefaultQuota = 5 * 1024 * 1024; - } /*! @@ -785,10 +786,17 @@ qint64 QWebSettings::offlineStorageDefaultQuota() } /* - \internal + \since 4.6 \relates QWebSettings - Sets the path for HTML5 offline web application cache storage to \a path. + Sets the path for HTML5 web application cache storage to \a path. + An application cache acts like an HTTP cache in some sense. For documents + that use the application cache via JavaScript, the loader mechinery will + first ask the application cache for the contents, before hitting the + network. + + The feature is described in details at: + http://dev.w3.org/html5/spec/Overview.html#appcache \a path must point to an existing directory where the cache is stored. @@ -796,7 +804,7 @@ qint64 QWebSettings::offlineStorageDefaultQuota() \sa offlineWebApplicationCachePath() */ -void QWEBKIT_EXPORT qt_websettings_setOfflineWebApplicationCachePath(const QString& path) +void QWebSettings::setWebApplicationCachePath(const QString& path) { #if ENABLE(OFFLINE_WEB_APPLICATIONS) WebCore::cacheStorage().setCacheDirectory(path); @@ -804,15 +812,15 @@ void QWEBKIT_EXPORT qt_websettings_setOfflineWebApplicationCachePath(const QStri } /* - \internal + \since 4.6 \relates QWebSettings - Returns the path of the HTML5 offline web application cache storage + Returns the path of the HTML5 web application cache storage or an empty string if the feature is disabled. - \sa setOfflineWebApplicationCachePath() + \sa setWebApplicationCachePath() */ -QString QWEBKIT_EXPORT qt_websettings_offlineWebApplicationCachePath() +QString QWebSettings::webApplicationCachePath() { #if ENABLE(OFFLINE_WEB_APPLICATIONS) return WebCore::cacheStorage().cacheDirectory(); @@ -821,6 +829,33 @@ QString QWEBKIT_EXPORT qt_websettings_offlineWebApplicationCachePath() #endif } +/*! + \since 4.6 + + Sets the value of the quota for the application cache in + to \a maximumSize. +*/ +void QWebSettings::setApplicationCacheQuota(qint64 maximumSize) +{ +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + WebCore::cacheStorage().setMaximumSize(maximumSize); +#endif +} + +/*! + \since 4.6 + + Returns the value of the quota for the application cache. +*/ +qint64 QWebSettings::applicationCacheQuota() +{ +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + return WebCore::cacheStorage().maximumSize(); +#else + return 0; +#endif +} + /* \since 4.5 \relates QWebSettings diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h index 63144cb..75641e8 100644 --- a/WebKit/qt/Api/qwebsettings.h +++ b/WebKit/qt/Api/qwebsettings.h @@ -114,6 +114,11 @@ public: static void setOfflineStorageDefaultQuota(qint64 maximumSize); static qint64 offlineStorageDefaultQuota(); + static void setWebApplicationCachePath(const QString& path); + static QString webApplicationCachePath(); + static void setApplicationCacheQuota(qint64 maximumSize); + static qint64 applicationCacheQuota(); + static void clearMemoryCaches(); inline QWebSettingsPrivate* handle() const { return d; }