Commit 602e5533 authored by Krešimir Čohar's avatar Krešimir Čohar

[sddm-theme] Replace login button label with icon

Summary: This patch replaces the login button label "Log In" with an icon, places it to the right of the password field, and centers the combination of the password field and the login button. It also adjusts for the button's right border, which has a tendency to extend to the right and beyond the username input field by one pixel.

Test Plan:
Before:(user list screen):
{F6654659}
After (uer list screen):
{F6654661}
Before (user prompt screen):
{F6654662}
After (user prompt screen):
{F6654663}

Reviewers: #vdg, #plasma, ngraham, filipf

Reviewed By: #vdg, ngraham, filipf

Subscribers: davidedmundson, abetts, ngraham, filipf, plasma-devel

Tags: #plasma

Maniphest Tasks: T10325

Differential Revision: https://phabricator.kde.org/D19214
parent 99dd9263
......@@ -51,52 +51,60 @@ SessionManagementScreen {
loginRequest(password);
}
PlasmaComponents.TextField {
id: passwordBox
font.pointSize: theme.defaultFont.pointSize + 1
RowLayout {
Layout.fillWidth: true
placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Password")
focus: true
echoMode: TextInput.Password
inputMethodHints: Qt.ImhHiddenText | Qt.ImhSensitiveData | Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
enabled: !authenticator.graceLocked
revealPasswordButtonShown: true
onAccepted: {
if (lockScreenUiVisible) {
startLogin();
PlasmaComponents.TextField {
id: passwordBox
font.pointSize: theme.defaultFont.pointSize + 1
Layout.fillWidth: true
placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Password")
focus: true
echoMode: TextInput.Password
inputMethodHints: Qt.ImhHiddenText | Qt.ImhSensitiveData | Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
enabled: !authenticator.graceLocked
revealPasswordButtonShown: true
onAccepted: {
if (lockScreenUiVisible) {
startLogin();
}
}
}
//if empty and left or right is pressed change selection in user switch
//this cannot be in keys.onLeftPressed as then it doesn't reach the password box
Keys.onPressed: {
if (event.key == Qt.Key_Left && !text) {
userList.decrementCurrentIndex();
event.accepted = true
//if empty and left or right is pressed change selection in user switch
//this cannot be in keys.onLeftPressed as then it doesn't reach the password box
Keys.onPressed: {
if (event.key == Qt.Key_Left && !text) {
userList.decrementCurrentIndex();
event.accepted = true
}
if (event.key == Qt.Key_Right && !text) {
userList.incrementCurrentIndex();
event.accepted = true
}
}
if (event.key == Qt.Key_Right && !text) {
userList.incrementCurrentIndex();
event.accepted = true
}
}
Connections {
target: root
onClearPassword: {
passwordBox.forceActiveFocus()
passwordBox.selectAll()
Connections {
target: root
onClearPassword: {
passwordBox.forceActiveFocus()
passwordBox.selectAll()
}
}
}
}
PlasmaComponents.Button {
id: loginButton
font.pointSize: theme.defaultFont.pointSize + 1
Layout.fillWidth: true
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Unlock")
onClicked: startLogin()
PlasmaComponents.Button {
id: loginButton
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Unlock")
implicitHeight: passwordBox.height - units.smallSpacing * 0.5 // otherwise it comes out taller than the password field
PlasmaCore.IconItem { // no iconSource because if you take away half a unit (implicitHeight), "go-next" gets cut off
anchors.fill: parent
anchors.margins: units.smallSpacing
source: "go-next"
}
onClicked: startLogin()
}
}
}
......@@ -58,54 +58,63 @@ SessionManagementScreen {
}
}
PlasmaComponents.TextField {
id: passwordBox
font.pointSize: theme.defaultFont.pointSize + 1
RowLayout {
Layout.fillWidth: true
placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Password")
focus: !showUsernamePrompt || lastUserName
echoMode: TextInput.Password
revealPasswordButtonShown: true
PlasmaComponents.TextField {
id: passwordBox
font.pointSize: theme.defaultFont.pointSize + 1
Layout.fillWidth: true
onAccepted: {
if (root.loginScreenUiVisible) {
startLogin();
placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Password")
focus: !showUsernamePrompt || lastUserName
echoMode: TextInput.Password
revealPasswordButtonShown: true
onAccepted: {
if (root.loginScreenUiVisible) {
startLogin();
}
}
}
Keys.onEscapePressed: {
mainStack.currentItem.forceActiveFocus();
}
Keys.onEscapePressed: {
mainStack.currentItem.forceActiveFocus();
}
//if empty and left or right is pressed change selection in user switch
//this cannot be in keys.onLeftPressed as then it doesn't reach the password box
Keys.onPressed: {
if (event.key == Qt.Key_Left && !text) {
userList.decrementCurrentIndex();
event.accepted = true
//if empty and left or right is pressed change selection in user switch
//this cannot be in keys.onLeftPressed as then it doesn't reach the password box
Keys.onPressed: {
if (event.key == Qt.Key_Left && !text) {
userList.decrementCurrentIndex();
event.accepted = true
}
if (event.key == Qt.Key_Right && !text) {
userList.incrementCurrentIndex();
event.accepted = true
}
}
if (event.key == Qt.Key_Right && !text) {
userList.incrementCurrentIndex();
event.accepted = true
Connections {
target: sddm
onLoginFailed: {
passwordBox.selectAll()
passwordBox.forceActiveFocus()
}
}
}
Connections {
target: sddm
onLoginFailed: {
passwordBox.selectAll()
passwordBox.forceActiveFocus()
PlasmaComponents.Button {
id: loginButton
Accessible.name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Log In")
implicitHeight: passwordBox.height - units.smallSpacing * 0.5 // otherwise it comes out taller than the password field
Layout.rightMargin: 1 // prevents it from extending beyond the username field
PlasmaCore.IconItem { // no iconSource because if you take away half a unit (implicitHeight), "go-next" gets cut off
anchors.fill: parent
anchors.margins: units.smallSpacing
source: "go-next"
}
onClicked: startLogin();
}
}
PlasmaComponents.Button {
id: loginButton
font.pointSize: theme.defaultFont.pointSize + 1
Layout.fillWidth: true
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Log In")
onClicked: startLogin();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment