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 {
id: panel
chainName: "Optimism"
totalFeeText: "0.00001 ($123.7)"
feeErrorText: "frndeufire"
generalAccountErrorText: "fgreudfighlre"
MintedTokensModel {
id: mintedTokensModel

View File

@ -9,23 +9,6 @@ import AppLayouts.Communities.popups 1.0
SplitView {
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 {
orientation: Qt.Vertical
@ -52,11 +35,7 @@ SplitView {
anchors.centerIn: parent
collectibleName: editorCollectible.text
model: TokenHoldersModel {}
accounts: accountsModel
chainName: "Optimism"
totalFeeText: "0.00001 ($123.7)"
feeErrorText: "ghreoghreui"
generalAccountErrorText: "fhirfghryeruof"
onRemotelyDestructClicked: logs.logEvent("RemoteSelfDestructPopup::onRemotelyDestructClicked")
Component.onCompleted: {

View File

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

View File

@ -31,7 +31,7 @@ Item {
readonly property alias sortBy: d.sortBy
readonly property alias sortOrder: d.sorting
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 selfDestructRemoved(string walletAddress)

View File

@ -10,7 +10,6 @@ import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1
import AppLayouts.Communities.panels 1.0
import SortFilterProxyModel 0.2
import utils 1.0
@ -18,18 +17,10 @@ StatusDialog {
id: root
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 {
id: d
@ -72,58 +63,12 @@ StatusDialog {
implicitWidth: 600 // by design
padding: 0
contentItem: ColumnLayout {
spacing: 16
TokenHoldersPanel {
id: tokenHoldersPanel
tokenName: root.collectibleName
Layout.fillWidth: true
Layout.fillHeight: true
isSelectorMode: true
onSelfDestructAmountChanged: d.updateTokensToDestruct(walletAddress, amount)
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
}
}
contentItem: TokenHoldersPanel {
id: tokenHoldersPanel
tokenName: root.collectibleName
isSelectorMode: true
onSelfDestructAmountChanged: d.updateTokensToDestruct(walletAddress, amount)
onSelfDestructRemoved: d.clearTokensToDesctruct(walletAddress)
}
footer: StatusDialogFooter {

View File

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

View File

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