1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Added option to (not) send Referer header to servers.

- also added button to delete html5 storage
This commit is contained in:
nowrep 2012-01-27 23:01:17 +01:00
parent 5bc7bd472c
commit 24ec4e0292
26 changed files with 4031 additions and 3684 deletions

Binary file not shown.

View File

@ -307,8 +307,6 @@ void MainApplication::loadSettings()
bool allowJavaScript = settings.value("allowJavaScript", true).toBool();
bool allowJavaScriptOpenWindow = settings.value("allowJavaScriptOpenWindow", false).toBool();
bool allowJava = settings.value("allowJava", true).toBool();
bool allowPersistentStorage = settings.value("allowPersistentStorage", true).toBool();
bool allowImages = settings.value("autoLoadImages", true).toBool();
bool dnsPrefetch = settings.value("DNS-Prefetch", false).toBool();
bool jsClipboard = settings.value("JavaScriptCanAccessClipboard", true).toBool();
bool linkInFocuschain = settings.value("IncludeLinkInFocusChain", false).toBool();
@ -322,16 +320,12 @@ void MainApplication::loadSettings()
WebPage::UserAgent = settings.value("UserAgent", "").toString();
settings.endGroup();
if (allowPersistentStorage) {
m_websettings->enablePersistentStorage(m_activeProfil);
}
m_websettings->enablePersistentStorage(m_activeProfil);
m_websettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
m_websettings->setAttribute(QWebSettings::PluginsEnabled, allowFlash);
m_websettings->setAttribute(QWebSettings::JavascriptEnabled, allowJavaScript);
m_websettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, allowJavaScriptOpenWindow);
m_websettings->setAttribute(QWebSettings::JavaEnabled, allowJava);
m_websettings->setAttribute(QWebSettings::AutoLoadImages, allowImages);
m_websettings->setAttribute(QWebSettings::DnsPrefetchEnabled, dnsPrefetch);
m_websettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, jsClipboard);
m_websettings->setAttribute(QWebSettings::LinksIncludedInFocusChain, linkInFocuschain);

View File

@ -70,6 +70,7 @@ void NetworkManager::loadSettings()
setCache(m_diskCache);
}
m_doNotTrack = settings.value("DoNotTrack", false).toBool();
m_sendReferer = settings.value("SendReferer", true).toBool();
settings.endGroup();
m_acceptLanguage = AcceptLanguage::generateHeader(settings.value("Language/acceptLanguage", AcceptLanguage::defaultLanguage()).toStringList());
@ -307,6 +308,10 @@ QNetworkReply* NetworkManager::createRequest(QNetworkAccessManager::Operation op
req.setRawHeader("DNT", "1");
}
if (!m_sendReferer) {
req.setRawHeader("Referer", "");
}
req.setRawHeader("Accept-Language", m_acceptLanguage);
//SchemeHandlers

View File

@ -90,6 +90,7 @@ private:
bool m_ignoreAllWarnings;
bool m_doNotTrack;
bool m_sendReferer;
};
#endif // NETWORKMANAGER_H

View File

@ -25,7 +25,7 @@ class WebPage;
class WebPluginFactory : public QWebPluginFactory
{
public:
WebPluginFactory(WebPage *page);
WebPluginFactory(WebPage* page);
virtual QObject* create(const QString &mimeType, const QUrl &url, const QStringList &argumentNames, const QStringList &argumentValues) const;
QList<QWebPluginFactory::Plugin> plugins() const;

View File

@ -177,16 +177,12 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
settings.beginGroup("Web-Browser-Settings");
ui->allowPlugins->setChecked(settings.value("allowFlash", true).toBool());
ui->allowJavaScript->setChecked(settings.value("allowJavaScript", true).toBool());
ui->blockPopup->setChecked(!settings.value("allowJavaScriptOpenWindow", false).toBool());
ui->allowJava->setChecked(settings.value("allowJava", true).toBool());
ui->loadImages->setChecked(settings.value("autoLoadImages", true).toBool());
ui->allowDNSPrefetch->setChecked(settings.value("DNS-Prefetch", false).toBool());
ui->jscanAccessClipboard->setChecked(settings.value("JavaScriptCanAccessClipboard", true).toBool());
ui->linksInFocusChain->setChecked(settings.value("IncludeLinkInFocusChain", false).toBool());
ui->zoomTextOnly->setChecked(settings.value("zoomTextOnly", false).toBool());
ui->printEBackground->setChecked(settings.value("PrintElementBackground", true).toBool());
ui->wheelScroll->setValue(settings.value("wheelScrollLines", qApp->wheelScrollLines()).toInt());
ui->doNotTrack->setChecked(settings.value("DoNotTrack", false).toBool());
ui->defaultZoom->setValue(settings.value("DefaultZoom", 100).toInt());
ui->xssAuditing->setChecked(settings.value("XSSAuditing", false).toBool());
@ -223,9 +219,16 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
}
connect(ui->saveHistory, SIGNAL(toggled(bool)), this, SLOT(saveHistoryChanged(bool)));
// Html5Storage
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)));
// Other
ui->blockPopup->setChecked(!settings.value("allowJavaScriptOpenWindow", false).toBool());
ui->jscanAccessClipboard->setChecked(settings.value("JavaScriptCanAccessClipboard", true).toBool());
ui->doNotTrack->setChecked(settings.value("DoNotTrack", false).toBool());
ui->sendReferer->setChecked(settings.value("SendReferer", true).toBool());
//Cookies
ui->saveCookies->setChecked(settings.value("allowCookies", true).toBool());
@ -360,6 +363,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
connect(ui->cookieManagerBut, SIGNAL(clicked()), this, SLOT(showCookieManager()));
connect(ui->sslManagerButton, SIGNAL(clicked()), this, SLOT(openSslManager()));
connect(ui->preferredLanguages, SIGNAL(clicked()), this, SLOT(showAcceptLanguage()));
connect(ui->deleteHtml5storage, SIGNAL(clicked()), this, SLOT(deleteHtml5storage()));
connect(ui->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(showStackedPage(QListWidgetItem*)));
ui->listWidget->setItemSelected(ui->listWidget->itemAt(5, 5), true);
@ -446,6 +450,16 @@ void Preferences::chooseUserStyleClicked()
ui->userStyleSheet->setText(file);
}
void Preferences::deleteHtml5storage()
{
QString activeProfil = mApp->getActiveProfilPath();
qz_removeDir(activeProfil + "Databases");
qz_removeDir(activeProfil + "LocalStorage");
ui->deleteHtml5storage->setText(tr("Deleted"));
ui->deleteHtml5storage->setEnabled(false);
}
void Preferences::newTabChanged()
{
if (ui->newTab->currentIndex() == 3) {
@ -701,7 +715,6 @@ void Preferences::saveSettings()
settings.setValue("allowJavaScript", ui->allowJavaScript->isChecked());
settings.setValue("allowJavaScriptOpenWindow", !ui->blockPopup->isChecked());
settings.setValue("allowJava", ui->allowJava->isChecked());
settings.setValue("autoLoadImages", ui->loadImages->isChecked());
settings.setValue("DNS-Prefetch", ui->allowDNSPrefetch->isChecked());
settings.setValue("JavaScriptCanAccessClipboard", ui->jscanAccessClipboard->isChecked());
settings.setValue("IncludeLinkInFocusChain", ui->linksInFocusChain->isChecked());
@ -729,6 +742,7 @@ void Preferences::saveSettings()
settings.setValue("deleteHistoryOnClose", ui->deleteHistoryOnClose->isChecked());
settings.setValue("HTML5StorageEnabled", ui->html5storage->isChecked());
settings.setValue("deleteHTML5StorageOnClose", ui->deleteHtml5storageOnClose->isChecked());
settings.setValue("SendReferer", ui->sendReferer->isChecked());
//Cookies
settings.setValue("allowCookies", ui->saveCookies->isChecked());

View File

@ -56,6 +56,7 @@ private slots:
void openSslManager();
void showAcceptLanguage();
void chooseUserStyleClicked();
void deleteHtml5storage();
void allowJavaScriptChanged(bool stat);
void saveHistoryChanged(bool stat);

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>754</width>
<height>483</height>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
@ -31,21 +31,21 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="6" column="1">
<widget class="QLabel" name="version">
<property name="text">
<string>QupZilla</string>
</property>
</widget>
</item>
<item row="4" column="2">
<item row="6" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="5">
<item row="0" column="0" rowspan="7">
<widget class="QListWidget" name="listWidget">
<property name="minimumSize">
<size>
@ -759,105 +759,67 @@
</attribute>
<layout class="QGridLayout" name="gridLayout_18">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="loadImages">
<property name="text">
<string>Load images</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="allowJavaScript">
<property name="text">
<string>Allow JavaScript</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="allowPlugins">
<property name="text">
<string>Allow Plugins (Flash plugin)</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="blockPopup">
<item>
<widget class="QCheckBox" name="allowJavaScript">
<property name="text">
<string>Block PopUp windows</string>
<string>Allow JavaScript</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item>
<widget class="QCheckBox" name="allowJava">
<property name="text">
<string>Allow JAVA</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="allowDNSPrefetch">
<property name="text">
<string>Allow DNS Prefetch</string>
</property>
</widget>
</item>
<item row="5" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<spacer name="horizontalSpacer_28">
<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>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="jscanAccessClipboard">
<property name="text">
<string>JavaScript can access clipboard</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="doNotTrack">
<property name="text">
<string>Send Do Not Track header to servers</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="zoomTextOnly">
<property name="text">
<string>Zoom text only</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="printEBackground">
<property name="text">
<string extracomment="when you are printing page (on printer), it determine whether to also print background (color, image) of html elements">Print element background</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="linksInFocusChain">
<property name="text">
<string extracomment="focus also links on page (basically &lt;a&gt; elements) when pressing Tab key">Include links in focus chain</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<item>
<widget class="QCheckBox" name="xssAuditing">
<property name="text">
<string extracomment="try to detect possible XSS attacks when executing javascript">Enable XSS Auditing</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="allowJava">
<item>
<widget class="QCheckBox" name="printEBackground">
<property name="text">
<string>Allow JAVA</string>
<string extracomment="when you are printing page (on printer), it determine whether to also print background (color, image) of html elements">Print element background</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="linksInFocusChain">
<property name="text">
<string extracomment="focus also links on page (basically &lt;a&gt; elements) when pressing Tab key">Include links in focus chain</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="zoomTextOnly">
<property name="text">
<string>Zoom text only</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="askOnPrivateBrowsing">
<property name="text">
<string>Ask when entering Private Browsing mode</string>
</property>
</widget>
</item>
@ -953,13 +915,6 @@
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="askOnPrivateBrowsing">
<property name="text">
<string>Ask when entering Private Browsing mode</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
@ -1137,6 +1092,19 @@
</property>
</spacer>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="deleteHtml5storage">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Delete now</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
@ -1659,7 +1627,7 @@
</widget>
<widget class="QWidget" name="stackedWidgetPage6">
<layout class="QGridLayout" name="gridLayout_12">
<item row="3" column="0">
<item row="5" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -1764,14 +1732,14 @@
</property>
</spacer>
</item>
<item row="7" column="0" colspan="4">
<item row="6" 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">
<item row="7" column="3">
<widget class="QPushButton" name="sslManagerButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -1784,7 +1752,7 @@
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<item row="7" column="0" colspan="3">
<widget class="QLabel" name="label_49">
<property name="text">
<string>Edit CA certificates in SSL Manager</string>
@ -1794,22 +1762,6 @@
</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">
@ -1823,6 +1775,41 @@
</property>
</spacer>
</item>
<item row="9" column="1" colspan="3">
<widget class="QCheckBox" name="jscanAccessClipboard">
<property name="text">
<string>JavaScript can access clipboard</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="4">
<widget class="QLabel" name="label_50">
<property name="text">
<string>&lt;b&gt;Other&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="11" column="1" colspan="3">
<widget class="QCheckBox" name="doNotTrack">
<property name="text">
<string>Send Do Not Track header to servers</string>
</property>
</widget>
</item>
<item row="12" column="1" colspan="3">
<widget class="QCheckBox" name="sendReferer">
<property name="text">
<string>Send Referer header to servers</string>
</property>
</widget>
</item>
<item row="10" column="1" colspan="3">
<widget class="QCheckBox" name="blockPopup">
<property name="text">
<string>Block popup windows</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -2123,18 +2110,6 @@
<tabstop>addCountryWithAlt</tabstop>
<tabstop>tabWidget</tabstop>
<tabstop>allowPlugins</tabstop>
<tabstop>allowDNSPrefetch</tabstop>
<tabstop>allowJavaScript</tabstop>
<tabstop>allowJava</tabstop>
<tabstop>blockPopup</tabstop>
<tabstop>loadImages</tabstop>
<tabstop>jscanAccessClipboard</tabstop>
<tabstop>doNotTrack</tabstop>
<tabstop>xssAuditing</tabstop>
<tabstop>askOnPrivateBrowsing</tabstop>
<tabstop>printEBackground</tabstop>
<tabstop>zoomTextOnly</tabstop>
<tabstop>linksInFocusChain</tabstop>
<tabstop>wheelScroll</tabstop>
<tabstop>defaultZoom</tabstop>
<tabstop>fontStandard</tabstop>

View File

@ -96,7 +96,7 @@ QUrl WebView::url() const
return returnUrl;
}
void WebView::setPage(QWebPage *page)
void WebView::setPage(QWebPage* page)
{
QWebView::setPage(page);
@ -897,7 +897,7 @@ bool WebView::eventFilter(QObject* obj, QEvent* event)
QTouchEvent::TouchPoint touchPoint;
touchPoint.setState(Qt::TouchPointMoved);
if ((ev->type() == QEvent::MouseButtonPress
|| ev->type() == QEvent::MouseButtonDblClick)) {
|| ev->type() == QEvent::MouseButtonDblClick)) {
touchPoint.setState(Qt::TouchPointPressed);
}
else if (ev->type() == QEvent::MouseButtonRelease) {

View File

@ -39,7 +39,7 @@ public:
QString title() const;
QUrl url() const;
void setPage(QWebPage *page);
void setPage(QWebPage* page);
bool isLoading() const;
int loadProgress() const;

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

@ -1941,7 +1941,7 @@
</message>
<message>
<source>Load images</source>
<translation>Načítať obrázky</translation>
<translation type="obsolete">Načítať obrázky</translation>
</message>
<message>
<source>&lt;b&gt;Font Sizes&lt;/b&gt;</source>
@ -2169,7 +2169,7 @@
</message>
<message>
<source>Block PopUp windows</source>
<translation>Blokovať vyskakovacie okná</translation>
<translation type="obsolete">Blokovať vyskakovacie okná</translation>
</message>
<message>
<source>General</source>
@ -2311,6 +2311,26 @@
<source>Edit CA certificates in SSL Manager</source>
<translation>Upraviť CA Certifikáty v správcovi SSL</translation>
</message>
<message>
<source>Delete now</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&lt;b&gt;Other&lt;/b&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Send Referer header to servers</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Block popup windows</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleted</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