2023-07-17 10:49:06 +02:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Controls.Material
|
2022-08-25 11:13:42 +02:00
|
|
|
|
|
|
|
|
import org.electrum 1.0
|
|
|
|
|
|
|
|
|
|
import "controls"
|
|
|
|
|
|
|
|
|
|
ElDialog {
|
|
|
|
|
id: rootItem
|
|
|
|
|
|
|
|
|
|
title: qsTr('Proxy settings')
|
2024-02-19 14:03:39 +01:00
|
|
|
iconSource: Qt.resolvedUrl('../../icons/status_connected_proxy.png')
|
2022-08-25 11:13:42 +02:00
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
|
height: parent.height
|
|
|
|
|
|
2022-12-30 22:40:29 +01:00
|
|
|
padding: 0
|
|
|
|
|
|
2022-08-25 11:13:42 +02:00
|
|
|
ColumnLayout {
|
|
|
|
|
width: parent.width
|
2022-12-30 22:40:29 +01:00
|
|
|
height: parent.height
|
|
|
|
|
spacing: 0
|
2022-08-25 11:13:42 +02:00
|
|
|
|
|
|
|
|
ProxyConfig {
|
2022-12-30 22:40:29 +01:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.leftMargin: constants.paddingLarge
|
|
|
|
|
Layout.rightMargin: constants.paddingLarge
|
2022-08-25 11:13:42 +02:00
|
|
|
id: proxyconfig
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-30 22:40:29 +01:00
|
|
|
Item { Layout.fillHeight: true; Layout.preferredWidth: 1 }
|
|
|
|
|
|
|
|
|
|
FlatButton {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
text: qsTr('Ok')
|
|
|
|
|
icon.source: '../../icons/confirmed.png'
|
|
|
|
|
onClicked: {
|
|
|
|
|
var proxy = proxyconfig.toProxyDict()
|
|
|
|
|
if (proxy && proxy['enabled'] == true) {
|
|
|
|
|
Network.proxy = proxy
|
|
|
|
|
} else {
|
|
|
|
|
Network.proxy = {'enabled': false}
|
2022-08-25 11:13:42 +02:00
|
|
|
}
|
2022-12-30 22:40:29 +01:00
|
|
|
rootItem.close()
|
2022-08-25 11:13:42 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-30 22:40:29 +01:00
|
|
|
|
2022-08-25 11:13:42 +02:00
|
|
|
Component.onCompleted: {
|
|
|
|
|
var p = Network.proxy
|
|
|
|
|
|
|
|
|
|
if ('mode' in p) {
|
|
|
|
|
proxyconfig.proxy_enabled = true
|
|
|
|
|
proxyconfig.proxy_address = p['host']
|
|
|
|
|
proxyconfig.proxy_port = p['port']
|
|
|
|
|
proxyconfig.username = p['user']
|
|
|
|
|
proxyconfig.password = p['password']
|
2023-03-29 15:46:03 +00:00
|
|
|
proxyconfig.proxy_type = proxyconfig.proxy_type_map.map(function(x) {
|
2023-01-12 16:03:57 +01:00
|
|
|
return x.value
|
|
|
|
|
}).indexOf(p['mode'])
|
2022-08-25 11:13:42 +02:00
|
|
|
} else {
|
|
|
|
|
proxyconfig.proxy_enabled = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|