Files
pallectrum/electrum/gui/qml/components/ServerConfigDialog.qml
Sander van Grieken 7df2a1159b qml: fix updating network settings
Previously the server parameters were each handled differently, e.g. auto-connect was only applied when updating Network.server
and not when Config.autoConnect was updated. Similarly, updating Network.server did not restart the network, leading to >1 connection
when Network.oneServer was set to True before updating Network.server.

Consolidate server parameter updates into a single call, remove the individual setters, and move Config.autoConnect and Config.autoConnectDefined to Network.
2025-06-03 13:22:45 +02:00

54 lines
1.3 KiB
QML

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material
import org.electrum 1.0
import "controls"
ElDialog {
id: rootItem
title: qsTr('Server settings')
iconSource: Qt.resolvedUrl('../../icons/network.png')
width: parent.width
height: parent.height
padding: 0
ColumnLayout {
width: parent.width
height: parent.height
spacing: 0
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.leftMargin: constants.paddingLarge
Layout.rightMargin: constants.paddingLarge
ServerConfig {
id: serverconfig
Layout.fillWidth: true
Layout.fillHeight: true
}
}
FlatButton {
Layout.fillWidth: true
text: qsTr('Ok')
icon.source: '../../icons/confirmed.png'
onClicked: {
let auto_connect = serverconfig.serverConnectMode == ServerConnectModeComboBox.Mode.Autoconnect
let server = serverconfig.address
let one_server = serverconfig.serverConnectMode == ServerConnectModeComboBox.Mode.Single
Network.setServerParameters(server, auto_connect, one_server)
rootItem.close()
}
}
}
}