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
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,37 +12,34 @@ 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
|
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 {
|
components: [
|
||||||
model: root.roots.length
|
StatusIcon {
|
||||||
|
visible: root.selectedRootPath === root.roots[index]
|
||||||
StatusListItem {
|
icon: "checkmark"
|
||||||
objectName: "AddAccountPopup-PreDefinedDerivationPath-%1".arg(title)
|
color: Theme.palette.primaryColor1
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
root.selected(root.roots[index])
|
||||||
|
root.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
DerivationPathInput 1.0 DerivationPathInput.qml
|
DerivationPathInput 1.0 DerivationPathInput.qml
|
||||||
|
DerivationPathSelection 1.0 DerivationPathSelection.qml
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import QtQuick 2.13
|
import QtQml 2.15
|
||||||
import utils 1.0
|
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: root
|
id: root
|
||||||
|
|
Loading…
Reference in New Issue