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:
parent
f1ae8a2652
commit
0b67555ee1
|
@ -11,6 +11,32 @@ import utils 1.0
|
|||
import shared.popups.addaccount.panels 1.0
|
||||
|
||||
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 {
|
||||
SplitView.fillWidth: true
|
||||
SplitView.fillHeight: true
|
||||
|
@ -41,19 +67,19 @@ SplitView {
|
|||
}
|
||||
}
|
||||
|
||||
StatusMenu {
|
||||
DerivationPathSelection {
|
||||
id: derivationPathSelection
|
||||
|
||||
ColumnLayout {
|
||||
StatusBaseText {
|
||||
text: "Test Popup"
|
||||
Layout.margins: 10
|
||||
}
|
||||
StatusBaseText {
|
||||
text: "Some more content here"
|
||||
Layout.margins: 10
|
||||
}
|
||||
}
|
||||
roots: [Constants.addAccountPopup.predefinedPaths.custom,
|
||||
Constants.addAccountPopup.predefinedPaths.ethereum,
|
||||
Constants.addAccountPopup.predefinedPaths.ethereumRopsten,
|
||||
Constants.addAccountPopup.predefinedPaths.ethereumLedger,
|
||||
Constants.addAccountPopup.predefinedPaths.ethereumLedgerLive
|
||||
]
|
||||
translation: d.translation
|
||||
selectedRootPath: Constants.addAccountPopup.predefinedPaths.ethereum
|
||||
|
||||
onSelected: (rootPath) => console.warn("!!! SELECTED PATH:", rootPath)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ Item {
|
|||
readonly property var passthroughKeys: [Qt.Key_Left, Qt.Key_Right, Qt.Key_Escape]
|
||||
|
||||
Shortcut {
|
||||
sequence: StandardKey.Copy
|
||||
sequences: [StandardKey.Copy]
|
||||
enabled: d.selectionIsActive
|
||||
onActivated: input.copy()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import QtQuick 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
@ -12,37 +12,34 @@ StatusMenu {
|
|||
id: root
|
||||
|
||||
implicitWidth: 285
|
||||
padding: 0
|
||||
|
||||
property string selectedRootPath
|
||||
property var roots: []
|
||||
property var translation: function (key, isTitle) {}
|
||||
property var translation: (key, isTitle) => console.error("Must provide implementation")
|
||||
|
||||
signal selected(string rootPath)
|
||||
|
||||
contentItem: Column {
|
||||
width: root.width
|
||||
contentItem: StatusListView {
|
||||
model: root.roots.length
|
||||
implicitHeight: contentHeight
|
||||
delegate: StatusListItem {
|
||||
objectName: "AddAccountPopup-PreDefinedDerivationPath-%1".arg(title)
|
||||
width: parent.width
|
||||
title: root.translation(root.roots[index], true)
|
||||
subTitle: root.translation(root.roots[index], false)
|
||||
|
||||
Repeater {
|
||||
model: root.roots.length
|
||||
|
||||
StatusListItem {
|
||||
objectName: "AddAccountPopup-PreDefinedDerivationPath-%1".arg(title)
|
||||
width: parent.width
|
||||
title: root.translation(root.roots[index], true)
|
||||
subTitle: root.translation(root.roots[index], false)
|
||||
|
||||
components: [
|
||||
StatusIcon {
|
||||
visible: root.selectedRootPath === root.roots[index]
|
||||
icon: "checkmark"
|
||||
color: Theme.palette.primaryColor1
|
||||
}
|
||||
]
|
||||
|
||||
onClicked: {
|
||||
root.selected(root.roots[index])
|
||||
root.close()
|
||||
components: [
|
||||
StatusIcon {
|
||||
visible: root.selectedRootPath === root.roots[index]
|
||||
icon: "checkmark"
|
||||
color: Theme.palette.primaryColor1
|
||||
}
|
||||
]
|
||||
|
||||
onClicked: {
|
||||
root.selected(root.roots[index])
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
DerivationPathInput 1.0 DerivationPathInput.qml
|
||||
DerivationPathSelection 1.0 DerivationPathSelection.qml
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import QtQuick 2.13
|
||||
import utils 1.0
|
||||
import QtQml 2.15
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
|
Loading…
Reference in New Issue