1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

Added option to Enable/Disable HTML5 local storage + delete it on close.

- also fixed enable/disable history option
This commit is contained in:
nowrep 2012-01-26 18:23:35 +01:00
parent 09ac635faf
commit 0cf13286d2
23 changed files with 3968 additions and 3456 deletions

Binary file not shown.

View File

@ -315,13 +315,13 @@ void MainApplication::loadSettings()
bool zoomTextOnly = settings.value("zoomTextOnly", false).toBool();
bool printElBg = settings.value("PrintElementBackground", true).toBool();
bool xssAuditing = settings.value("XSSAuditing", false).toBool();
bool html5storage = settings.value("HTML5StorageEnabled", true).toBool();
int maxCachedPages = settings.value("maximumCachedPages", 3).toInt();
int scrollingLines = settings.value("wheelScrollLines", wheelScrollLines()).toInt();
QUrl userStyleSheet = QUrl::fromLocalFile(settings.value("userStyleSheet", "").toString());
WebPage::UserAgent = settings.value("UserAgent", "").toString();
settings.endGroup();
m_websettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
m_websettings->setAttribute(QWebSettings::PluginsEnabled, allowFlash);
m_websettings->setAttribute(QWebSettings::JavascriptEnabled, allowJavaScript);
@ -334,6 +334,7 @@ void MainApplication::loadSettings()
m_websettings->setAttribute(QWebSettings::ZoomTextOnly, zoomTextOnly);
m_websettings->setAttribute(QWebSettings::PrintElementBackgrounds, printElBg);
m_websettings->setAttribute(QWebSettings::XSSAuditingEnabled, xssAuditing);
m_websettings->setAttribute(QWebSettings::LocalStorageEnabled, html5storage);
#ifdef USE_WEBGL
m_websettings->setAttribute(QWebSettings::WebGLEnabled, true);
m_websettings->setAttribute(QWebSettings::AcceleratedCompositingEnabled, true);
@ -599,8 +600,11 @@ void MainApplication::saveSettings()
settings.setValue("isCrashed", false);
settings.endGroup();
bool deleteCookies = settings.value("Web-Browser-Settings/deleteCookiesOnClose", false).toBool();
bool deleteHistory = settings.value("Web-Browser-Settings/deleteHistoryOnClose", false).toBool();
settings.beginGroup("Web-Browser-Settings");
bool deleteCookies = settings.value("deleteCookiesOnClose", false).toBool();
bool deleteHistory = settings.value("deleteHistoryOnClose", false).toBool();
bool deleteHtml5Storage = settings.value("deleteHTML5StorageOnClose", false).toBool();
settings.endGroup();
if (deleteCookies) {
m_cookiejar->clearCookies();
@ -608,6 +612,10 @@ void MainApplication::saveSettings()
if (deleteHistory) {
m_historymodel->clearHistory();
}
if (deleteHtml5Storage) {
qz_removeDir(m_activeProfil + "Databases");
qz_removeDir(m_activeProfil + "LocalStorage");
}
m_searchEnginesManager->saveSettings();
m_cookiejar->saveCookies();

View File

@ -50,37 +50,6 @@
#define DEFAULT_USE_NATIVE_DIALOG true
#endif
bool removeFile(const QString &fullFileName)
{
QFile f(fullFileName);
if (f.exists()) {
return f.remove();
}
else {
return false;
}
}
void removeDir(const QString &d)
{
QDir dir(d);
if (dir.exists()) {
const QFileInfoList list = dir.entryInfoList();
QFileInfo fi;
for (int l = 0; l < list.size(); l++) {
fi = list.at(l);
if (fi.isDir() && fi.fileName() != "." && fi.fileName() != "..") {
removeDir(fi.absoluteFilePath());
}
else if (fi.isFile()) {
removeFile(fi.absoluteFilePath());
}
}
dir.rmdir(d);
}
}
Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
: QDialog(parent)
, ui(new Ui::Preferences)
@ -247,13 +216,17 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
//PRIVACY
//Web storage
ui->storeIcons->setChecked(settings.value("allowPersistentStorage", true).toBool());
ui->saveHistory->setChecked(mApp->history()->isSaving());
ui->saveHistory->setChecked(settings.value("allowHistory", true).toBool());
ui->deleteHistoryOnClose->setChecked(settings.value("deleteHistoryOnClose", false).toBool());
if (!ui->saveHistory->isChecked()) {
ui->deleteHistoryOnClose->setEnabled(false);
}
connect(ui->saveHistory, SIGNAL(toggled(bool)), this, SLOT(saveHistoryChanged(bool)));
ui->html5storage->setChecked(settings.value("HTML5StorageEnabled", true).toBool());
ui->deleteHtml5storageOnClose->setChecked(settings.value("deleteHTML5StorageOnClose", false).toBool());
connect(ui->html5storage, SIGNAL(toggled(bool)), this, SLOT(allowHtml5storageChanged(bool)));
//Cookies
ui->saveCookies->setChecked(settings.value("allowCookies", true).toBool());
if (!ui->saveCookies->isChecked()) {
@ -514,6 +487,11 @@ void Preferences::saveCookiesChanged(bool stat)
ui->deleteCookiesOnClose->setEnabled(stat);
}
void Preferences::allowHtml5storageChanged(bool stat)
{
ui->deleteHtml5storageOnClose->setEnabled(stat);
}
void Preferences::showCookieManager()
{
CookieManager* m = new CookieManager();
@ -524,7 +502,6 @@ void Preferences::showCookieManager()
void Preferences::openSslManager()
{
SSLManager* m = new SSLManager(this);
// qz_centerWidgetToParent(m, this);
m->show();
}
@ -613,7 +590,7 @@ void Preferences::deleteProfile()
return;
}
removeDir(mApp->PROFILEDIR + "profiles/" + name);
qz_removeDir(mApp->PROFILEDIR + "profiles/" + name);
ui->startProfile->removeItem(ui->startProfile->currentIndex());
}
@ -748,8 +725,10 @@ void Preferences::saveSettings()
//PRIVACY
//Web storage
settings.setValue("allowPersistentStorage", ui->storeIcons->isChecked());
settings.setValue("allowHistory", ui->saveHistory->isChecked());
settings.setValue("deleteHistoryOnClose", ui->deleteHistoryOnClose->isChecked());
settings.setValue("HTML5StorageEnabled", ui->html5storage->isChecked());
settings.setValue("deleteHTML5StorageOnClose", ui->deleteHtml5storageOnClose->isChecked());
//Cookies
settings.setValue("allowCookies", ui->saveCookies->isChecked());

View File

@ -60,6 +60,7 @@ private slots:
void allowJavaScriptChanged(bool stat);
void saveHistoryChanged(bool stat);
void saveCookiesChanged(bool stat);
void allowHtml5storageChanged(bool stat);
void downLocChanged(bool state);
void allowCacheChanged(bool state);
void showPassManager(bool state);

View File

@ -1099,6 +1099,9 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
@ -1107,8 +1110,22 @@
</property>
</spacer>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="html5storage">
<property name="text">
<string>Allow HTML5 local storage</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="deleteHtml5storageOnClose">
<property name="text">
<string>Delete local storage on close</string>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_23">
<spacer name="horizontalSpacer_21">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -1642,7 +1659,7 @@
</widget>
<widget class="QWidget" name="stackedWidgetPage6">
<layout class="QGridLayout" name="gridLayout_12">
<item row="1" column="0">
<item row="3" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -1667,7 +1684,7 @@
<item row="4" column="1" colspan="2">
<widget class="QCheckBox" name="filterTracking">
<property name="text">
<string>Filter Tracking Cookies</string>
<string>Filter tracking cookies</string>
</property>
</widget>
</item>
@ -1685,19 +1702,6 @@
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1" colspan="3">
<widget class="QCheckBox" name="matchExactly">
<property name="text">
@ -1721,23 +1725,10 @@
</property>
</spacer>
</item>
<item row="2" column="3">
<spacer name="horizontalSpacer_21">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0" colspan="4">
<item row="5" column="0" colspan="4">
<widget class="QLabel" name="label_19">
<property name="text">
<string>&lt;b&gt;Warning:&lt;/b&gt; Match domain exactly and Filter Tracking Cookies options can lead to deny some cookies from sites. If you have problems with cookies, try to disable this options first!</string>
<string>&lt;b&gt;Warning:&lt;/b&gt; Match domain exactly and filter tracking cookies options can lead to deny some cookies from sites. If you have problems with cookies, try to disable this options first!</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@ -1757,7 +1748,30 @@
</property>
</widget>
</item>
<item row="5" column="3">
<item row="2" column="1">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="0" colspan="4">
<widget class="QLabel" name="label_48">
<property name="text">
<string>&lt;b&gt;SSL Certificates&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="8" column="3">
<widget class="QPushButton" name="sslManagerButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -1770,6 +1784,45 @@
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<widget class="QLabel" name="label_49">
<property name="text">
<string>Edit CA certificates in SSL Manager</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0" colspan="4">
<spacer name="verticalSpacer_16">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="3">
<spacer name="horizontalSpacer_22">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
@ -2102,7 +2155,6 @@
<tabstop>matchExactly</tabstop>
<tabstop>filterTracking</tabstop>
<tabstop>cookieManagerBut</tabstop>
<tabstop>sslManagerButton</tabstop>
<tabstop>useOSDNotifications</tabstop>
<tabstop>useNativeSystemNotifications</tabstop>
<tabstop>doNotUseNotifications</tabstop>

View File

@ -71,6 +71,38 @@ void qz_centerWidgetToParent(QWidget* w, QWidget* parent)
w->move(p);
}
bool qz_removeFile(const QString &fullFileName)
{
QFile f(fullFileName);
if (f.exists()) {
return f.remove();
}
else {
return false;
}
}
void qz_removeDir(const QString &d)
{
QDir dir(d);
if (dir.exists()) {
const QFileInfoList list = dir.entryInfoList();
QFileInfo fi;
for (int l = 0; l < list.size(); l++) {
fi = list.at(l);
if (fi.isDir() && fi.fileName() != "." && fi.fileName() != "..") {
qz_removeDir(fi.absoluteFilePath());
}
else if (fi.isFile()) {
qz_removeFile(fi.absoluteFilePath());
}
}
dir.rmdir(d);
}
}
QString qz_samePartOfStrings(const QString &one, const QString &other)
{
int i = 0;

View File

@ -22,6 +22,7 @@
#include <QPixmap>
#include <QBuffer>
#include <QFile>
#include <QDir>
#include <QWidget>
#include <QApplication>
#include <QDesktopWidget>
@ -36,6 +37,9 @@ QByteArray qz_readAllFileContents(const QString &filename);
void qz_centerWidgetOnScreen(QWidget* w);
void qz_centerWidgetToParent(QWidget* w, QWidget* parent);
bool qz_removeFile(const QString &fullFileName);
void qz_removeDir(const QString &d);
QString qz_samePartOfStrings(const QString &one, const QString &other);
QUrl qz_makeRelativeUrl(const QUrl &baseUrl, const QUrl &rUrl);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1744,7 +1744,7 @@
</message>
<message>
<source>Filter Tracking Cookies</source>
<translation>Filtrovať sledovacie cookies</translation>
<translation type="obsolete">Filtrovať sledovacie cookies</translation>
</message>
<message>
<source>Enter the new profile&apos;s name:</source>
@ -1833,7 +1833,7 @@
</message>
<message>
<source>&lt;b&gt;Warning:&lt;/b&gt; Match domain exactly and Filter Tracking Cookies options can lead to deny some cookies from sites. If you have problems with cookies, try to disable this options first!</source>
<translation>&lt;b&gt;Varovanie:&lt;/b&gt; Možnosti požadovanie presnej zhody domény a filtrovať sledovacie cookies môžu viesť k odmietnutiu niektorých cookies zo stránok. Ak máte problémy s cookies, skúste najprv zakázať tieto možnosti!</translation>
<translation type="obsolete">&lt;b&gt;Varovanie:&lt;/b&gt; Možnosti požadovanie presnej zhody domény a filtrovať sledovacie cookies môžu viesť k odmietnutiu niektorých cookies zo stránok. Ak máte problémy s cookies, skúste najprv zakázať tieto možnosti!</translation>
</message>
<message>
<source>Proxy Configuration</source>
@ -2287,6 +2287,30 @@
<source>Use current</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Allow HTML5 local storage</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Delete local storage on close</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Filter tracking cookies</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Warning:&lt;/b&gt; Match domain exactly and filter tracking cookies options can lead to deny some cookies from sites. If you have problems with cookies, try to disable this options first!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;SSL Certificates&lt;/b&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Edit CA certificates in SSL Manager</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff