Changeset 47283 in webkit
- Timestamp:
- Aug 14, 2009 7:21:06 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/Api/qwebpage.cpp
r47101 r47283 266 266 } 267 267 268 static QString defaultCachePath() 269 { 270 // Determine the default cache location 271 QString cachePath; 272 273 #if QT_VERSION >= 0x040500 274 cachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation); 275 #else 276 cachePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation); 277 #endif 278 279 if (cachePath.isEmpty()) 280 cachePath = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName(); 281 282 return cachePath; 283 } 284 268 285 static void initializeApplicationCachePathIfNecessary() 269 286 { 270 #if ENABLE(OFFLINE_WEB_APPLICATIONS) 287 271 288 static bool initialized = false; 272 289 273 290 if (initialized) 274 291 return; 275 292 276 // Determine the path for HTML5 Application Cache DB 277 QString appCachePath; 278 #if QT_VERSION >= 0x040500 279 appCachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation); 280 #else 281 appCachePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation); 282 #endif 283 284 if (appCachePath.isEmpty()) 285 appCachePath = QDir::homePath() + QLatin1String("/.") + QCoreApplication::applicationName(); 286 287 WebCore::cacheStorage().setCacheDirectory(appCachePath); 293 // Set HTML5 Application Cache default location 294 QWebSettings::setOfflineWebApplicationCachePath(defaultCachePath()); 295 288 296 initialized = true; 289 #endif290 297 } 291 298 … … 310 317 311 318 settings = new QWebSettings(page->settings()); 319 320 // Set HTML5 localStorage default location 321 settings->setLocalStoragePath(WebCore::pathByAppendingComponent(defaultCachePath(), "LocalStorage")); 312 322 313 323 #ifndef QT_NO_UNDOSTACK -
trunk/WebKit/qt/Api/qwebsettings.cpp
r46975 r47283 56 56 QUrl userStyleSheetLocation; 57 57 QString defaultTextEncoding; 58 QString localStorage DatabasePath;58 QString localStoragePath; 59 59 QString offlineWebApplicationCachePath; 60 60 qint64 offlineStorageDefaultQuota; … … 168 168 settings->setDefaultTextEncodingName(encoding); 169 169 170 QString localStoragePath = !localStorageDatabasePath.isEmpty() ? localStorageDatabasePath : global->localStorageDatabasePath;171 settings->setLocalStorageDatabasePath( localStoragePath);170 QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath; 171 settings->setLocalStorageDatabasePath(storagePath); 172 172 173 173 value = attributes.value(QWebSettings::ZoomTextOnly, … … 187 187 settings->setOfflineWebApplicationCacheEnabled(value); 188 188 189 value = attributes.value(QWebSettings::LocalStorageDatabaseEnabled, 190 global->attributes.value(QWebSettings::LocalStorageDatabaseEnabled)); 189 value = attributes.value(QWebSettings::LocalStorageEnabled, 190 global->attributes.value(QWebSettings::LocalStorageEnabled)); 191 191 192 settings->setLocalStorageEnabled(value); 192 193 … … 327 328 \value OfflineWebApplicationCacheEnabled Specifies whether support for the HTML 5 328 329 web application cache feature is enabled or not. 329 \value LocalStorage DatabaseEnabled Specifies whether support for the HTML 5330 local storage feature is enabled or not. 330 \value LocalStorageEnabled Specifies whether support for the HTML 5 331 local storage feature is enabled or not. Disabled by default. 331 332 \value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are allowed to access remote urls. 332 333 */ … … 357 358 d->attributes.insert(QWebSettings::OfflineStorageDatabaseEnabled, true); 358 359 d->attributes.insert(QWebSettings::OfflineWebApplicationCacheEnabled, true); 359 d->attributes.insert(QWebSettings::LocalStorage DatabaseEnabled, true);360 d->attributes.insert(QWebSettings::LocalStorageEnabled, false); 360 361 d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, true); 361 362 d->offlineStorageDefaultQuota = 5 * 1024 * 1024; … … 868 869 } 869 870 870 /* 871 \since 4. 5871 /*! 872 \since 4.6 872 873 \relates QWebSettings 873 874 874 Sets the path for HTML5 local storage databases to \a path. 875 876 \a path must point to an existing directory where the cache is stored. 877 878 Setting an empty path disables the feature. 879 880 \sa localStorageDatabasePath() 881 */ 882 void QWEBKIT_EXPORT qt_websettings_setLocalStorageDatabasePath(QWebSettings* settings, const QString& path) 883 { 884 QWebSettingsPrivate* d = settings->handle(); 885 d->localStorageDatabasePath = path; 875 Sets the path for HTML5 local storage to \a path. 876 877 For more information on HTML5 local storage see the 878 \l{http://www.w3.org/TR/webstorage/#the-localstorage-attribute}{Web Storage standard}. 879 880 Support for local storage can enabled by setting the 881 \l{QWebSettings::LocalStorageEnabled}{LocalStorageEnabled} attribute. 882 883 \sa localStoragePath() 884 */ 885 void QWebSettings::setLocalStoragePath(const QString& path) 886 { 887 d->localStoragePath = path; 886 888 d->apply(); 887 889 } 888 890 889 /* 890 \since 4. 5891 /*! 892 \since 4.6 891 893 \relates QWebSettings 892 894 893 Returns the path for HTML5 local storage databases 894 or an empty string if the feature is disabled. 895 896 \sa setLocalStorageDatabasePath() 897 */ 898 QString QWEBKIT_EXPORT qt_websettings_localStorageDatabasePath(QWebSettings* settings) 899 { 900 return settings->handle()->localStorageDatabasePath; 895 Returns the path for HTML5 local storage. 896 897 The path is initialized to a directory called LocalStorage under 898 the user-specific cache data location specified by 899 \l{QDesktopServices::CacheLocation}{CacheLocation}. 900 901 \sa setLocalStoragePath() 902 */ 903 QString QWebSettings::localStoragePath() const 904 { 905 return d->localStoragePath; 901 906 } 902 907 -
trunk/WebKit/qt/Api/qwebsettings.h
r46762 r47283 63 63 OfflineStorageDatabaseEnabled, 64 64 OfflineWebApplicationCacheEnabled, 65 LocalStorageDatabaseEnabled, 65 LocalStorageEnabled, 66 #ifdef QT_DEPRECATED 67 LocalStorageDatabaseEnabled = LocalStorageEnabled, 68 #endif 66 69 LocalContentCanAccessRemoteUrls 67 70 }; … … 122 125 static void setOfflineWebApplicationCacheQuota(qint64 maximumSize); 123 126 static qint64 offlineWebApplicationCacheQuota(); 127 128 void setLocalStoragePath(const QString& path); 129 QString localStoragePath() const; 124 130 125 131 static void clearMemoryCaches(); -
trunk/WebKit/qt/ChangeLog
r47282 r47283 1 2009-08-14 Laszlo Gombos <laszlo.1.gombos@nokia.com> 2 3 Reviewed by Simon Hausmann. 4 5 [Qt] Public API to configure the storage path for HTML5 localStorage 6 https://bugs.webkit.org/show_bug.cgi?id=28036 7 8 Disables LocalStorage for QtWebKit by default by setting 9 QWebSettings::LocalStorageEnabled to false. 10 11 Sets up a default for the LocalStorage path so that clients would only 12 need to enable the LocalStorageEnabled setting to turn on LocalStoragre 13 support. 14 15 Turn on LocalStorage support for QtLauncher and the relevant test 16 since LocalStorage is now disabled by default for QtWebkit. 17 18 * Api/qwebpage.cpp: 19 (defaultCachePath): 20 (initializeApplicationCachePathIfNecessary): 21 (QWebPagePrivate::QWebPagePrivate): 22 * Api/qwebsettings.cpp: 23 (QWebSettingsPrivate::apply): 24 (QWebSettings::QWebSettings): 25 (QWebSettings::setLocalStoragePath): 26 (QWebSettings::localStoragePath): 27 * Api/qwebsettings.h: 28 * QtLauncher/main.cpp: 29 (main): 30 * tests/qwebpage/tst_qwebpage.cpp: 31 (tst_QWebPage::multiplePageGroupsAndLocalStorage): 32 1 33 2009-08-14 Yael Aharon <yael.aharon@nokia.com> 2 34 -
trunk/WebKit/qt/QtLauncher/main.cpp
r47156 r47283 444 444 QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true); 445 445 QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); 446 QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled, true); 446 447 447 448 const QStringList args = app.arguments(); -
trunk/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
r47282 r47283 629 629 void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName); 630 630 QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page); 631 void QWEBKIT_EXPORT qt_websettings_setLocalStorageDatabasePath(QWebSettings* settings, const QString& path);632 631 633 632 void tst_QWebPage::multiplePageGroupsAndLocalStorage() … … 640 639 QWebView view2; 641 640 642 qt_websettings_setLocalStorageDatabasePath(view1.page()->settings(), QDir::toNativeSeparators(QDir::currentPath() + "/path1")); 641 view1.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); 642 view1.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path1")); 643 643 qt_webpage_setGroupName(view1.page(), "group1"); 644 qt_websettings_setLocalStorageDatabasePath(view2.page()->settings(), QDir::toNativeSeparators(QDir::currentPath() + "/path2")); 644 view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); 645 view2.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(QDir::currentPath() + "/path2")); 645 646 qt_webpage_setGroupName(view2.page(), "group2"); 646 647 QCOMPARE(qt_webpage_groupName(view1.page()), QString("group1")); -
trunk/WebKitTools/ChangeLog
r47280 r47283 1 2009-08-14 Laszlo Gombos <laszlo.1.gombos@nokia.com> 2 3 Reviewed by Simon Hausmann. 4 5 [Qt] Public API to configure the storage path for HTML5 localStorage 6 https://bugs.webkit.org/show_bug.cgi?id=28036 7 8 Turn on LocalStorage support for Qt DumpRenderTree since 9 LocalStorage is now disabled by defult for QtWebkit. 10 11 * DumpRenderTree/qt/DumpRenderTree.cpp: 12 (WebCore::WebPage::WebPage): 13 1 14 2009-08-14 Xan Lopez <xlopez@igalia.com> 2 15 -
trunk/WebKitTools/DumpRenderTree/qt/DumpRenderTree.cpp
r46905 r47283 110 110 settings()->setAttribute(QWebSettings::LinksIncludedInFocusChain, false); 111 111 settings()->setAttribute(QWebSettings::PluginsEnabled, true); 112 settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); 112 113 connect(this, SIGNAL(geometryChangeRequested(const QRect &)), 113 114 this, SLOT(setViewGeometry(const QRect & )));
Note: See TracChangeset
for help on using the changeset viewer.