fix(AddAccount): Derivation path drop down is empty

- use `StatusListView` for the popup/menu contentItem
- add the menu to SB too

Fixes #16635
This commit is contained in:
Lukáš Tinkl 2024-10-29 12:28:57 +01:00 committed by Lukáš Tinkl
parent f1ae8a2652
commit 0b67555ee1
5 changed files with 63 additions and 40 deletions

View File

@ -11,6 +11,32 @@ import utils 1.0
import shared.popups.addaccount.panels 1.0 import shared.popups.addaccount.panels 1.0
SplitView { SplitView {
id: root
QtObject {
id: d
function translation(key, isTitle) {
if (!isTitle) {
if (key === Constants.addAccountPopup.predefinedPaths.custom)
return qsTr("Type your own derivation path")
return key
}
switch(key) {
case Constants.addAccountPopup.predefinedPaths.custom:
return qsTr("Custom")
case Constants.addAccountPopup.predefinedPaths.ethereum:
return qsTr("Ethereum")
case Constants.addAccountPopup.predefinedPaths.ethereumRopsten:
return qsTr("Ethereum Testnet (Ropsten)")
case Constants.addAccountPopup.predefinedPaths.ethereumLedger:
return qsTr("Ethereum (Ledger)")
case Constants.addAccountPopup.predefinedPaths.ethereumLedgerLive:
return qsTr("Ethereum (Ledger Live/KeepKey)")
}
}
}
Pane { Pane {
SplitView.fillWidth: true SplitView.fillWidth: true
SplitView.fillHeight: true SplitView.fillHeight: true
@ -41,19 +67,19 @@ SplitView {
} }
} }
StatusMenu { DerivationPathSelection {
id: derivationPathSelection id: derivationPathSelection
ColumnLayout { roots: [Constants.addAccountPopup.predefinedPaths.custom,
StatusBaseText { Constants.addAccountPopup.predefinedPaths.ethereum,
text: "Test Popup" Constants.addAccountPopup.predefinedPaths.ethereumRopsten,
Layout.margins: 10 Constants.addAccountPopup.predefinedPaths.ethereumLedger,
} Constants.addAccountPopup.predefinedPaths.ethereumLedgerLive
StatusBaseText { ]
text: "Some more content here" translation: d.translation
Layout.margins: 10 selectedRootPath: Constants.addAccountPopup.predefinedPaths.ethereum
}
} onSelected: (rootPath) => console.warn("!!! SELECTED PATH:", rootPath)
} }
} }

View File

@ -107,7 +107,7 @@ Item {
readonly property var passthroughKeys: [Qt.Key_Left, Qt.Key_Right, Qt.Key_Escape] readonly property var passthroughKeys: [Qt.Key_Left, Qt.Key_Right, Qt.Key_Escape]
Shortcut { Shortcut {
sequence: StandardKey.Copy sequences: [StandardKey.Copy]
enabled: d.selectionIsActive enabled: d.selectionIsActive
onActivated: input.copy() onActivated: input.copy()
} }

View File

@ -1,5 +1,5 @@
import QtQuick 2.14 import QtQuick 2.15
import QtQuick.Controls 2.14 import QtQuick.Controls 2.15
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
@ -12,20 +12,18 @@ StatusMenu {
id: root id: root
implicitWidth: 285 implicitWidth: 285
padding: 0
property string selectedRootPath property string selectedRootPath
property var roots: [] property var roots: []
property var translation: function (key, isTitle) {} property var translation: (key, isTitle) => console.error("Must provide implementation")
signal selected(string rootPath) signal selected(string rootPath)
contentItem: Column { contentItem: StatusListView {
width: root.width
Repeater {
model: root.roots.length model: root.roots.length
implicitHeight: contentHeight
StatusListItem { delegate: StatusListItem {
objectName: "AddAccountPopup-PreDefinedDerivationPath-%1".arg(title) objectName: "AddAccountPopup-PreDefinedDerivationPath-%1".arg(title)
width: parent.width width: parent.width
title: root.translation(root.roots[index], true) title: root.translation(root.roots[index], true)
@ -45,5 +43,4 @@ StatusMenu {
} }
} }
} }
}
} }

View File

@ -1 +1,2 @@
DerivationPathInput 1.0 DerivationPathInput.qml DerivationPathInput 1.0 DerivationPathInput.qml
DerivationPathSelection 1.0 DerivationPathSelection.qml

View File

@ -1,5 +1,4 @@
import QtQuick 2.13 import QtQml 2.15
import utils 1.0
QtObject { QtObject {
id: root id: root