on b512b17 help sign in
81 lines 2.1 kB history raw
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 */
20import QtQuick 2.0
21import Ubuntu.Components 0.1
23Menu {
24 id: _textMenu
26 property alias text: _textField.text
27 property alias password: _showPassword.visible
29 implicitHeight: password ? units.gu(10) : units.gu(7)
31 Column {
32 id: _contentColumn
33 spacing: units.gu(0.5)
34 anchors {
35 left: parent.left
36 right: parent.right
37 verticalCenter: parent.verticalCenter
38 margins: units.gu(3)
39 }
41 TextField {
42 id: _textField
44 anchors {
45 left: parent.left
46 right: parent.right
47 }
49 placeholderText: "Password"
50 echoMode: _textMenu.password && !_checkBox.checked ? TextInput.Password : TextInput.Normal
51 }
53 Row {
54 id: _showPassword
56 visible: false
57 anchors {
58 left: parent.left
59 right: parent.right
61 }
63 spacing: units.gu(1)
65 CheckBox {
66 id: _checkBox
67 }
69 Label {
70 text: "Show password"
71 anchors.verticalCenter: _checkBox.verticalCenter
72 }
73 }
74 }
76 DBusActionState {
77 action: menu ? menu.action : ""
78 target: _textField
79 property: "text"
80 }