Permalink
Browse files

SettingsWallet: readd change password button

  • Loading branch information...
selsta committed Jan 8, 2019
1 parent 97de72b commit 4c047b7955b64c76efff71172238e243332880cb
Showing with 131 additions and 6 deletions.
  1. +54 −6 components/NewPasswordDialog.qml
  2. +77 −0 pages/settings/SettingsWallet.qml
@@ -40,6 +40,8 @@ Item {
visible: false
z: parent.z + 2

property bool isHidden1: true
property bool isHidden2: true
property alias password: passwordInput1.text

// same signals as Dialog has
@@ -119,6 +121,8 @@ Item {
leftPadding: 10
topPadding: 10
color: MoneroComponents.Style.defaultFontColor
selectionColor: MoneroComponents.Style.dimmedFontColor
selectedTextColor: MoneroComponents.Style.defaultFontColor
KeyNavigation.tab: passwordInput2

background: Rectangle {
@@ -128,12 +132,33 @@ 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: isHidden1 ? "../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: {
passwordInput1.echoMode = isHidden1 ? TextInput.Normal : TextInput.Password;
isHidden1 = !isHidden1;
}
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
}
}
}
}

@@ -178,6 +203,8 @@ Item {
leftPadding: 10
topPadding: 10
color: MoneroComponents.Style.defaultFontColor
selectionColor: MoneroComponents.Style.dimmedFontColor
selectedTextColor: MoneroComponents.Style.defaultFontColor

background: Rectangle {
radius: 2
@@ -186,12 +213,33 @@ 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: isHidden2 ? "../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: {
passwordInput2.echoMode = isHidden2 ? TextInput.Normal : TextInput.Password;
isHidden2 = !isHidden2;
}
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
}
}
}
}

@@ -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: {

0 comments on commit 4c047b7

Please sign in to comment.