fix(AddAccountPopup): account list for address selection is empty

- use a similar approach as in the DerivationPath popup; ListView
instead of a Repeater
- some smaller fixes & speedups in the SFPM
- reenable the test

Fixes #16683
This commit is contained in:
Lukáš Tinkl 2024-11-01 14:27:34 +01:00 committed by Lukáš Tinkl
parent 84017104f4
commit dd2c65e0fb
3 changed files with 29 additions and 30 deletions

View File

@ -18,7 +18,6 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703028', 'Manage a custom generated account') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703028', 'Manage a custom generated account')
@pytest.mark.case(703028) @pytest.mark.case(703028)
@pytest.mark.xfail(reason="https://github.com/status-im/status-desktop/issues/16683")
def test_plus_button_manage_generated_account_custom_derivation_path(main_screen: MainWindow, user_account): def test_plus_button_manage_generated_account_custom_derivation_path(main_screen: MainWindow, user_account):
with step('Create generated wallet account'): with step('Create generated wallet account'):
name = random_wallet_acc_keypair_name() name = random_wallet_acc_keypair_name()

View File

@ -28,17 +28,16 @@ StatusMenu {
id: d id: d
property int currentPage: 0 property int currentPage: 0
readonly property int lowerBound: root.itemsPerPage * d.currentPage
readonly property int totalPages: Math.ceil(root.store.derivedAddressModel.count / root.itemsPerPage) readonly property int totalPages: Math.ceil(root.store.derivedAddressModel.count / root.itemsPerPage)
} }
SortFilterProxyModel { SortFilterProxyModel {
id: proxyModel id: proxyModel
sourceModel: root.store.derivedAddressModel sourceModel: root.store.derivedAddressModel
filters: ExpressionFilter { filters: IndexFilter {
expression: { minimumIndex: d.lowerBound
let lowerBound = root.itemsPerPage * d.currentPage maximumIndex: d.lowerBound + root.itemsPerPage
return model.index >= lowerBound && model.index < lowerBound + root.itemsPerPage
}
} }
} }
@ -99,13 +98,15 @@ StatusMenu {
} }
} }
Repeater { StatusListView {
model: proxyModel
Rectangle {
objectName: "AddAccountPopup-GeneratedAddress-%1".arg(model.addressDetails.order)
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
implicitHeight: contentHeight
model: proxyModel
delegate: Rectangle {
objectName: "AddAccountPopup-GeneratedAddress-%1".arg(model.addressDetails.order)
width: ListView.view.width
height: Constants.addAccountPopup.itemHeight height: Constants.addAccountPopup.itemHeight
enabled: !model.addressDetails.alreadyCreated enabled: !model.addressDetails.alreadyCreated
radius: Theme.halfPadding radius: Theme.halfPadding
@ -116,6 +117,16 @@ StatusMenu {
return "transparent" return "transparent"
} }
MouseArea {
id: sensor
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
root.selected(model.addressDetails.address)
}
}
GridLayout { GridLayout {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: Theme.padding anchors.leftMargin: Theme.padding
@ -124,26 +135,26 @@ StatusMenu {
rowSpacing: 0 rowSpacing: 0
StatusBaseText { StatusBaseText {
Layout.preferredWidth: 208 Layout.fillWidth: true
elide: Text.ElideMiddle
color: model.addressDetails.alreadyCreated? Theme.palette.baseColor1 : Theme.palette.directColor1 color: model.addressDetails.alreadyCreated? Theme.palette.baseColor1 : Theme.palette.directColor1
font.pixelSize: Constants.addAccountPopup.labelFontSize1 font.pixelSize: Constants.addAccountPopup.labelFontSize1
text: StatusQUtils.Utils.elideText(model.addressDetails.address, 15, 4) text: model.addressDetails.address
} }
Row { RowLayout {
Layout.preferredWidth: 108
spacing: Theme.halfPadding * 0.5 spacing: Theme.halfPadding * 0.5
StatusIcon { StatusIcon {
visible: model.addressDetails.loaded && model.addressDetails.hasActivity visible: model.addressDetails.loaded && model.addressDetails.hasActivity
width: 20 Layout.preferredWidth: 20
height: 20 Layout.preferredHeight: 20
icon: "flash" icon: "flash"
color: Theme.palette.successColor1 color: Theme.palette.successColor1
} }
StatusTextWithLoadingState { StatusTextWithLoadingState {
width: 84 Layout.fillWidth: true
font.pixelSize: Constants.addAccountPopup.labelFontSize1 font.pixelSize: Constants.addAccountPopup.labelFontSize1
text: { text: {
if (!root.store.addAccountModule.scanningForActivityIsOngoing) { if (!root.store.addAccountModule.scanningForActivityIsOngoing) {
@ -171,7 +182,6 @@ StatusMenu {
} }
StatusBaseText { StatusBaseText {
Layout.preferredWidth: 20
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1
font.pixelSize: Constants.addAccountPopup.labelFontSize1 font.pixelSize: Constants.addAccountPopup.labelFontSize1
text: model.addressDetails.order text: model.addressDetails.order
@ -185,20 +195,10 @@ StatusMenu {
icon.width: 16 icon.width: 16
icon.height: 16 icon.height: 16
onClicked: { onClicked: {
Qt.openUrlExternally("https://etherscan.io/address/%1".arg(model.addressDetails.address)) Global.openLink("https://etherscan.io/address/%1".arg(model.addressDetails.address))
} }
} }
} }
MouseArea {
id: sensor
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
root.selected(model.addressDetails.address)
}
}
} }
} }

View File

@ -149,7 +149,7 @@ GridLayout {
return qsTr("Select address") return qsTr("Select address")
} }
return "0x0000000000000000000000000000000000000000" return Constants.zeroAddress
} }
components: [ components: [