mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Added option to separate http and https proxy configuration.
- also fixed building of akn plugin - closes #314
This commit is contained in:
parent
c7187bf064
commit
c664ea076b
|
@ -31,10 +31,18 @@ void NetworkProxyFactory::loadSettings()
|
|||
settings.beginGroup("Web-Proxy");
|
||||
m_proxyPreference = ProxyPreference(settings.value("UseProxy", SystemProxy).toInt());
|
||||
m_proxyType = QNetworkProxy::ProxyType(settings.value("ProxyType", QNetworkProxy::HttpProxy).toInt());
|
||||
m_useDifferentProxyForHttps = settings.value("UseDifferentProxyForHttps", false).toBool();
|
||||
|
||||
m_hostName = settings.value("HostName", "").toString();
|
||||
m_port = settings.value("Port", 8080).toInt();
|
||||
m_username = settings.value("Username", "").toString();
|
||||
m_password = settings.value("Password", "").toString();
|
||||
|
||||
m_httpsHostName = settings.value("HttpsHostName", "").toString();
|
||||
m_httpsPort = settings.value("HttpsPort", 8080).toInt();
|
||||
m_httpsUsername = settings.value("HttpsUsername", "").toString();
|
||||
m_httpsPassword = settings.value("HttpsPassword", "").toString();
|
||||
|
||||
m_proxyExceptions = settings.value("ProxyExceptions", QStringList() << "localhost" << "127.0.0.1").toStringList();
|
||||
settings.endGroup();
|
||||
}
|
||||
|
@ -44,13 +52,12 @@ QList<QNetworkProxy> NetworkProxyFactory::queryProxy(const QNetworkProxyQuery &q
|
|||
QNetworkProxy proxy;
|
||||
|
||||
if (m_proxyExceptions.contains(query.url().host(), Qt::CaseInsensitive)) {
|
||||
proxy.setType(QNetworkProxy::NoProxy);
|
||||
return QList<QNetworkProxy>() << QNetworkProxy::NoProxy;
|
||||
}
|
||||
|
||||
switch (m_proxyPreference) {
|
||||
case SystemProxy:
|
||||
return systemProxyForQuery(query);
|
||||
break;
|
||||
|
||||
case NoProxy:
|
||||
proxy.setType(QNetworkProxy::NoProxy);
|
||||
|
@ -58,10 +65,28 @@ QList<QNetworkProxy> NetworkProxyFactory::queryProxy(const QNetworkProxyQuery &q
|
|||
|
||||
case DefinedProxy:
|
||||
proxy.setType(m_proxyType);
|
||||
proxy.setHostName(m_hostName);
|
||||
proxy.setPort(m_port);
|
||||
proxy.setUser(m_username);
|
||||
proxy.setPassword(m_password);
|
||||
|
||||
if (m_useDifferentProxyForHttps && query.url().scheme() == "https") {
|
||||
proxy.setHostName(m_httpsHostName);
|
||||
proxy.setPort(m_httpsPort);
|
||||
proxy.setUser(m_httpsUsername);
|
||||
proxy.setPassword(m_httpsPassword);
|
||||
}
|
||||
else {
|
||||
proxy.setHostName(m_hostName);
|
||||
proxy.setPort(m_port);
|
||||
proxy.setUser(m_username);
|
||||
proxy.setPassword(m_password);
|
||||
}
|
||||
|
||||
if (proxy.hostName().isEmpty()) {
|
||||
proxy = QNetworkProxy::NoProxy;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
qWarning("NetworkProxyFactory::queryProxy Unknown proxy type!");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,11 +36,19 @@ public:
|
|||
private:
|
||||
ProxyPreference m_proxyPreference;
|
||||
QNetworkProxy::ProxyType m_proxyType;
|
||||
|
||||
QString m_hostName;
|
||||
quint16 m_port;
|
||||
QString m_username;
|
||||
QString m_password;
|
||||
|
||||
QString m_httpsHostName;
|
||||
quint16 m_httpsPort;
|
||||
QString m_httpsUsername;
|
||||
QString m_httpsPassword;
|
||||
|
||||
QStringList m_proxyExceptions;
|
||||
bool m_useDifferentProxyForHttps;
|
||||
};
|
||||
|
||||
#endif // NETWORKPROXYFACTORY_H
|
||||
|
|
|
@ -373,16 +373,14 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
|||
ui->languages->addItem(language + ", " + country + " (" + loc + ")", name);
|
||||
}
|
||||
|
||||
//Proxy Config
|
||||
// Proxy Configuration
|
||||
settings.beginGroup("Web-Proxy");
|
||||
NetworkProxyFactory::ProxyPreference proxyPreference = NetworkProxyFactory::ProxyPreference(settings.value("UseProxy", NetworkProxyFactory::SystemProxy).toInt());
|
||||
QNetworkProxy::ProxyType proxyType = QNetworkProxy::ProxyType(settings.value("ProxyType", QNetworkProxy::HttpProxy).toInt());
|
||||
|
||||
connect(ui->manualProxy, SIGNAL(toggled(bool)), this, SLOT(setManualProxyConfigurationEnabled(bool)));
|
||||
ui->systemProxy->setChecked(proxyPreference == NetworkProxyFactory::SystemProxy);
|
||||
ui->noProxy->setChecked(proxyPreference == NetworkProxyFactory::NoProxy);
|
||||
ui->manualProxy->setChecked(proxyPreference == NetworkProxyFactory::DefinedProxy);
|
||||
setManualProxyConfigurationEnabled(proxyPreference == NetworkProxyFactory::DefinedProxy);
|
||||
if (proxyType == QNetworkProxy::HttpProxy) {
|
||||
ui->proxyType->setCurrentIndex(0);
|
||||
}
|
||||
|
@ -394,9 +392,22 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
|||
ui->proxyPort->setText(settings.value("Port", 8080).toString());
|
||||
ui->proxyUsername->setText(settings.value("Username", "").toString());
|
||||
ui->proxyPassword->setText(settings.value("Password", "").toString());
|
||||
|
||||
ui->useHttpsProxy->setChecked(settings.value("UseDifferentProxyForHttps", false).toBool());
|
||||
ui->httpsProxyServer->setText(settings.value("HttpsHostName", "").toString());
|
||||
ui->httpsProxyPort->setText(settings.value("HttpsPort", 8080).toString());
|
||||
ui->httpsProxyUsername->setText(settings.value("HttpsUsername", "").toString());
|
||||
ui->httpsProxyPassword->setText(settings.value("HttpsPassword", "").toString());
|
||||
|
||||
ui->proxyExceptions->setText(settings.value("ProxyExceptions", QStringList() << "localhost" << "127.0.0.1").toStringList().join(","));
|
||||
settings.endGroup();
|
||||
|
||||
useDifferentProxyForHttpsChanged(ui->useHttpsProxy->isChecked());
|
||||
setManualProxyConfigurationEnabled(proxyPreference == NetworkProxyFactory::DefinedProxy);
|
||||
|
||||
connect(ui->manualProxy, SIGNAL(toggled(bool)), this, SLOT(setManualProxyConfigurationEnabled(bool)));
|
||||
connect(ui->useHttpsProxy, SIGNAL(toggled(bool)), this, SLOT(useDifferentProxyForHttpsChanged(bool)));
|
||||
|
||||
//CONNECTS
|
||||
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
|
||||
connect(ui->cookieManagerBut, SIGNAL(clicked()), this, SLOT(showCookieManager()));
|
||||
|
@ -533,7 +544,10 @@ void Preferences::setManualProxyConfigurationEnabled(bool state)
|
|||
ui->proxyPort->setEnabled(state);
|
||||
ui->proxyUsername->setEnabled(state);
|
||||
ui->proxyPassword->setEnabled(state);
|
||||
ui->proxyExceptions->setEnabled(state);
|
||||
|
||||
useDifferentProxyForHttpsChanged(state ? ui->useHttpsProxy->isChecked() : false);
|
||||
|
||||
ui->useHttpsProxy->setEnabled(state);
|
||||
}
|
||||
|
||||
void Preferences::allowJavaScriptChanged(bool state)
|
||||
|
@ -609,6 +623,14 @@ void Preferences::changeUserAgentChanged(bool state)
|
|||
ui->userAgentCombo->setEnabled(state);
|
||||
}
|
||||
|
||||
void Preferences::useDifferentProxyForHttpsChanged(bool state)
|
||||
{
|
||||
ui->httpsProxyServer->setEnabled(state);
|
||||
ui->httpsProxyPort->setEnabled(state);
|
||||
ui->httpsProxyUsername->setEnabled(state);
|
||||
ui->httpsProxyPassword->setEnabled(state);
|
||||
}
|
||||
|
||||
void Preferences::showPassManager(bool state)
|
||||
{
|
||||
m_autoFillManager->setVisible(state);
|
||||
|
@ -870,6 +892,13 @@ void Preferences::saveSettings()
|
|||
settings.setValue("Port", ui->proxyPort->text().toInt());
|
||||
settings.setValue("Username", ui->proxyUsername->text());
|
||||
settings.setValue("Password", ui->proxyPassword->text());
|
||||
|
||||
settings.setValue("UseDifferentProxyForHttps", ui->useHttpsProxy->isChecked());
|
||||
settings.setValue("HttpsHostName", ui->httpsProxyServer->text());
|
||||
settings.setValue("HttpsPort", ui->httpsProxyPort->text());
|
||||
settings.setValue("HttpsUsername", ui->httpsProxyUsername->text());
|
||||
settings.setValue("HttpsPassword", ui->httpsProxyPassword->text());
|
||||
|
||||
settings.setValue("ProxyExceptions", ui->proxyExceptions->text().split(","));
|
||||
settings.endGroup();
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ private slots:
|
|||
void setManualProxyConfigurationEnabled(bool state);
|
||||
void useExternalDownManagerChanged(bool state);
|
||||
void changeUserAgentChanged(bool state);
|
||||
void useDifferentProxyForHttpsChanged(bool state);
|
||||
|
||||
void cacheValueChanged(int value);
|
||||
void pageCacheValueChanged(int value);
|
||||
|
|
|
@ -1178,7 +1178,7 @@
|
|||
<item row="5" column="2">
|
||||
<widget class="QLineEdit" name="proxyPassword"/>
|
||||
</item>
|
||||
<item row="6" column="2" colspan="2">
|
||||
<item row="11" column="2" colspan="2">
|
||||
<widget class="QLineEdit" name="proxyExceptions"/>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
|
@ -1194,7 +1194,7 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="11" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_40">
|
||||
<property name="text">
|
||||
<string>Don't use on:</string>
|
||||
|
@ -1238,6 +1238,71 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="4">
|
||||
<widget class="QLabel" name="label_54">
|
||||
<property name="text">
|
||||
<string><b>Exceptions</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="label_55">
|
||||
<property name="text">
|
||||
<string>Server:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="label_56">
|
||||
<property name="text">
|
||||
<string>Username:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="label_57">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QLineEdit" name="httpsProxyUsername"/>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QLineEdit" name="httpsProxyPassword"/>
|
||||
</item>
|
||||
<item row="7" column="2" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="httpsProxyServer"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_58">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="httpsProxyPort">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="useHttpsProxy">
|
||||
<property name="text">
|
||||
<string>Use different proxy for https connection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
|
|
|
@ -510,6 +510,9 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
|
|||
case QNetworkReply::ContentNotFoundError:
|
||||
errorString = tr("Content not found");
|
||||
break;
|
||||
case QNetworkReply::UnknownNetworkError:
|
||||
errorString = exOption->errorString.isEmpty() ? tr("Unknown network error") : exOption->errorString;
|
||||
break;
|
||||
case QNetworkReply::ContentAccessDenied:
|
||||
if (exOption->errorString.startsWith("AdBlockRule")) {
|
||||
if (exOption->frame != erPage->mainFrame()) { //Content in <iframe>
|
||||
|
@ -557,7 +560,7 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
|
|||
errorString = tr("Content Access Denied");
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Content error: " << exOption->errorString;
|
||||
qDebug() << "Content error: " << exOption->errorString << exOption->error;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "akn_plugin.h"
|
||||
#include "akn_handler.h"
|
||||
#include "akn_settings.h"
|
||||
#include "mainapplication.h
|
||||
#include "mainapplication.h"
|
||||
#include "pluginproxy.h"
|
||||
#include "qupzilla.h"
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user