status-desktop/ui/app/AppLayouts/Chat/ChatColumn/ChatComponents/ChatCommandModal.qml

179 lines
6.2 KiB
QML
Raw Normal View History

2020-09-03 20:14:44 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import QtQuick.Dialogs 1.3
import "../../../../../imports"
import "../../../../../shared"
import "../../../../../shared/status"
ModalPopup {
property string commandTitle: "Send"
property string finalButtonLabel: "Request address"
property var sendChatCommand: function () {}
property bool isRequested: false
2020-09-03 20:14:44 +00:00
id: root
title: root.commandTitle
height: 504
property alias selectRecipient: selectRecipient
2020-09-03 20:14:44 +00:00
TransactionStackView {
id: stack
anchors.fill: parent
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
onGroupActivated: {
root.title = group.headerText
2020-09-17 09:08:31 +00:00
btnNext.text = group.footerText
2020-09-03 20:14:44 +00:00
}
TransactionFormGroup {
id: group1
headerText: root.commandTitle
//% "Continue"
footerText: qsTrId("continue")
2020-09-03 20:14:44 +00:00
AccountSelector {
id: selectFromAccount
refactor wallet views add getSettings methods to src/status fix issue with calling getSettings; document issue remove most direct references to libstatus; document some common issues remove most references to libstatus wallet add mailserver layer to status lib; remove references to libstatus mailservers remove libstatus accounts references move types out of libstatus; remove libstatus types references remove libstatus browser references refactor libstatus utils references remove more references to libstatus stickers remove references to libstatus constants from src/app remove more libstatus references from src/app refactor token_list usage of libstatus refactor stickers usage of libstatus refactor chat usage of libstatus remove libstatus references from the wallet view remove logic from ens manager view fix issue with import & namespace conflict remove unnecessary imports refactor provider view to not depend on libstatus refactor provider view refactor: move accounts specific code to its own section fix account selection move collectibles to their own module update references to wallet transactions refactor: move gas methods to their own file refactor: extract tokens into their own file refactor: extract ens to its own file refactor: extract dappbrowser code to its own file refactor: extract history related code to its own file refactor: extract balance to its own file refactor: extract utils to its own file clean up wallet imports fix: identicon for transaction commands Fixes #2533
2021-06-08 12:48:31 +00:00
accounts: walletModel.accountsView.accounts
selectedAccount: {
refactor wallet views add getSettings methods to src/status fix issue with calling getSettings; document issue remove most direct references to libstatus; document some common issues remove most references to libstatus wallet add mailserver layer to status lib; remove references to libstatus mailservers remove libstatus accounts references move types out of libstatus; remove libstatus types references remove libstatus browser references refactor libstatus utils references remove more references to libstatus stickers remove references to libstatus constants from src/app remove more libstatus references from src/app refactor token_list usage of libstatus refactor stickers usage of libstatus refactor chat usage of libstatus remove libstatus references from the wallet view remove logic from ens manager view fix issue with import & namespace conflict remove unnecessary imports refactor provider view to not depend on libstatus refactor provider view refactor: move accounts specific code to its own section fix account selection move collectibles to their own module update references to wallet transactions refactor: move gas methods to their own file refactor: extract tokens into their own file refactor: extract ens to its own file refactor: extract dappbrowser code to its own file refactor: extract history related code to its own file refactor: extract balance to its own file refactor: extract utils to its own file clean up wallet imports fix: identicon for transaction commands Fixes #2533
2021-06-08 12:48:31 +00:00
const currAcc = walletModel.accountsView.currentAccount
if (currAcc.walletType !== Constants.watchWalletType) {
return currAcc
}
return null
}
refactor wallet views add getSettings methods to src/status fix issue with calling getSettings; document issue remove most direct references to libstatus; document some common issues remove most references to libstatus wallet add mailserver layer to status lib; remove references to libstatus mailservers remove libstatus accounts references move types out of libstatus; remove libstatus types references remove libstatus browser references refactor libstatus utils references remove more references to libstatus stickers remove references to libstatus constants from src/app remove more libstatus references from src/app refactor token_list usage of libstatus refactor stickers usage of libstatus refactor chat usage of libstatus remove libstatus references from the wallet view remove logic from ens manager view fix issue with import & namespace conflict remove unnecessary imports refactor provider view to not depend on libstatus refactor provider view refactor: move accounts specific code to its own section fix account selection move collectibles to their own module update references to wallet transactions refactor: move gas methods to their own file refactor: extract tokens into their own file refactor: extract ens to its own file refactor: extract dappbrowser code to its own file refactor: extract history related code to its own file refactor: extract balance to its own file refactor: extract utils to its own file clean up wallet imports fix: identicon for transaction commands Fixes #2533
2021-06-08 12:48:31 +00:00
currency: walletModel.balanceView.defaultCurrency
2020-09-03 20:14:44 +00:00
width: stack.width
label: {
return root.isRequested ?
2021-02-18 16:36:05 +00:00
//% "Receive on account"
qsTrId("receive-on-account") :
//% "From account"
qsTrId("from-account")
}
2020-09-03 20:14:44 +00:00
}
SeparatorWithIcon {
id: separator
anchors.top: selectFromAccount.bottom
anchors.topMargin: 19
icon.rotation: root.isRequested ? -90 : 90
2020-09-03 20:14:44 +00:00
}
StyledText {
id: addressRequiredInfo
anchors.right: selectRecipient.right
anchors.bottom: selectRecipient.top
anchors.bottomMargin: -Style.current.padding
2021-02-18 16:36:05 +00:00
//% "Address request required"
text: qsTrId("address-request-required")
color: Style.current.danger
visible: addressRequiredValidator.isWarn
}
2020-09-03 20:14:44 +00:00
RecipientSelector {
id: selectRecipient
refactor wallet views add getSettings methods to src/status fix issue with calling getSettings; document issue remove most direct references to libstatus; document some common issues remove most references to libstatus wallet add mailserver layer to status lib; remove references to libstatus mailservers remove libstatus accounts references move types out of libstatus; remove libstatus types references remove libstatus browser references refactor libstatus utils references remove more references to libstatus stickers remove references to libstatus constants from src/app remove more libstatus references from src/app refactor token_list usage of libstatus refactor stickers usage of libstatus refactor chat usage of libstatus remove libstatus references from the wallet view remove logic from ens manager view fix issue with import & namespace conflict remove unnecessary imports refactor provider view to not depend on libstatus refactor provider view refactor: move accounts specific code to its own section fix account selection move collectibles to their own module update references to wallet transactions refactor: move gas methods to their own file refactor: extract tokens into their own file refactor: extract ens to its own file refactor: extract dappbrowser code to its own file refactor: extract history related code to its own file refactor: extract balance to its own file refactor: extract utils to its own file clean up wallet imports fix: identicon for transaction commands Fixes #2533
2021-06-08 12:48:31 +00:00
accounts: walletModel.accountsView.accounts
2020-12-06 22:15:51 +00:00
contacts: profileModel.contacts.addedContacts
label: root.isRequested ?
2021-02-18 16:36:05 +00:00
//% "From"
qsTrId("from") :
//% "To"
qsTrId("to")
2020-09-03 20:14:44 +00:00
anchors.top: separator.bottom
anchors.topMargin: 10
width: stack.width
onSelectedRecipientChanged: {
addressRequiredValidator.address = root.isRequested ? selectFromAccount.selectedAccount.address : selectRecipient.selectedRecipient.address
}
2020-09-03 20:14:44 +00:00
}
}
TransactionFormGroup {
id: group2
headerText: root.commandTitle
//% "Preview"
footerText: qsTrId("preview")
2020-09-03 20:14:44 +00:00
AssetAndAmountInput {
id: txtAmount
selectedAccount: selectFromAccount.selectedAccount
refactor wallet views add getSettings methods to src/status fix issue with calling getSettings; document issue remove most direct references to libstatus; document some common issues remove most references to libstatus wallet add mailserver layer to status lib; remove references to libstatus mailservers remove libstatus accounts references move types out of libstatus; remove libstatus types references remove libstatus browser references refactor libstatus utils references remove more references to libstatus stickers remove references to libstatus constants from src/app remove more libstatus references from src/app refactor token_list usage of libstatus refactor stickers usage of libstatus refactor chat usage of libstatus remove libstatus references from the wallet view remove logic from ens manager view fix issue with import & namespace conflict remove unnecessary imports refactor provider view to not depend on libstatus refactor provider view refactor: move accounts specific code to its own section fix account selection move collectibles to their own module update references to wallet transactions refactor: move gas methods to their own file refactor: extract tokens into their own file refactor: extract ens to its own file refactor: extract dappbrowser code to its own file refactor: extract history related code to its own file refactor: extract balance to its own file refactor: extract utils to its own file clean up wallet imports fix: identicon for transaction commands Fixes #2533
2021-06-08 12:48:31 +00:00
defaultCurrency: walletModel.balanceView.defaultCurrency
getFiatValue: walletModel.balanceView.getFiatValue
getCryptoValue: walletModel.balanceView.getCryptoValue
validateBalance: !root.isRequested
2020-09-03 20:14:44 +00:00
width: stack.width
}
}
TransactionFormGroup {
id: group3
headerText: root.isRequested ?
2021-02-18 16:36:05 +00:00
//% "Preview"
qsTrId("preview") :
//% "Transaction preview"
qsTrId("transaction-preview")
2020-09-03 20:14:44 +00:00
footerText: root.finalButtonLabel
TransactionPreview {
id: pvwTransaction
width: stack.width
fromAccount: root.isRequested ? selectRecipient.selectedRecipient : selectFromAccount.selectedAccount
toAccount: root.isRequested ? selectFromAccount.selectedAccount : selectRecipient.selectedRecipient
2020-09-03 20:14:44 +00:00
asset: txtAmount.selectedAsset
amount: { "value": txtAmount.selectedAmount, "fiatValue": txtAmount.selectedFiatAmount }
toWarn: addressRequiredValidator.isWarn
refactor wallet views add getSettings methods to src/status fix issue with calling getSettings; document issue remove most direct references to libstatus; document some common issues remove most references to libstatus wallet add mailserver layer to status lib; remove references to libstatus mailservers remove libstatus accounts references move types out of libstatus; remove libstatus types references remove libstatus browser references refactor libstatus utils references remove more references to libstatus stickers remove references to libstatus constants from src/app remove more libstatus references from src/app refactor token_list usage of libstatus refactor stickers usage of libstatus refactor chat usage of libstatus remove libstatus references from the wallet view remove logic from ens manager view fix issue with import & namespace conflict remove unnecessary imports refactor provider view to not depend on libstatus refactor provider view refactor: move accounts specific code to its own section fix account selection move collectibles to their own module update references to wallet transactions refactor: move gas methods to their own file refactor: extract tokens into their own file refactor: extract ens to its own file refactor: extract dappbrowser code to its own file refactor: extract history related code to its own file refactor: extract balance to its own file refactor: extract utils to its own file clean up wallet imports fix: identicon for transaction commands Fixes #2533
2021-06-08 12:48:31 +00:00
currency: walletModel.balanceView.defaultCurrency
2020-09-03 20:14:44 +00:00
}
AddressRequiredValidator {
id: addressRequiredValidator
2020-09-03 20:14:44 +00:00
anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.padding
2020-09-03 20:14:44 +00:00
}
}
}
footer: Item {
width: parent.width
height: btnNext.height
StatusRoundButton {
2020-09-03 20:14:44 +00:00
id: btnBack
anchors.left: parent.left
visible: !stack.isFirstGroup
icon.name: "arrow-right"
icon.width: 20
icon.height: 16
rotation: 180
2020-09-03 20:14:44 +00:00
onClicked: {
stack.back()
}
}
2020-09-17 09:08:31 +00:00
StatusButton {
2020-09-03 20:14:44 +00:00
id: btnNext
anchors.right: parent.right
//% "Next"
2020-09-17 09:08:31 +00:00
text: qsTrId("next")
enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending
2020-09-03 20:14:44 +00:00
onClicked: {
2020-09-17 09:08:31 +00:00
const validity = stack.currentGroup.validate()
if (validity.isValid && !validity.isPending) {
2020-09-03 20:14:44 +00:00
if (stack.isLastGroup) {
return root.sendChatCommand(selectFromAccount.selectedAccount.address,
txtAmount.selectedAmount,
txtAmount.selectedAsset.address,
txtAmount.selectedAsset.decimals)
2020-09-03 20:14:44 +00:00
}
stack.next()
}
}
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/