feat: support proxy user and password
This commit is contained in:
@@ -743,11 +743,15 @@ void Controller::setApplicationProxy()
|
||||
proxy.setType(QNetworkProxy::HttpProxy);
|
||||
proxy.setHostName(cfg->proxyHost());
|
||||
proxy.setPort(cfg->proxyPort());
|
||||
proxy.setUser(cfg->proxyUser());
|
||||
proxy.setPassword(cfg->proxyPassword());
|
||||
break;
|
||||
case 2: // SOCKS 5
|
||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||
proxy.setHostName(cfg->proxyHost());
|
||||
proxy.setPort(cfg->proxyPort());
|
||||
proxy.setUser(cfg->proxyUser());
|
||||
proxy.setPassword(cfg->proxyPassword());
|
||||
break;
|
||||
case 0: // System Default
|
||||
default:
|
||||
|
||||
@@ -133,6 +133,14 @@
|
||||
<label>The port number of the proxy</label>
|
||||
<default>1080</default>
|
||||
</entry>
|
||||
<entry name="ProxyUser" type="String">
|
||||
<label>The user of the proxy</label>
|
||||
<default></default>
|
||||
</entry>
|
||||
<entry name="ProxyPassword" type="Password">
|
||||
<label>The password of the proxy</label>
|
||||
<default></default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
||||
|
||||
|
||||
@@ -93,6 +93,25 @@ Kirigami.ScrollablePage {
|
||||
}
|
||||
}
|
||||
}
|
||||
MobileForm.FormTextFieldDelegate {
|
||||
id: userField
|
||||
label: i18n("User")
|
||||
text: Config.proxyUser
|
||||
inputMethodHints: Qt.ImhUrlCharactersOnly
|
||||
onEditingFinished: {
|
||||
proxyConfigChanged = true
|
||||
}
|
||||
}
|
||||
MobileForm.FormTextFieldDelegate {
|
||||
id: passwordField
|
||||
label: i18n("Password")
|
||||
text: Config.proxyPassword
|
||||
echoMode: TextInput.Password
|
||||
inputMethodHints: Qt.ImhUrlCharactersOnly
|
||||
onEditingFinished: {
|
||||
proxyConfigChanged = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,6 +130,8 @@ Kirigami.ScrollablePage {
|
||||
Config.proxyType = currentType
|
||||
Config.proxyHost = hostField.text
|
||||
Config.proxyPort = portField.value
|
||||
Config.proxyUser = userField.text
|
||||
Config.proxyPassword = passwordField.text
|
||||
Config.save()
|
||||
proxyConfigChanged = false
|
||||
Controller.setApplicationProxy()
|
||||
|
||||
Reference in New Issue
Block a user