diff --git a/src/declarativeimports/plasmacomponents/qml/TextField.qml b/src/declarativeimports/plasmacomponents/qml/TextField.qml --- a/src/declarativeimports/plasmacomponents/qml/TextField.qml +++ b/src/declarativeimports/plasmacomponents/qml/TextField.qml @@ -48,6 +48,7 @@ // this takes into account kiosk restriction readonly property bool __effectiveRevealPasswordButtonShown: revealPasswordButtonShown && KAuthorized.authorize("lineedit_reveal_password") + && textField.length > 0 //Deprecated/unsupported api /** @@ -92,7 +93,7 @@ PlasmaCore.IconItem { id: showPasswordButton - source: __effectiveRevealPasswordButtonShown ? (textField.echoMode === TextInput.Normal ? "hint" : "visibility") : "" + source: __effectiveRevealPasswordButtonShown ? (textField.echoMode === TextInput.Normal ? "visibility": "hint") : "" height: Math.max(textField.height * 0.8, units.iconSizes.small) width: height opacity: (__effectiveRevealPasswordButtonShown && textField.enabled) ? 1 : 0 @@ -105,6 +106,7 @@ } MouseArea { anchors.fill: parent + enabled: __effectiveRevealPasswordButtonShown onClicked: { textField.echoMode = (textField.echoMode == TextInput.Normal ? TextInput.Password : TextInput.Normal) textField.forceActiveFocus() @@ -135,4 +137,10 @@ } } } + + on__EffectiveRevealPasswordButtonShownChanged: { + if (revealPasswordButtonShown && length === 0) { + textField.echoMode = TextInput.Password + } + } }