PDA

View Full Version : QWebKit enabling cache



Talei
10th March 2011, 06:13
Hello,
I try to enable caching functionality in QWebKit but can't get it to work entirely. i use this code to enable it:


/** cache */
bool switch_bool = true;
QString cacheDir = QDir::toNativeSeparators( QDir::currentPath() + "/cache" );

quint64 num = 5 * 1024 * 1024;

QWebSettings::globalSettings()->enablePersistentStorage( cacheDir );
QWebSettings::globalSettings()->setMaximumPagesInCache( 3 );
QWebSettings::globalSettings()->setOfflineStorageDefaultQuota(num);
QWebSettings::globalSettings()->setOfflineWebApplicationCacheQuota(num);
QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseE nabled, switch_bool);
QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineWebApplicationCa cheEnabled, switch_bool);
QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled, switch_bool);
QWebSettings::globalSettings()->setOfflineStoragePath(cacheDir);
QWebSettings::globalSettings()->setOfflineWebApplicationCachePath(cacheDir);
QWebSettings::globalSettings()->setLocalStoragePath(cacheDir);
and according to the doc that should do the trick, but ... what I got is only cache for the icons, WebpageIcons.db.
The directory exist (but that doesn't mater because dir. is created automatically if not exists).
I try to use this on webview->settings(), webview->page()->settings() but the end result is the same.

Win Qt 4.7.0 - 4.7.2

Any help is more then welcome
Regards

renajohn
26th April 2011, 17:06
Any progress on enabling the cache?