feat(wallet) customize NetworkFilter for dapps display

Allow to show all selected icons in the network filter
Hide checkboxes in the network filter dropdown

Updates #14607
This commit is contained in:
Stefan 2024-05-13 22:25:18 +02:00 committed by Stefan Dunca
parent 7cd97a0051
commit 4771f0d77f
3 changed files with 9 additions and 3 deletions

View File

@ -25,6 +25,8 @@ StatusComboBox {
property bool multiSelection: true
property bool preferredNetworksMode: false
property var preferredSharingNetworks: []
property bool showAllSelectedText: true
property bool showCheckboxes: true
/// \c network is a network.model.nim entry
/// It is called for every toggled network if \c multiSelection is \c true
@ -101,13 +103,13 @@ StatusComboBox {
lineHeight: 24
lineHeightMode: Text.FixedHeight
verticalAlignment: Text.AlignVCenter
text: root.multiSelection ? (d.noneSelected ? qsTr("Select networks"): d.allSelected ? qsTr("All networks") : "") : d.selectedChainName
text: root.multiSelection ? (d.noneSelected ? qsTr("Select networks"): d.allSelected && root.showAllSelectedText ? qsTr("All networks") : "") : d.selectedChainName
color: Theme.palette.baseColor1
visible: !!text
}
Row {
spacing: -4
visible: !d.allSelected && chainRepeater.count > 0
visible: (!d.allSelected || !root.showAllSelectedText) && chainRepeater.count > 0
Repeater {
id: chainRepeater
model: root.preferredNetworksMode ? root.flatNetworks: root.multiSelection ? d.enabledFlatNetworks: []
@ -126,6 +128,7 @@ StatusComboBox {
flatNetworks: root.flatNetworks
preferredSharingNetworks: root.preferredSharingNetworks
preferredNetworksMode: root.preferredNetworksMode
showCheckboxes: root.showCheckboxes
implicitWidth: contentWidth
implicitHeight: contentHeight

View File

@ -15,6 +15,7 @@ StatusListItem {
property var singleSelection
property var radioButtonGroup
property bool useEnabledRole: true
property bool showCheckboxes: true
// Needed for preferred sharing networks
property bool preferredNetworksMode: false
@ -49,7 +50,7 @@ StatusListItem {
id: checkBox
objectName: "networkSelectionCheckbox_" + model.chainName
tristate: true
visible: !root.singleSelection.enabled
visible: !root.singleSelection.enabled && root.showCheckboxes
checkState: {
if(root.preferredNetworksMode) {

View File

@ -19,6 +19,7 @@ StatusListView {
property SingleSelectionInfo singleSelection: SingleSelectionInfo {}
property var preferredSharingNetworks: []
property bool preferredNetworksMode: false
property bool showCheckboxes: true
signal toggleNetwork(var network, int index)
@ -35,6 +36,7 @@ StatusListView {
preferredNetworksMode: root.preferredNetworksMode
preferredSharingNetworks: root.preferredSharingNetworks
allChecked: root.preferredSharingNetworks.length === root.count
showCheckboxes: root.showCheckboxes
}
section {