Clicking on a user selects the password input

BUG: 336368
wilder-5.14
David Edmundson 12 years ago
parent aaa8670adb
commit a38ebe1241
  1. 7
      lookandfeel/contents/components/UserList.qml
  2. 29
      lookandfeel/contents/components/UserSelect.qml

@ -26,6 +26,12 @@ ListView {
readonly property int userItemHeight: units.largeSpacing * 8
readonly property int userFaceSize: units.largeSpacing * 6
/*
* Signals that a user was explicitly clicked.
* This is not the same as the seclected user changing
*/
signal userClicked;
orientation: ListView.Horizontal
highlightRangeMode: ListView.StrictlyEnforceRange
@ -39,6 +45,7 @@ ListView {
onClicked: {
view.currentIndex = index;
view.forceActiveFocus();
view.userClicked();
}
}
}

@ -23,13 +23,16 @@ import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
FocusScope {
id: root
property alias model: usersList.model
property alias selectedUser: usersList.selectedUser
property alias selectedIndex: usersList.currentIndex
property alias delegate: usersList.delegate
property alias notification: notificationLabel.text
activeFocusOnTab: true
InfoPane {
id: infoPane
anchors {
@ -42,7 +45,7 @@ Item {
UserList {
id: usersList
activeFocusOnTab: true
focus: true
Rectangle {//debug
visible: debug
@ -68,27 +71,13 @@ Item {
preferredHighlightBegin: userItemWidth * 1
preferredHighlightEnd: userItemWidth * 2
//if the user presses down or enter, focus password
//if user presses any normal key
//copy that character pressed to the pasword box and force focus
//can't use forwardTo as I want to switch focus. Also it doesn't work.
Keys.onPressed: {
if (event.key == Qt.Key_Down ||
event.key == Qt.Key_Enter ||
event.key == Qt.Key_Return) {
passwordInput.forceActiveFocus();
} else if (event.key & Qt.Key_Escape) {
//if special key, do nothing. Qt.Escape is 0x10000000 which happens to be a mask used for all special keys in Qt.
} else {
passwordInput.text += event.text;
passwordInput.forceActiveFocus();
}
}
Component.onCompleted: {
currentIndex = 0;
}
onUserClicked: {
nextItemInFocusChain().forceActiveFocus();
}
}
BreezeLabel {

Loading…
Cancel
Save