Bring back some default web page settings.

1.2
Ariya Hidayat 2011-05-26 00:27:55 -07:00
parent 414a46e921
commit 9a2fd4b361
2 changed files with 15 additions and 13 deletions

View File

@ -160,19 +160,6 @@ Phantom::Phantom(QObject *parent)
m_page->settings()->setAttribute(QWebSettings::AutoLoadImages, autoLoadImages);
m_page->settings()->setAttribute(QWebSettings::PluginsEnabled, pluginsEnabled);
m_page->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
m_page->settings()->setOfflineStoragePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
m_page->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
m_page->settings()->setAttribute(QWebSettings::FrameFlatteningEnabled, true);
#endif
#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
m_page->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
m_page->settings()->setLocalStoragePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
#endif
#endif
m_page->mainFrame()->addToJavaScriptWindowObject("phantom", this);

View File

@ -34,6 +34,7 @@
#include <math.h>
#include <QApplication>
#include <QDesktopServices>
#include <QDir>
#include <QFileInfo>
#include <QPainter>
@ -98,6 +99,20 @@ WebPage::WebPage(QObject *parent)
m_mainFrame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
m_mainFrame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
m_webPage->settings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
m_webPage->settings()->setOfflineStoragePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
m_webPage->settings()->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, true);
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
m_webPage->settings()->setAttribute(QWebSettings::FrameFlatteningEnabled, true);
#endif
#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
m_webPage->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
m_webPage->settings()->setLocalStoragePath(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
#endif
// Ensure we have at least document.body.
m_mainFrame->setHtml("<html><body></body></html>");