summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/kube/contents/ui/AddresseeListEditor.qml12
-rw-r--r--framework/qml/AutocompleteLineEdit.qml21
2 files changed, 28 insertions, 5 deletions
diff --git a/components/kube/contents/ui/AddresseeListEditor.qml b/components/kube/contents/ui/AddresseeListEditor.qml
index 1f106dfd..25916315 100644
--- a/components/kube/contents/ui/AddresseeListEditor.qml
+++ b/components/kube/contents/ui/AddresseeListEditor.qml
@@ -24,7 +24,7 @@ import QtQuick.Layouts 1.1
24 24
25import org.kube.framework 1.0 as Kube 25import org.kube.framework 1.0 as Kube
26 26
27Item { 27FocusScope {
28 id: root 28 id: root
29 property variant completer 29 property variant completer
30 property alias model: listView.model 30 property alias model: listView.model
@@ -78,14 +78,16 @@ Item {
78 } 78 }
79 } 79 }
80 80
81 Item { 81 FocusScope {
82 height: Kube.Units.gridUnit * Kube.Units.smallSpacing * 2 82 height: Kube.Units.gridUnit * Kube.Units.smallSpacing * 2
83 width: parent.width 83 width: parent.width
84 focus: true
84 85
85 Kube.TextButton { 86 Kube.TextButton {
86 id: button 87 id: button
87 text: "+ " + qsTr("Add recipient") 88 text: "+ " + qsTr("Add recipient")
88 color: Kube.Colors.highlightColor 89 color: Kube.Colors.highlightColor
90 focus: true
89 onClicked: { 91 onClicked: {
90 lineEdit.visible = true 92 lineEdit.visible = true
91 lineEdit.forceActiveFocus() 93 lineEdit.forceActiveFocus()
@@ -107,6 +109,12 @@ Item {
107 root.added(text); 109 root.added(text);
108 clear() 110 clear()
109 visible = false 111 visible = false
112 button.forceActiveFocus()
113 }
114 onAborted: {
115 clear()
116 visible = false
117 button.forceActiveFocus()
110 } 118 }
111 } 119 }
112 } 120 }
diff --git a/framework/qml/AutocompleteLineEdit.qml b/framework/qml/AutocompleteLineEdit.qml
index f963095a..1be8f7eb 100644
--- a/framework/qml/AutocompleteLineEdit.qml
+++ b/framework/qml/AutocompleteLineEdit.qml
@@ -30,6 +30,8 @@ Kube.TextField {
30 property string searchTerm 30 property string searchTerm
31 property variant model 31 property variant model
32 32
33 signal aborted()
34
33 selectByMouse: true 35 selectByMouse: true
34 36
35 onTextChanged: { 37 onTextChanged: {
@@ -38,9 +40,17 @@ Kube.TextField {
38 startCompleting() 40 startCompleting()
39 } else { 41 } else {
40 searchTerm = "" 42 searchTerm = ""
41 abort() 43 popup.close()
42 } 44 }
43 } 45 }
46
47 onEditingFinished: {
48 console.warn("on editing finished")
49 accept()
50 }
51
52 validator: RegExpValidator { regExp: /.+/ }
53
44 Keys.onDownPressed: { 54 Keys.onDownPressed: {
45 listView.incrementCurrentIndex() 55 listView.incrementCurrentIndex()
46 } 56 }
@@ -58,7 +68,11 @@ Kube.TextField {
58 } 68 }
59 } 69 }
60 Keys.onReturnPressed: { 70 Keys.onReturnPressed: {
61 accept() 71 if (acceptableInput) {
72 accept()
73 } else {
74 abort()
75 }
62 } 76 }
63 Keys.onEscapePressed: { 77 Keys.onEscapePressed: {
64 abort() 78 abort()
@@ -76,11 +90,12 @@ Kube.TextField {
76 root.text = listView.currentItem.text; 90 root.text = listView.currentItem.text;
77 } 91 }
78 popup.close() 92 popup.close()
79 root.accepted(); 93 root.accepted()
80 } 94 }
81 95
82 function abort() { 96 function abort() {
83 popup.close() 97 popup.close()
98 root.aborted()
84 } 99 }
85 100
86 Controls2.Popup { 101 Controls2.Popup {