Skip to content

Commit

Permalink
ListTextField enabled > interactive upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeTrahearn-Qinetic committed Feb 6, 2025
1 parent c06cfb9 commit b2b6409
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion components/listitems/core/ListRadioButtonGroup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ ListNavigation {
flickable: optionsListView
primaryLabel.color: Theme.color_font_secondary
textField.echoMode: TextInput.Password
enabled: radioButton.enabled
interactive: radioButton.enabled
backgroundRect.color: "transparent"
preferredVisible: showField && model.index === optionsListView.currentIndex && !!root.validatePassword
validateInput: function() {
Expand Down
5 changes: 5 additions & 0 deletions components/listitems/core/ListTextField.qml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ ListItem {
signal editingFinished()
signal accepted()

interactive: (dataItem.uid === "" || dataItem.isValid)

onClicked: forceActiveFocus()

function forceActiveFocus() {
_aboutToFocus()
textField.forceActiveFocus()
Expand Down Expand Up @@ -117,6 +121,7 @@ ListItem {
property bool _showErrorHighlight
property bool _validateBeforeSaving

enabled: root.clickable
width: Math.max(Theme.geometry_listItem_textField_minimumWidth,
Math.min(Theme.geometry_listItem_textField_maximumWidth,
implicitWidth + leftPadding + rightPadding))
Expand Down
16 changes: 16 additions & 0 deletions pages/MainView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,22 @@ Item {
interactive: false
}

ListText {
text: "ListText"
}
ListTextField {
text: "ListTextField"
}
ListTextField {
text: "ListTextField - non interactive"
interactive: false
}

ListIpAddressField {
text: "IP address"
secondaryText: "127.0.0.1"
}

ListLink {
url: Qt.url("https://www.qt.io")
}
Expand Down
2 changes: 1 addition & 1 deletion pages/settings/PageGeneratorRuntimeService.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Page {
text: qsTrId("page_settings_run_time_and_service_generator_total_run_time")
secondaryText: Math.round(accumulatedTotalItem.value / 60 / 60) - Math.round(dataItem.value / 60 / 60) + "h"
dataItem.uid: settingsBindPrefix + "/AccumulatedTotalOffset"
enabled: userHasWriteAccess && state.value === 0
interactive: dataItem.isValid && state.value === 0
preferredVisible: dataItem.isValid && gensetBindPrefix === ""
maximumLength: 6
saveInput: function() {
Expand Down
6 changes: 3 additions & 3 deletions pages/settings/PageSettingsEthernet.qml
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,23 @@ Page {
ListIpAddressField {
//% "Netmask"
text: qsTrId("settings_tcpip_netmask")
enabled: method.userHasWriteAccess && networkServices.manual
interactive: method.userHasWriteAccess && networkServices.manual
textField.text: networkServices.netmask
saveInput: function() { networkServices.setServiceProperty("Netmask", textField.text) }
}

ListIpAddressField {
//% "Gateway"
text: qsTrId("settings_tcpip_gateway")
enabled: method.userHasWriteAccess && networkServices.manual
interactive: method.userHasWriteAccess && networkServices.manual
textField.text: networkServices.gateway
saveInput: function() { networkServices.setServiceProperty("Gateway", textField.text) }
}

ListIpAddressField {
//% "DNS server"
text: qsTrId("settings_tcpip_dns_server")
enabled: method.userHasWriteAccess && networkServices.manual
interactive: method.userHasWriteAccess && networkServices.manual
textField.text: networkServices.nameserver
saveInput: function() { networkServices.setServiceProperty("Nameserver", textField.text) }
}
Expand Down
8 changes: 4 additions & 4 deletions pages/settings/PageSettingsTailscale.qml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Page {
text: qsTrId("settings_tailscale_machinename")
dataItem.uid: Global.systemSettings.serviceUid + "/Settings/Services/Tailscale/MachineName"
placeholderText: "--"
enabled: !root.tailscaleEnabled && userHasWriteAccess
interactive: dataItem.isValid && !root.tailscaleEnabled
validateInput: function() {
return _checkAndCleanup(textField.text, "0-9a-z-")
}
Expand Down Expand Up @@ -271,7 +271,7 @@ Page {
dataItem.uid: Global.systemSettings.serviceUid + "/Settings/Services/Tailscale/CustomNetworks"
//% "Example: 192.168.1.0/24"
placeholderText: qsTrId("settings_tailscale_local_network_access_custom_networks_placeholder")
enabled: !root.tailscaleEnabled && userHasWriteAccess
interactive: dataItem.isValid && !root.tailscaleEnabled
validateInput: function() {
return _checkAndCleanup(textField.text, "0-9./,")
}
Expand Down Expand Up @@ -313,7 +313,7 @@ Page {
text: qsTrId("settings_tailscale_advanced_custom_tailscale_up_arguments")
dataItem.uid: Global.systemSettings.serviceUid + "/Settings/Services/Tailscale/CustomArguments"
placeholderText: "--"
enabled: !root.tailscaleEnabled && userHasWriteAccess
interactive: dataItem.isValid && !root.tailscaleEnabled
validateInput: function() {
return _checkAndCleanup(textField.text, "0-9a-z-_=+:., ")
}
Expand All @@ -324,7 +324,7 @@ Page {
text: qsTrId("settings_tailscale_advanced_custom_server_url")
dataItem.uid: Global.systemSettings.serviceUid + "/Settings/Services/Tailscale/CustomServerUrl"
placeholderText: "--"
enabled: !root.tailscaleEnabled && userHasWriteAccess
interactive: dataItem.isValid && !root.tailscaleEnabled
validateInput: function() {
return _checkAndCleanup(textField.text, "0-9a-z-:/.")
}
Expand Down

0 comments on commit b2b6409

Please sign in to comment.