fix: code review

This commit is contained in:
Richard Ramos 2020-11-02 14:18:13 -04:00 committed by Iuri Matias
parent 9d771b53dc
commit c43f6baaa8
3 changed files with 29 additions and 32 deletions

View File

@ -18,19 +18,25 @@ ModalPopup {
height: editable ? 450 : 380 height: editable ? 450 : 380
onOpened: { onOpened: {
addressInput.forceActiveFocus(Qt.MouseFocusReason)
}
function openEditable(){
addressInput.text = ""; addressInput.text = "";
nameInput.text = ""; nameInput.text = "";
symbolInput.text = ""; symbolInput.text = "";
decimalsInput.text = ""; decimalsInput.text = "";
addressInput.forceActiveFocus(Qt.MouseFocusReason) editable = true;
open();
} }
function setData(address, name, symbol, decimals){ function openWithData(address, name, symbol, decimals){
addressInput.text = address; addressInput.text = address;
nameInput.text = name; nameInput.text = name;
symbolInput.text = symbol; symbolInput.text = symbol;
decimalsInput.text = decimals; decimalsInput.text = decimals;
editable = false; editable = false;
open();
} }
Input { Input {
@ -53,37 +59,34 @@ ModalPopup {
label: qsTrId("name") label: qsTrId("name")
} }
Input {
Item { id: symbolInput
width: 200 readOnly: !editable
//% "ABC"
placeholderText: qsTrId("abc")
//% "Symbol"
label: qsTrId("symbol")
anchors.top: nameInput.bottom anchors.top: nameInput.bottom
anchors.topMargin: marginBetweenInputs anchors.topMargin: marginBetweenInputs
anchors.left: parent.left anchors.left: parent.left
Input { anchors.right: undefined
id: symbolInput width: parent.width / 2 - 20
readOnly: !editable
//% "ABC"
placeholderText: qsTrId("abc")
//% "Symbol"
label: qsTrId("symbol")
}
} }
Item { Input {
width: 200 id: decimalsInput
readOnly: !editable
placeholderText: "18"
//% "Decimals"
label: qsTrId("decimals")
text: "18"
anchors.top: nameInput.bottom anchors.top: nameInput.bottom
anchors.topMargin: marginBetweenInputs anchors.topMargin: marginBetweenInputs
anchors.right: parent.right anchors.right: parent.right
Input { anchors.left: undefined
id: decimalsInput width: parent.width / 2 - 20
readOnly: !editable
//% "Decimals"
label: qsTrId("decimals")
text: "18"
}
} }
footer: Item { footer: Item {
visible: editable visible: editable
anchors.fill: parent anchors.fill: parent

View File

@ -20,10 +20,7 @@ ModalPopup {
//% "Add custom token" //% "Add custom token"
label: qsTrId("add-custom-token") label: qsTrId("add-custom-token")
anchors.top: parent.top anchors.top: parent.top
onClicked: { onClicked: addCustomTokenModal.openEditable()
addCustomTokenModal.editable = true;
addCustomTokenModal.open()
}
} }
} }

View File

@ -78,10 +78,7 @@ Item {
icon.source: "../../../img/make-admin.svg" icon.source: "../../../img/make-admin.svg"
//% "Token details" //% "Token details"
text: qsTrId("token-details") text: qsTrId("token-details")
onTriggered: { onTriggered: addCustomTokenModal.openWithData(address, name, symbol, decimals)
addCustomTokenModal.open()
addCustomTokenModal.setData(address, name, symbol, decimals)
}
} }
Action { Action {
icon.source: "../../../img/remove-from-group.svg" icon.source: "../../../img/remove-from-group.svg"