aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-01-21 14:53:45 -0600
committerluigi1111 <luigi1111w@gmail.com>2019-01-21 14:53:45 -0600
commite68d922a0cb18a94051004e6da96dd9a0ea49ab8 (patch)
treea130de63585ddcedb57f1e0c3ed4c90efcc6a960
parenta6824c68022d0f836e68f372f98f6649248d7264 (diff)
parentbea033b18a0786605c5c5fe3ec80c92c606cacd1 (diff)
downloadmonzero-gui-e68d922a0cb18a94051004e6da96dd9a0ea49ab8.tar.gz
monzero-gui-e68d922a0cb18a94051004e6da96dd9a0ea49ab8.tar.xz
monzero-gui-e68d922a0cb18a94051004e6da96dd9a0ea49ab8.zip
Merge pull request #1886
bea033b SettingsWallet: readd change password button (selsta)
-rw-r--r--components/NewPasswordDialog.qml63
-rw-r--r--pages/settings/SettingsWallet.qml77
2 files changed, 134 insertions, 6 deletions
diff --git a/components/NewPasswordDialog.qml b/components/NewPasswordDialog.qml
index ad2e77ec..2ee1fb8a 100644
--- a/components/NewPasswordDialog.qml
+++ b/components/NewPasswordDialog.qml
@@ -40,6 +40,7 @@ Item {
visible: false
z: parent.z + 2
+ property bool isHidden: true
property alias password: passwordInput1.text
// same signals as Dialog has
@@ -67,6 +68,12 @@ Item {
root.visible = false;
closeCallback();
}
+
+ function toggleIsHidden() {
+ passwordInput1.echoMode = isHidden ? TextInput.Normal : TextInput.Password;
+ passwordInput2.echoMode = isHidden ? TextInput.Normal : TextInput.Password;
+ isHidden = !isHidden;
+ }
// TODO: implement without hardcoding sizes
width: 480
@@ -117,6 +124,8 @@ Item {
leftPadding: 10
topPadding: 10
color: MoneroComponents.Style.defaultFontColor
+ selectionColor: MoneroComponents.Style.dimmedFontColor
+ selectedTextColor: MoneroComponents.Style.defaultFontColor
KeyNavigation.tab: passwordInput2
background: Rectangle {
@@ -126,12 +135,32 @@ Item {
color: "black"
Image {
- width: 12
- height: 16
- source: "../images/lockIcon.png"
+ width: 26 * scaleRatio
+ height: 26 * scaleRatio
+ opacity: 0.7
+ fillMode: Image.PreserveAspectFit
+ source: isHidden ? "../images/eyeShow.png" : "../images/eyeHide.png"
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 20
+ MouseArea {
+ anchors.fill: parent
+ cursorShape: Qt.PointingHandCursor
+ hoverEnabled: true
+ onClicked: {
+ toggleIsHidden()
+ }
+ onEntered: {
+ parent.opacity = 0.9
+ parent.width = 28 * scaleRatio
+ parent.height = 28 * scaleRatio
+ }
+ onExited: {
+ parent.opacity = 0.7
+ parent.width = 26 * scaleRatio
+ parent.height = 26 * scaleRatio
+ }
+ }
}
}
@@ -174,6 +203,8 @@ Item {
leftPadding: 10
topPadding: 10
color: MoneroComponents.Style.defaultFontColor
+ selectionColor: MoneroComponents.Style.dimmedFontColor
+ selectedTextColor: MoneroComponents.Style.defaultFontColor
background: Rectangle {
radius: 2
@@ -182,12 +213,32 @@ Item {
color: "black"
Image {
- width: 12
- height: 16
- source: "../images/lockIcon.png"
+ width: 26 * scaleRatio
+ height: 26 * scaleRatio
+ opacity: 0.7
+ fillMode: Image.PreserveAspectFit
+ source: isHidden ? "../images/eyeShow.png" : "../images/eyeHide.png"
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 20
+ MouseArea {
+ anchors.fill: parent
+ cursorShape: Qt.PointingHandCursor
+ hoverEnabled: true
+ onClicked: {
+ toggleIsHidden()
+ }
+ onEntered: {
+ parent.opacity = 0.9
+ parent.width = 28 * scaleRatio
+ parent.height = 28 * scaleRatio
+ }
+ onExited: {
+ parent.opacity = 0.7
+ parent.width = 26 * scaleRatio
+ parent.height = 26 * scaleRatio
+ }
+ }
}
}
diff --git a/pages/settings/SettingsWallet.qml b/pages/settings/SettingsWallet.qml
index 7998a328..9e6ac723 100644
--- a/pages/settings/SettingsWallet.qml
+++ b/pages/settings/SettingsWallet.qml
@@ -324,6 +324,83 @@ Rectangle {
width: 135 * scaleRatio
}
}
+ Rectangle {
+ // divider
+ Layout.preferredHeight: 1 * scaleRatio
+ Layout.fillWidth: true
+ Layout.topMargin: 8 * scaleRatio
+ Layout.bottomMargin: 8 * scaleRatio
+ color: MoneroComponents.Style.dividerColor
+ opacity: MoneroComponents.Style.dividerOpacity
+ }
+
+ GridLayout {
+ Layout.fillWidth: true
+ Layout.preferredHeight: settingsWallet.itemHeight
+ columnSpacing: 0
+
+ ColumnLayout {
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignVCenter
+ spacing: 0
+
+ Text {
+ Layout.fillWidth: true
+ Layout.preferredHeight: 20 * scaleRatio
+ Layout.topMargin: 8 * scaleRatio
+ color: "white"
+ font.bold: true
+ font.family: MoneroComponents.Style.fontRegular.name
+ font.pixelSize: 16 * scaleRatio
+ text: qsTr("Change wallet password") + translationManager.emptyString
+ }
+
+ TextArea {
+ Layout.fillWidth: true
+ color: MoneroComponents.Style.dimmedFontColor
+ font.family: MoneroComponents.Style.fontRegular.name
+ font.pixelSize: 14 * scaleRatio
+ horizontalAlignment: TextInput.AlignLeft
+ selectByMouse: false
+ wrapMode: Text.WordWrap;
+ textMargin: 0
+ leftPadding: 0
+ topPadding: 0
+ text: qsTr("Change the password of your wallet.") + translationManager.emptyString
+ width: parent.width
+ readOnly: true
+
+ // @TODO: Legacy. Remove after Qt 5.8.
+ // https://stackoverflow.com/questions/41990013
+ MouseArea {
+ anchors.fill: parent
+ enabled: false
+ }
+ }
+ }
+
+ MoneroComponents.StandardButton {
+ small: true
+ text: qsTr("Change password") + translationManager.emptyString
+ onClicked: {
+ passwordDialog.onAcceptedCallback = function() {
+ if(appWindow.walletPassword === passwordDialog.password){
+ newPasswordDialog.open()
+ } else {
+ informationPopup.title = qsTr("Error") + translationManager.emptyString;
+ informationPopup.text = qsTr("Wrong password");
+ informationPopup.open()
+ informationPopup.onCloseCallback = function() {
+ passwordDialog.open()
+ }
+ }
+ }
+ passwordDialog.onRejectedCallback = null;
+ passwordDialog.open()
+ }
+ width: 135 * scaleRatio
+ }
+ }
}
Component.onCompleted: {