feat(BackUpSeedModal) added enter key press handling

Closes #8309
This commit is contained in:
Alexandra Betouni 2023-08-11 13:17:28 +03:00
parent e6f9bfdcdd
commit 0676f49f4c
7 changed files with 22 additions and 99 deletions

View File

@ -47,10 +47,6 @@ SplitView {
MintTokensSettingsPanel { MintTokensSettingsPanel {
id: panel id: panel
chainName: "Optimism"
totalFeeText: "0.00001 ($123.7)"
feeErrorText: "frndeufire"
generalAccountErrorText: "fgreudfighlre"
MintedTokensModel { MintedTokensModel {
id: mintedTokensModel id: mintedTokensModel

View File

@ -9,23 +9,6 @@ import AppLayouts.Communities.popups 1.0
SplitView { SplitView {
Logs { id: logs } Logs { id: logs }
ListModel {
id: accountsModel
ListElement {
name: "Test account"
emoji: "😋"
address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240"
color: "red"
}
ListElement {
name: "Another account - generated"
emoji: "🚗"
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8888"
color: "blue"
}
}
SplitView { SplitView {
orientation: Qt.Vertical orientation: Qt.Vertical
@ -52,11 +35,7 @@ SplitView {
anchors.centerIn: parent anchors.centerIn: parent
collectibleName: editorCollectible.text collectibleName: editorCollectible.text
model: TokenHoldersModel {} model: TokenHoldersModel {}
accounts: accountsModel
chainName: "Optimism"
totalFeeText: "0.00001 ($123.7)"
feeErrorText: "ghreoghreui"
generalAccountErrorText: "fhirfghryeruof"
onRemotelyDestructClicked: logs.logEvent("RemoteSelfDestructPopup::onRemotelyDestructClicked") onRemotelyDestructClicked: logs.logEvent("RemoteSelfDestructPopup::onRemotelyDestructClicked")
Component.onCompleted: { Component.onCompleted: {

View File

@ -54,9 +54,6 @@ StackView {
property string feeText property string feeText
property string feeErrorText property string feeErrorText
property bool isFeeLoading: true property bool isFeeLoading: true
property string chainName
property string totalFeeText
property string generalAccountErrorText: ""
// Network related properties: // Network related properties:
property var layer1Networks property var layer1Networks
@ -633,11 +630,6 @@ StackView {
collectibleName: view.token.name collectibleName: view.token.name
model: view.tokenOwnersModel || null model: view.tokenOwnersModel || null
accounts: root.accounts
chainName: root.chainName
totalFeeText: root.totalFeeText
feeErrorText: root.feeErrorText
generalAccountErrorText: root.generalAccountErrorText
onRemotelyDestructClicked: { onRemotelyDestructClicked: {
remotelyDestructPopup.close() remotelyDestructPopup.close()

View File

@ -31,7 +31,7 @@ Item {
readonly property alias sortBy: d.sortBy readonly property alias sortBy: d.sortBy
readonly property alias sortOrder: d.sorting readonly property alias sortOrder: d.sorting
readonly property bool bottomSeparatorVisible: ((listView.contentY > 0) && readonly property bool bottomSeparatorVisible: ((listView.contentY > 0) &&
(listView.contentY < (listView.contentHeight - listView.height))) (listView.contentY < (listView.contentHeight - listView.height - 40/*margins*/)))
signal selfDestructAmountChanged(string walletAddress, int amount) signal selfDestructAmountChanged(string walletAddress, int amount)
signal selfDestructRemoved(string walletAddress) signal selfDestructRemoved(string walletAddress)

View File

@ -10,7 +10,6 @@ import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1 import StatusQ.Core.Utils 0.1
import AppLayouts.Communities.panels 1.0 import AppLayouts.Communities.panels 1.0
import SortFilterProxyModel 0.2
import utils 1.0 import utils 1.0
@ -18,18 +17,10 @@ StatusDialog {
id: root id: root
property alias model: tokenHoldersPanel.model property alias model: tokenHoldersPanel.model
property string collectibleName
property string chainName
property string totalFeeText
property bool isFeeLoading
property string feeErrorText: ""
property string generalAccountErrorText: ""
property string feeLabel: qsTr("Remotely destruct %1 token on %2").arg(root.collectibleName).arg(root.chainName)
property string feePlaceholderText: qsTr("Select a hodler to see remote destruction gas fees")
// Account expected roles: address, name, color, emoji, walletType
property var accounts
signal remotelyDestructClicked(int tokenCount, var remotelyDestructTokensList)
property string collectibleName
signal remotelyDestructClicked(int tokenCount, var remotelyDestructTokensList)
QtObject { QtObject {
id: d id: d
@ -72,59 +63,13 @@ StatusDialog {
implicitWidth: 600 // by design implicitWidth: 600 // by design
padding: 0 padding: 0
contentItem: ColumnLayout { contentItem: TokenHoldersPanel {
spacing: 16
TokenHoldersPanel {
id: tokenHoldersPanel id: tokenHoldersPanel
tokenName: root.collectibleName tokenName: root.collectibleName
Layout.fillWidth: true
Layout.fillHeight: true
isSelectorMode: true isSelectorMode: true
onSelfDestructAmountChanged: d.updateTokensToDestruct(walletAddress, amount) onSelfDestructAmountChanged: d.updateTokensToDestruct(walletAddress, amount)
onSelfDestructRemoved: d.clearTokensToDesctruct(walletAddress) onSelfDestructRemoved: d.clearTokensToDesctruct(walletAddress)
} }
FeesBox {
Layout.fillWidth: true
Layout.bottomMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16
implicitWidth: 0
totalFeeText: root.totalFeeText
generalErrorText: root.generalAccountErrorText
accountErrorText: root.feeErrorText
placeholderText: root.feePlaceholderText
showAccountsSelector: true
model: d.tokenCount > 0 ? singleFeeModel : undefined
accountsSelector.model: SortFilterProxyModel {
sourceModel: root.accounts
proxyRoles: [
ExpressionRole {
name: "color"
function getColor(colorId) {
return Utils.getColorForId(colorId)
}
// Direct call for singleton function is not handled properly by
// SortFilterProxyModel that's why helper function is used instead.
expression: { return getColor(model.colorId) }
}
]
filters: ValueFilter {
roleName: "walletType"
value: Constants.watchWalletType
inverted: true
}
}
QtObject {
id: singleFeeModel
readonly property string title: root.feeLabel
readonly property string feeText: root.isFeeLoading ?
"" : root.feeText
readonly property bool error: d.isFeeError
}
}
}
footer: StatusDialogFooter { footer: StatusDialogFooter {
spacing: Style.current.padding spacing: Style.current.padding

View File

@ -66,6 +66,7 @@ StatusStackModal {
rightButtons: [ d.skipButton, nextButton, finishButton ] rightButtons: [ d.skipButton, nextButton, finishButton ]
nextButton: StatusButton { nextButton: StatusButton {
id: nextButton
objectName: "BackupSeedModal_nextButton" objectName: "BackupSeedModal_nextButton"
enabled: { enabled: {
switch (root.currentIndex) { switch (root.currentIndex) {
@ -136,6 +137,9 @@ StatusStackModal {
titleText: qsTr("Confirm word #%1 of your seed phrase").arg(d.firstRandomNo + 1) titleText: qsTr("Confirm word #%1 of your seed phrase").arg(d.firstRandomNo + 1)
wordRandomNumber: d.firstRandomNo wordRandomNumber: d.firstRandomNo
wordAtRandomNumber: root.privacyStore.getMnemonicWordAtIndex(d.firstRandomNo) wordAtRandomNumber: root.privacyStore.getMnemonicWordAtIndex(d.firstRandomNo)
onEnterPressed: {
nextButton.clicked();
}
}, },
BackupSeedStepBase { BackupSeedStepBase {
id: confirmSecondWord id: confirmSecondWord

View File

@ -20,6 +20,8 @@ StatusScrollView {
default property alias content: column.children default property alias content: column.children
signal enterPressed()
function forceInputFocus() { function forceInputFocus() {
inputText.input.edit.forceActiveFocus(); inputText.input.edit.forceActiveFocus();
} }
@ -54,6 +56,11 @@ StatusScrollView {
} }
] ]
Layout.fillWidth: true Layout.fillWidth: true
onKeyPressed: {
if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && inputText.valid) {
root.enterPressed();
}
}
} }
} }
} }