Permalink
Browse files

Enable localStorage.

Surprisingly, this makes the JS api work, but doesn't actually store
anything.
  • Loading branch information...
1 parent 0640b5e commit e8251c836b88415336853852a3a3c46f0fff4780 @spraints committed Mar 28, 2012
Showing with 7 additions and 0 deletions.
  1. +6 −0 src/WebPage.cpp
  2. +1 −0 src/WebPage.h
View
@@ -4,12 +4,14 @@
#include "NetworkCookieJar.h"
#include "UnsupportedContentHandler.h"
#include <QResource>
+#include <QWebSettings>
#include <iostream>
WebPage::WebPage(QObject *parent) : QWebPage(parent) {
setForwardUnsupportedContent(true);
loadJavascript();
setUserStylesheet();
+ enableLocalStorage();
m_loading = false;
this->setCustomNetworkAccessManager();
@@ -23,6 +25,10 @@ WebPage::WebPage(QObject *parent) : QWebPage(parent) {
this->setViewportSize(QSize(1680, 1050));
}
+void WebPage::enableLocalStorage() {
+ settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
+}
+
void WebPage::setCustomNetworkAccessManager() {
NetworkAccessManager *manager = new NetworkAccessManager();
manager->setCookieJar(new NetworkCookieJar());
View
@@ -49,6 +49,7 @@ class WebPage : public QWebPage {
QString getLastAttachedFileName();
void loadJavascript();
void setUserStylesheet();
+ void enableLocalStorage();
int m_lastStatus;
QString m_pageHeaders;
bool m_ignoreSslErrors;

0 comments on commit e8251c8

Please sign in to comment.