diff options
-rw-r--r-- | components/kube/contents/ui/AddresseeListEditor.qml | 18 | ||||
-rw-r--r-- | framework/qml/TextButton.qml | 43 | ||||
-rw-r--r-- | framework/qmldir | 1 |
3 files changed, 51 insertions, 11 deletions
diff --git a/components/kube/contents/ui/AddresseeListEditor.qml b/components/kube/contents/ui/AddresseeListEditor.qml index 873e0c6c..1f106dfd 100644 --- a/components/kube/contents/ui/AddresseeListEditor.qml +++ b/components/kube/contents/ui/AddresseeListEditor.qml | |||
@@ -78,20 +78,18 @@ Item { | |||
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | MouseArea { | 81 | Item { |
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 | hoverEnabled: true | ||
85 | 84 | ||
86 | onClicked: { | 85 | Kube.TextButton { |
87 | lineEdit.visible = true | 86 | id: button |
88 | lineEdit.forceActiveFocus() | ||
89 | } | ||
90 | |||
91 | Kube.Label { | ||
92 | text: "+ " + qsTr("Add recipient") | 87 | text: "+ " + qsTr("Add recipient") |
93 | color: Kube.Colors.highlightColor | 88 | color: Kube.Colors.highlightColor |
94 | font.underline: parent.containsMouse | 89 | onClicked: { |
90 | lineEdit.visible = true | ||
91 | lineEdit.forceActiveFocus() | ||
92 | } | ||
95 | } | 93 | } |
96 | 94 | ||
97 | Kube.AutocompleteLineEdit { | 95 | Kube.AutocompleteLineEdit { |
@@ -100,7 +98,6 @@ Item { | |||
100 | left: parent.left | 98 | left: parent.left |
101 | right: parent.right | 99 | right: parent.right |
102 | } | 100 | } |
103 | |||
104 | visible: false | 101 | visible: false |
105 | 102 | ||
106 | placeholderText: "+ " + qsTr("Add recipient") | 103 | placeholderText: "+ " + qsTr("Add recipient") |
@@ -108,7 +105,6 @@ Item { | |||
108 | onSearchTermChanged: root.completer.searchString = searchTerm | 105 | onSearchTermChanged: root.completer.searchString = searchTerm |
109 | onAccepted: { | 106 | onAccepted: { |
110 | root.added(text); | 107 | root.added(text); |
111 | console.warn("Accepted input: ", text) | ||
112 | clear() | 108 | clear() |
113 | visible = false | 109 | visible = false |
114 | } | 110 | } |
diff --git a/framework/qml/TextButton.qml b/framework/qml/TextButton.qml new file mode 100644 index 00000000..4d7ea27d --- /dev/null +++ b/framework/qml/TextButton.qml | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | import QtQuick 2.7 | ||
20 | import QtQuick.Templates 2.0 as T | ||
21 | import org.kube.framework 1.0 | ||
22 | |||
23 | T.Button { | ||
24 | id: root | ||
25 | |||
26 | property alias color: label.color | ||
27 | |||
28 | width: Math.max(Units.gridUnit, contentItem.implicitWidth + leftPadding + rightPadding) | ||
29 | height: contentItem.implicitHeight + topPadding + bottomPadding | ||
30 | |||
31 | clip: true | ||
32 | hoverEnabled: true | ||
33 | Keys.onReturnPressed: root.clicked() | ||
34 | |||
35 | contentItem: Label { | ||
36 | id: label | ||
37 | text: root.text | ||
38 | font.underline: root.activeFocus || root.hovered | ||
39 | elide: Text.ElideRight | ||
40 | horizontalAlignment: Text.AlignHCenter | ||
41 | verticalAlignment: Text.AlignVCenter | ||
42 | } | ||
43 | } | ||
diff --git a/framework/qmldir b/framework/qmldir index 0a71b6c8..156cdb07 100644 --- a/framework/qmldir +++ b/framework/qmldir | |||
@@ -20,6 +20,7 @@ ProgressBar 1.0 ProgressBar.qml | |||
20 | StatusBar 1.0 StatusBar.qml | 20 | StatusBar 1.0 StatusBar.qml |
21 | ComboBox 1.0 ComboBox.qml | 21 | ComboBox 1.0 ComboBox.qml |
22 | PositiveButton 1.0 PositiveButton.qml | 22 | PositiveButton 1.0 PositiveButton.qml |
23 | TextButton 1.0 TextButton.qml | ||
23 | TextField 1.0 TextField.qml | 24 | TextField 1.0 TextField.qml |
24 | TextArea 1.0 TextArea.qml | 25 | TextArea 1.0 TextArea.qml |
25 | TextEditor 1.0 TextEditor.qml | 26 | TextEditor 1.0 TextEditor.qml |