Skip to content

Instantly share code, notes, and snippets.

@kverb
Created January 9, 2026 16:53
Show Gist options
  • Select an option

  • Save kverb/81e38c49f62f918f92d8790a3960eb3b to your computer and use it in GitHub Desktop.

Select an option

Save kverb/81e38c49f62f918f92d8790a3960eb3b to your computer and use it in GitHub Desktop.
Fix "ShowPassword" checkbox in Modals/WifiPasswordModal.qml
--- Modals/WifiPasswordModal.backup.qml 2026-01-09 11:36:15.674541499 -0500
+++ Modals/WifiPasswordModal.qml 2026-01-09 11:46:45.293220768 -0500
@@ -28,14 +28,20 @@
property var fieldsInfo: []
property var secretValues: ({})
+ // New property to track password visibility globally
+ property bool showSecrets: false
+
property int calculatedHeight: {
+ let baseHeight = 230;
if (fieldsInfo.length > 0)
- return 180 + (fieldsInfo.length * 60);
- if (requiresEnterprise)
- return 430;
- if (isVpnPrompt)
- return 260;
- return 230;
+ baseHeight = 180 + (fieldsInfo.length * 60);
+ else if (requiresEnterprise)
+ baseHeight = 430;
+ else if (isVpnPrompt)
+ baseHeight = 260;
+
+ // Add extra padding if we are showing the "Show password" row
+ return baseHeight + 30;
}
function focusFirstField() {
@@ -71,6 +77,7 @@
connectionType = "";
fieldsInfo = [];
secretValues = {};
+ showSecrets = false; // Reset on show
const network = NetworkService.wifiNetworks.find(n => n.ssid === ssid);
requiresEnterprise = network?.enterprise || false;
@@ -90,6 +97,7 @@
vpnServiceType = vpnService || "";
fieldsInfo = fInfo || [];
secretValues = {};
+ showSecrets = false; // Reset on show
isVpnPrompt = (connectionType === "vpn" || connectionType === "wireguard");
wifiPasswordSSID = isVpnPrompt ? connectionName : ssid;
@@ -208,6 +216,7 @@
usernameInput.text = "";
anonInput.text = "";
domainMatchInput.text = "";
+ showSecrets = false;
for (var i = 0; i < dynamicFieldsRepeater.count; i++) {
const item = dynamicFieldsRepeater.itemAt(i);
if (item?.children[0])
@@ -336,7 +345,8 @@
anchors.fill: parent
font.pixelSize: Theme.fontSizeMedium
textColor: Theme.surfaceText
- echoMode: modelData.isSecret ? TextInput.Password : TextInput.Normal
+ // Respect showSecrets toggle for dynamic fields
+ echoMode: (modelData.isSecret && !root.showSecrets) ? TextInput.Password : TextInput.Normal
placeholderText: getFieldLabel(modelData.name)
backgroundColor: "transparent"
enabled: root.visible
@@ -438,7 +448,8 @@
font.pixelSize: Theme.fontSizeMedium
textColor: Theme.surfaceText
text: wifiPasswordInput
- echoMode: showPasswordCheckbox.checked ? TextInput.Normal : TextInput.Password
+ // Toggled by root property
+ echoMode: root.showSecrets ? TextInput.Normal : TextInput.Password
placeholderText: (requiresEnterprise && !isVpnPrompt) ? I18n.tr("Password") : ""
backgroundColor: "transparent"
enabled: root.visible
@@ -521,20 +532,19 @@
spacing: Theme.spacingS
width: parent.width
+ // Show Password Toggle Row
Row {
spacing: Theme.spacingS
- visible: fieldsInfo.length === 0
+ // Show this toggle if there are dynamic fields or we're in a password-capable mode
+ visible: fieldsInfo.length > 0 || !requiresEnterprise || isVpnPrompt
Rectangle {
id: showPasswordCheckbox
-
- property bool checked: false
-
width: 20
height: 20
radius: 4
- color: checked ? Theme.primary : "transparent"
- border.color: checked ? Theme.primary : Theme.outlineButton
+ color: root.showSecrets ? Theme.primary : "transparent"
+ border.color: root.showSecrets ? Theme.primary : Theme.outlineButton
border.width: 2
DankIcon {
@@ -542,14 +552,14 @@
name: "check"
size: 12
color: Theme.background
- visible: parent.checked
+ visible: root.showSecrets
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
- onClicked: showPasswordCheckbox.checked = !showPasswordCheckbox.checked
+ onClicked: root.showSecrets = !root.showSecrets
}
}
@@ -561,15 +571,14 @@
}
}
+ // Save Password Toggle Row
Row {
spacing: Theme.spacingS
visible: isVpnPrompt || fieldsInfo.length > 0
Rectangle {
id: savePasswordCheckbox
-
property bool checked: false
-
width: 20
height: 20
radius: 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment