mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
parent
44999080eb
commit
52918db06a
@ -238,13 +238,28 @@ void NetworkManager::loadSettings()
|
||||
|
||||
QNetworkProxy proxy;
|
||||
settings.beginGroup("Web-Proxy");
|
||||
proxy.setType(QNetworkProxy::ProxyType(settings.value("ProxyType", QNetworkProxy::NoProxy).toInt()));
|
||||
const int proxyType = settings.value("ProxyType", 2).toInt();
|
||||
proxy.setHostName(settings.value("HostName", QString()).toString());
|
||||
proxy.setPort(settings.value("Port", 8080).toInt());
|
||||
proxy.setUser(settings.value("Username", QString()).toString());
|
||||
proxy.setPassword(settings.value("Password", QString()).toString());
|
||||
settings.endGroup();
|
||||
|
||||
if (proxyType == 0) {
|
||||
proxy.setType(QNetworkProxy::NoProxy);
|
||||
} else if (proxyType == 3) {
|
||||
proxy.setType(QNetworkProxy::HttpProxy);
|
||||
} else if (proxyType == 4) {
|
||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||
}
|
||||
|
||||
if (proxyType == 2) {
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy());
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
} else {
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
}
|
||||
|
||||
m_urlInterceptor->loadSettings();
|
||||
}
|
||||
|
@ -498,15 +498,17 @@ Preferences::Preferences(BrowserWindow* window)
|
||||
|
||||
// Proxy Configuration
|
||||
settings.beginGroup("Web-Proxy");
|
||||
QNetworkProxy::ProxyType proxyType = QNetworkProxy::ProxyType(settings.value("ProxyType", QNetworkProxy::NoProxy).toInt());
|
||||
|
||||
ui->systemProxy->setChecked(proxyType == QNetworkProxy::NoProxy);
|
||||
ui->manualProxy->setChecked(proxyType != QNetworkProxy::NoProxy);
|
||||
if (proxyType == QNetworkProxy::Socks5Proxy) {
|
||||
ui->proxyType->setCurrentIndex(1);
|
||||
}
|
||||
else {
|
||||
int proxyType = settings.value("ProxyType", 1).toInt();
|
||||
if (proxyType == 0) {
|
||||
ui->noProxy->setChecked(true);
|
||||
} else if (proxyType == 2) {
|
||||
ui->systemProxy->setChecked(true);
|
||||
} else if (proxyType == 3) {
|
||||
ui->manualProxy->setChecked(true);
|
||||
ui->proxyType->setCurrentIndex(0);
|
||||
} else {
|
||||
ui->manualProxy->setChecked(true);
|
||||
ui->proxyType->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
ui->proxyServer->setText(settings.value("HostName", "").toString());
|
||||
@ -515,8 +517,7 @@ Preferences::Preferences(BrowserWindow* window)
|
||||
ui->proxyPassword->setText(settings.value("Password", "").toString());
|
||||
settings.endGroup();
|
||||
|
||||
setManualProxyConfigurationEnabled(proxyType != QNetworkProxy::NoProxy);
|
||||
|
||||
setManualProxyConfigurationEnabled(ui->manualProxy->isChecked());
|
||||
connect(ui->manualProxy, SIGNAL(toggled(bool)), this, SLOT(setManualProxyConfigurationEnabled(bool)));
|
||||
|
||||
//CONNECTS
|
||||
@ -1046,15 +1047,15 @@ void Preferences::saveSettings()
|
||||
settings.endGroup();
|
||||
|
||||
//Proxy Configuration
|
||||
QNetworkProxy::ProxyType proxyType;
|
||||
if (ui->systemProxy->isChecked()) {
|
||||
proxyType = QNetworkProxy::NoProxy;
|
||||
}
|
||||
else if (ui->proxyType->currentIndex() == 0) {
|
||||
proxyType = QNetworkProxy::HttpProxy;
|
||||
}
|
||||
else {
|
||||
proxyType = QNetworkProxy::Socks5Proxy;
|
||||
int proxyType;
|
||||
if (ui->noProxy->isChecked()) {
|
||||
proxyType = 0;
|
||||
} else if (ui->systemProxy->isChecked()) {
|
||||
proxyType = 2;
|
||||
} else if (ui->proxyType->currentIndex() == 0) { // Http
|
||||
proxyType = 3;
|
||||
} else { // Socks5
|
||||
proxyType = 4;
|
||||
}
|
||||
|
||||
settings.beginGroup("Web-Proxy");
|
||||
|
@ -1413,7 +1413,7 @@
|
||||
<string>Proxy Configuration</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -1426,14 +1426,14 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QRadioButton" name="systemProxy">
|
||||
<property name="text">
|
||||
<string>System proxy configuration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer_29">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -1449,14 +1449,14 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QRadioButton" name="manualProxy">
|
||||
<property name="text">
|
||||
<string>Manual configuration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QComboBox" name="proxyType">
|
||||
@ -1494,7 +1494,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_38">
|
||||
@ -1531,6 +1531,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QRadioButton" name="noProxy">
|
||||
<property name="text">
|
||||
<string>No proxy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -2436,8 +2443,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>560</width>
|
||||
<height>80</height>
|
||||
<width>96</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
|
Loading…
Reference in New Issue
Block a user