2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2020-06-11 19:52:54 +00:00
|
|
|
import "../../../imports"
|
|
|
|
import "../../../shared"
|
2020-06-30 20:01:37 +00:00
|
|
|
import "../../../sounds"
|
2020-06-11 19:52:54 +00:00
|
|
|
|
|
|
|
ModalPopup {
|
|
|
|
id: popup
|
|
|
|
title: qsTr("add custom token")
|
|
|
|
height: 630
|
|
|
|
|
|
|
|
property int marginBetweenInputs: 35
|
|
|
|
|
|
|
|
onOpened: {
|
|
|
|
accountNameInput.forceActiveFocus(Qt.MouseFocusReason)
|
|
|
|
}
|
|
|
|
|
2020-06-30 20:01:37 +00:00
|
|
|
Item {
|
|
|
|
ErrorSound {
|
|
|
|
id: errorSound
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-11 19:52:54 +00:00
|
|
|
Input {
|
|
|
|
id: addressInput
|
|
|
|
placeholderText: qsTr("Enter contract address...")
|
|
|
|
label: qsTr("Contract address")
|
|
|
|
}
|
|
|
|
|
|
|
|
Input {
|
|
|
|
id: nameInput
|
|
|
|
anchors.top: addressInput.bottom
|
|
|
|
anchors.topMargin: marginBetweenInputs
|
|
|
|
placeholderText: qsTr("The name of your token...")
|
|
|
|
label: qsTr("Name")
|
|
|
|
}
|
|
|
|
|
|
|
|
Input {
|
|
|
|
id: symbolInput
|
|
|
|
anchors.top: nameInput.bottom
|
|
|
|
anchors.topMargin: marginBetweenInputs
|
|
|
|
placeholderText: qsTr("ABC")
|
|
|
|
label: qsTr("Symbol")
|
|
|
|
}
|
|
|
|
|
|
|
|
Input {
|
|
|
|
id: decimalsInput
|
|
|
|
anchors.top: symbolInput.bottom
|
|
|
|
anchors.topMargin: marginBetweenInputs
|
|
|
|
label: qsTr("Decimals")
|
|
|
|
text: "18"
|
|
|
|
}
|
|
|
|
|
|
|
|
footer: Item {
|
|
|
|
anchors.fill: parent
|
|
|
|
StyledButton {
|
|
|
|
id: addBtn
|
|
|
|
anchors.top: parent.top
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.topMargin: Style.current.padding
|
2020-06-11 19:52:54 +00:00
|
|
|
anchors.right: parent.right
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.rightMargin: Style.current.padding
|
2020-06-11 19:52:54 +00:00
|
|
|
label: qsTr("Add")
|
|
|
|
|
|
|
|
disabled: addressInput.text === "" || nameInput.text === "" || symbolInput.text === "" || decimalsInput.text === ""
|
|
|
|
|
|
|
|
onClicked : {
|
|
|
|
const error = walletModel.addCustomToken(addressInput.text, nameInput.text, symbolInput.text, decimalsInput.text);
|
|
|
|
|
|
|
|
if (error) {
|
2020-06-30 20:01:37 +00:00
|
|
|
errorSound.play()
|
2020-06-11 19:52:54 +00:00
|
|
|
changeError.text = error
|
|
|
|
changeError.open()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
popup.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;autoSize:true;height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|