mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 03:59:38 +00:00
SettingsWallet: readd change password button
This commit is contained in:
parent
97de72b27d
commit
bea033b18a
2 changed files with 134 additions and 6 deletions
|
@ -40,6 +40,7 @@ Item {
|
||||||
visible: false
|
visible: false
|
||||||
z: parent.z + 2
|
z: parent.z + 2
|
||||||
|
|
||||||
|
property bool isHidden: true
|
||||||
property alias password: passwordInput1.text
|
property alias password: passwordInput1.text
|
||||||
|
|
||||||
// same signals as Dialog has
|
// same signals as Dialog has
|
||||||
|
@ -68,6 +69,12 @@ Item {
|
||||||
closeCallback();
|
closeCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleIsHidden() {
|
||||||
|
passwordInput1.echoMode = isHidden ? TextInput.Normal : TextInput.Password;
|
||||||
|
passwordInput2.echoMode = isHidden ? TextInput.Normal : TextInput.Password;
|
||||||
|
isHidden = !isHidden;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: implement without hardcoding sizes
|
// TODO: implement without hardcoding sizes
|
||||||
width: 480
|
width: 480
|
||||||
height: 360
|
height: 360
|
||||||
|
@ -119,6 +126,8 @@ Item {
|
||||||
leftPadding: 10
|
leftPadding: 10
|
||||||
topPadding: 10
|
topPadding: 10
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
color: MoneroComponents.Style.defaultFontColor
|
||||||
|
selectionColor: MoneroComponents.Style.dimmedFontColor
|
||||||
|
selectedTextColor: MoneroComponents.Style.defaultFontColor
|
||||||
KeyNavigation.tab: passwordInput2
|
KeyNavigation.tab: passwordInput2
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
@ -128,12 +137,32 @@ Item {
|
||||||
color: "black"
|
color: "black"
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
width: 12
|
width: 26 * scaleRatio
|
||||||
height: 16
|
height: 26 * scaleRatio
|
||||||
source: "../images/lockIcon.png"
|
opacity: 0.7
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
source: isHidden ? "../images/eyeShow.png" : "../images/eyeHide.png"
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 20
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,6 +207,8 @@ Item {
|
||||||
leftPadding: 10
|
leftPadding: 10
|
||||||
topPadding: 10
|
topPadding: 10
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
color: MoneroComponents.Style.defaultFontColor
|
||||||
|
selectionColor: MoneroComponents.Style.dimmedFontColor
|
||||||
|
selectedTextColor: MoneroComponents.Style.defaultFontColor
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
radius: 2
|
radius: 2
|
||||||
|
@ -186,12 +217,32 @@ Item {
|
||||||
color: "black"
|
color: "black"
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
width: 12
|
width: 26 * scaleRatio
|
||||||
height: 16
|
height: 26 * scaleRatio
|
||||||
source: "../images/lockIcon.png"
|
opacity: 0.7
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
source: isHidden ? "../images/eyeShow.png" : "../images/eyeHide.png"
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 20
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,6 +324,83 @@ Rectangle {
|
||||||
width: 135 * scaleRatio
|
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: {
|
Component.onCompleted: {
|
||||||
|
|
Loading…
Reference in a new issue