summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bohlender <michael.bohlender@kdemail.net>2017-07-31 18:58:39 +0200
committerMichael Bohlender <michael.bohlender@kdemail.net>2017-07-31 18:58:39 +0200
commited90f285745279e91743851ae49eeccf1d95710f (patch)
treec901f650c3b2b22e9cf0ce1af811452c5707e7ee
parent32e9eda3bd93e3197234cd9947a5522e5eb9da94 (diff)
downloadkube-ed90f285745279e91743851ae49eeccf1d95710f.tar.gz
kube-ed90f285745279e91743851ae49eeccf1d95710f.zip
dedicated Kube.PasswordField
-rw-r--r--accounts/gmail/package/contents/ui/GmailSettings.qml32
-rw-r--r--accounts/imap/package/contents/ui/ImapAccountSettings.qml32
-rw-r--r--accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml16
-rw-r--r--framework/qml/Icons.qml2
-rw-r--r--framework/qml/PasswordField.qml41
-rw-r--r--framework/qmldir1
6 files changed, 61 insertions, 63 deletions
diff --git a/accounts/gmail/package/contents/ui/GmailSettings.qml b/accounts/gmail/package/contents/ui/GmailSettings.qml
index 40a6e1e7..0ee18bed 100644
--- a/accounts/gmail/package/contents/ui/GmailSettings.qml
+++ b/accounts/gmail/package/contents/ui/GmailSettings.qml
@@ -116,32 +116,16 @@ Item {
116 text: qsTr("Password") 116 text: qsTr("Password")
117 Layout.alignment: Qt.AlignRight 117 Layout.alignment: Qt.AlignRight
118 } 118 }
119 RowLayout {
120 Layout.fillWidth: true
121
122 Kube.TextField {
123 id: pwField
124 Layout.fillWidth: true
125
126 placeholderText: qsTr("Password of your email account")
127 text: gmailSettings.imapPassword
128 onTextChanged: {
129 gmailSettings.imapPassword = text
130 gmailSettings.smtpPassword = text
131 }
132 119
133 echoMode: TextInput.Password 120 Kube.PasswordField {
134 } 121 id: pwField
122 Layout.fillWidth: true
135 123
136 Controls.CheckBox { 124 placeholderText: qsTr("Password of your email account")
137 text: qsTr("Show Password") 125 text: gmailSettings.imapPassword
138 onClicked: { 126 onTextChanged: {
139 if(pwField.echoMode == TextInput.Password) { 127 gmailSettings.imapPassword = text
140 pwField.echoMode = TextInput.Normal; 128 gmailSettings.smtpPassword = text
141 } else {
142 pwField.echoMode = TextInput.Password;
143 }
144 }
145 } 129 }
146 } 130 }
147 } 131 }
diff --git a/accounts/imap/package/contents/ui/ImapAccountSettings.qml b/accounts/imap/package/contents/ui/ImapAccountSettings.qml
index 332b2bbe..26a41541 100644
--- a/accounts/imap/package/contents/ui/ImapAccountSettings.qml
+++ b/accounts/imap/package/contents/ui/ImapAccountSettings.qml
@@ -102,32 +102,16 @@ Item {
102 text: qsTr("Password") 102 text: qsTr("Password")
103 Layout.alignment: Qt.AlignRight 103 Layout.alignment: Qt.AlignRight
104 } 104 }
105 RowLayout {
106 Layout.fillWidth: true
107
108 Kube.TextField {
109 id: pwField
110 Layout.fillWidth: true
111
112 placeholderText: qsTr("Password of your email account")
113 text: imapSettings.imapPassword
114 onTextChanged: {
115 imapSettings.imapPassword = text
116 imapSettings.smtpPassword = text
117 }
118 105
119 echoMode: TextInput.Password 106 Kube.PasswordField {
120 } 107 id: pwField
108 Layout.fillWidth: true
121 109
122 Controls.CheckBox { 110 placeholderText: qsTr("Password of your email account")
123 text: qsTr("Show Password") 111 text: imapSettings.imapPassword
124 onClicked: { 112 onTextChanged: {
125 if(pwField.echoMode == TextInput.Password) { 113 imapSettings.imapPassword = text
126 pwField.echoMode = TextInput.Normal; 114 imapSettings.smtpPassword = text
127 } else {
128 pwField.echoMode = TextInput.Password;
129 }
130 }
131 } 115 }
132 } 116 }
133 117
diff --git a/accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml b/accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml
index c691c44a..b2048827 100644
--- a/accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml
+++ b/accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml
@@ -100,7 +100,7 @@ Item {
100 Layout.alignment: Qt.AlignRight 100 Layout.alignment: Qt.AlignRight
101 } 101 }
102 102
103 Kube.TextField { 103 Kube.PasswordField {
104 id: pwField 104 id: pwField
105 Layout.fillWidth: true 105 Layout.fillWidth: true
106 106
@@ -110,20 +110,6 @@ Item {
110 kolabnowSettings.imapPassword = text 110 kolabnowSettings.imapPassword = text
111 kolabnowSettings.smtpPassword = text 111 kolabnowSettings.smtpPassword = text
112 } 112 }
113
114 echoMode: pwCheck.checked ? TextInput.Normal : TextInput.Password
115 }
116
117 Kube.Label {
118 text: ""
119 }
120 RowLayout {
121 Kube.CheckBox {
122 id: pwCheck
123 }
124 Kube.Label {
125 text: qsTr("Show Password")
126 }
127 } 113 }
128 } 114 }
129 } 115 }
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
19import QtQuick 2.7
20import org.kube.framework 1.0 as Kube
21
22Kube.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
23PositiveButton 1.0 PositiveButton.qml 23PositiveButton 1.0 PositiveButton.qml
24TextButton 1.0 TextButton.qml 24TextButton 1.0 TextButton.qml
25TextField 1.0 TextField.qml 25TextField 1.0 TextField.qml
26PasswordField 1.0 PasswordField.qml
26TextArea 1.0 TextArea.qml 27TextArea 1.0 TextArea.qml
27TextEditor 1.0 TextEditor.qml 28TextEditor 1.0 TextEditor.qml
28ToolTip 1.0 ToolTip.qml 29ToolTip 1.0 ToolTip.qml