diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/qml/Icons.qml | 2 | ||||
-rw-r--r-- | framework/qml/PasswordField.qml | 41 | ||||
-rw-r--r-- | framework/qmldir | 1 |
3 files changed, 44 insertions, 0 deletions
diff --git a/framework/qml/Icons.qml b/framework/qml/Icons.qml index d9612013..4d94f86a 100644 --- a/framework/qml/Icons.qml +++ b/framework/qml/Icons.qml | |||
@@ -55,6 +55,8 @@ Item { | |||
55 | property string goDown_inverted: "go-down-inverted" | 55 | property string goDown_inverted: "go-down-inverted" |
56 | property string goUp: "go-up" | 56 | property string goUp: "go-up" |
57 | property string checkbox: "checkbox" | 57 | property string checkbox: "checkbox" |
58 | property string password_show: "password-show-on" | ||
59 | property string password_hide: "password-show-off" | ||
58 | 60 | ||
59 | property string addNew: "list-add" | 61 | property string addNew: "list-add" |
60 | property string remove: "kube-list-remove-inverted" | 62 | property string remove: "kube-list-remove-inverted" |
diff --git a/framework/qml/PasswordField.qml b/framework/qml/PasswordField.qml new file mode 100644 index 00000000..786b3d46 --- /dev/null +++ b/framework/qml/PasswordField.qml | |||
@@ -0,0 +1,41 @@ | |||
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 org.kube.framework 1.0 as Kube | ||
21 | |||
22 | Kube.TextField { | ||
23 | id: root | ||
24 | |||
25 | property bool showPassword | ||
26 | |||
27 | echoMode: showPassword ? TextInput.Normal : TextInput.Password | ||
28 | |||
29 | Kube.IconButton { | ||
30 | anchors { | ||
31 | right: parent.right | ||
32 | verticalCenter: parent.verticalCenter | ||
33 | } | ||
34 | |||
35 | onClicked: { | ||
36 | root.showPassword = !root.showPassword | ||
37 | } | ||
38 | |||
39 | iconName: root.showPassword ? Kube.Icons.password_hide : Kube.Icons.password_show | ||
40 | } | ||
41 | } | ||
diff --git a/framework/qmldir b/framework/qmldir index d4ec9619..a0f58385 100644 --- a/framework/qmldir +++ b/framework/qmldir | |||
@@ -23,6 +23,7 @@ CheckBox 1.0 CheckBox.qml | |||
23 | PositiveButton 1.0 PositiveButton.qml | 23 | PositiveButton 1.0 PositiveButton.qml |
24 | TextButton 1.0 TextButton.qml | 24 | TextButton 1.0 TextButton.qml |
25 | TextField 1.0 TextField.qml | 25 | TextField 1.0 TextField.qml |
26 | PasswordField 1.0 PasswordField.qml | ||
26 | TextArea 1.0 TextArea.qml | 27 | TextArea 1.0 TextArea.qml |
27 | TextEditor 1.0 TextEditor.qml | 28 | TextEditor 1.0 TextEditor.qml |
28 | ToolTip 1.0 ToolTip.qml | 29 | ToolTip 1.0 ToolTip.qml |