mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-10 03:42:05 +02:00
password dialog: show error in place
This commit is contained in:
parent
3aa6da058a
commit
39855241fc
@ -42,15 +42,17 @@ Item {
|
|||||||
|
|
||||||
property alias password: passwordInput.text
|
property alias password: passwordInput.text
|
||||||
property string walletName
|
property string walletName
|
||||||
|
property string errorText
|
||||||
|
|
||||||
// same signals as Dialog has
|
// same signals as Dialog has
|
||||||
signal accepted()
|
signal accepted()
|
||||||
signal rejected()
|
signal rejected()
|
||||||
signal closeCallback()
|
signal closeCallback()
|
||||||
|
|
||||||
function open(walletName) {
|
function open(walletName, errorText) {
|
||||||
inactiveOverlay.visible = true // draw appwindow inactive
|
inactiveOverlay.visible = true // draw appwindow inactive
|
||||||
root.walletName = walletName ? walletName : ""
|
root.walletName = walletName ? walletName : ""
|
||||||
|
root.errorText = errorText ? errorText : "";
|
||||||
leftPanel.enabled = false
|
leftPanel.enabled = false
|
||||||
middlePanel.enabled = false
|
middlePanel.enabled = false
|
||||||
titleBar.enabled = false
|
titleBar.enabled = false
|
||||||
@ -60,6 +62,10 @@ Item {
|
|||||||
passwordInput.text = ""
|
passwordInput.text = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showError(errorText) {
|
||||||
|
open(root.walletName, errorText);
|
||||||
|
}
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
inactiveOverlay.visible = false
|
inactiveOverlay.visible = false
|
||||||
leftPanel.enabled = true
|
leftPanel.enabled = true
|
||||||
@ -93,6 +99,18 @@ Item {
|
|||||||
color: MoneroComponents.Style.defaultFontColor
|
color: MoneroComponents.Style.defaultFontColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: root.errorText
|
||||||
|
visible: root.errorText
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
color: MoneroComponents.Style.errorColor
|
||||||
|
font.pixelSize: 16 * scaleRatio
|
||||||
|
font.family: MoneroComponents.Style.fontLight.name
|
||||||
|
Layout.fillWidth: true
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id : passwordInput
|
id : passwordInput
|
||||||
Layout.topMargin: 6
|
Layout.topMargin: 6
|
||||||
|
@ -12,6 +12,7 @@ QtObject {
|
|||||||
|
|
||||||
property string defaultFontColor: "white"
|
property string defaultFontColor: "white"
|
||||||
property string dimmedFontColor: "#BBBBBB"
|
property string dimmedFontColor: "#BBBBBB"
|
||||||
|
property string errorColor: "#FA6800"
|
||||||
property string inputBoxBackground: "black"
|
property string inputBoxBackground: "black"
|
||||||
property string inputBoxBackgroundError: "#FFDDDD"
|
property string inputBoxBackgroundError: "#FFDDDD"
|
||||||
property string inputBoxColor: "white"
|
property string inputBoxColor: "white"
|
||||||
|
@ -39,12 +39,7 @@ function showSeedPage() {
|
|||||||
// Load keys page
|
// Load keys page
|
||||||
appWindow.showPageRequest("Keys");
|
appWindow.showPageRequest("Keys");
|
||||||
} else {
|
} else {
|
||||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
passwordDialog.showError(qsTr("Wrong password"));
|
||||||
informationPopup.text = qsTr("Wrong password");
|
|
||||||
informationPopup.open()
|
|
||||||
informationPopup.onCloseCallback = function() {
|
|
||||||
passwordDialog.open()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
passwordDialog.onRejectedCallback = function() {
|
passwordDialog.onRejectedCallback = function() {
|
||||||
|
15
main.qml
15
main.qml
@ -397,15 +397,9 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
// opening with password but password doesn't match
|
// opening with password but password doesn't match
|
||||||
console.error("Error opening wallet with password: ", wallet.errorString);
|
console.error("Error opening wallet with password: ", wallet.errorString);
|
||||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
passwordDialog.showError(qsTr("Couldn't open wallet: ") + wallet.errorString);
|
||||||
informationPopup.text = qsTr("Couldn't open wallet: ") + wallet.errorString;
|
|
||||||
informationPopup.icon = StandardIcon.Critical
|
|
||||||
console.log("closing wallet async : " + wallet.address)
|
console.log("closing wallet async : " + wallet.address)
|
||||||
closeWallet();
|
closeWallet();
|
||||||
informationPopup.open()
|
|
||||||
informationPopup.onCloseCallback = function() {
|
|
||||||
passwordDialog.open(walletName)
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1064,12 +1058,7 @@ ApplicationWindow {
|
|||||||
handleTransactionConfirmed()
|
handleTransactionConfirmed()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
passwordDialog.showError(qsTr("Wrong password"));
|
||||||
informationPopup.text = qsTr("Wrong password");
|
|
||||||
informationPopup.open()
|
|
||||||
informationPopup.onCloseCallback = function() {
|
|
||||||
passwordDialog.open()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
passwordDialog.onRejectedCallback = null;
|
passwordDialog.onRejectedCallback = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user