From dd2c65e0fb8d8ea398edcd2c9afeea54d647c238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Fri, 1 Nov 2024 14:27:34 +0100 Subject: [PATCH] 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 --- ...enerated_account_custom_derivation_path.py | 1 - .../panels/AccountAddressSelection.qml | 56 +++++++++---------- .../addaccount/panels/DerivationPath.qml | 2 +- 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/test/e2e/tests/wallet_main_screen/wallet - plus button/test_plus_button_manage_generated_account_custom_derivation_path.py b/test/e2e/tests/wallet_main_screen/wallet - plus button/test_plus_button_manage_generated_account_custom_derivation_path.py index f19c3319a1..86e45e743c 100644 --- a/test/e2e/tests/wallet_main_screen/wallet - plus button/test_plus_button_manage_generated_account_custom_derivation_path.py +++ b/test/e2e/tests/wallet_main_screen/wallet - plus button/test_plus_button_manage_generated_account_custom_derivation_path.py @@ -18,7 +18,6 @@ pytestmark = marks @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703028', 'Manage a custom generated account') @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): with step('Create generated wallet account'): name = random_wallet_acc_keypair_name() diff --git a/ui/imports/shared/popups/addaccount/panels/AccountAddressSelection.qml b/ui/imports/shared/popups/addaccount/panels/AccountAddressSelection.qml index f69d57a730..30dc3db0b9 100644 --- a/ui/imports/shared/popups/addaccount/panels/AccountAddressSelection.qml +++ b/ui/imports/shared/popups/addaccount/panels/AccountAddressSelection.qml @@ -28,17 +28,16 @@ StatusMenu { id: d property int currentPage: 0 + readonly property int lowerBound: root.itemsPerPage * d.currentPage readonly property int totalPages: Math.ceil(root.store.derivedAddressModel.count / root.itemsPerPage) } SortFilterProxyModel { id: proxyModel sourceModel: root.store.derivedAddressModel - filters: ExpressionFilter { - expression: { - let lowerBound = root.itemsPerPage * d.currentPage - return model.index >= lowerBound && model.index < lowerBound + root.itemsPerPage - } + filters: IndexFilter { + minimumIndex: d.lowerBound + maximumIndex: d.lowerBound + root.itemsPerPage } } @@ -99,13 +98,15 @@ StatusMenu { } } - Repeater { + StatusListView { + anchors.left: parent.left + anchors.right: parent.right + implicitHeight: contentHeight model: proxyModel - Rectangle { + delegate: Rectangle { objectName: "AddAccountPopup-GeneratedAddress-%1".arg(model.addressDetails.order) - anchors.left: parent.left - anchors.right: parent.right + width: ListView.view.width height: Constants.addAccountPopup.itemHeight enabled: !model.addressDetails.alreadyCreated radius: Theme.halfPadding @@ -116,6 +117,16 @@ StatusMenu { return "transparent" } + MouseArea { + id: sensor + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: { + root.selected(model.addressDetails.address) + } + } + GridLayout { anchors.fill: parent anchors.leftMargin: Theme.padding @@ -124,26 +135,26 @@ StatusMenu { rowSpacing: 0 StatusBaseText { - Layout.preferredWidth: 208 + Layout.fillWidth: true + elide: Text.ElideMiddle color: model.addressDetails.alreadyCreated? Theme.palette.baseColor1 : Theme.palette.directColor1 font.pixelSize: Constants.addAccountPopup.labelFontSize1 - text: StatusQUtils.Utils.elideText(model.addressDetails.address, 15, 4) + text: model.addressDetails.address } - Row { - Layout.preferredWidth: 108 + RowLayout { spacing: Theme.halfPadding * 0.5 StatusIcon { visible: model.addressDetails.loaded && model.addressDetails.hasActivity - width: 20 - height: 20 + Layout.preferredWidth: 20 + Layout.preferredHeight: 20 icon: "flash" color: Theme.palette.successColor1 } StatusTextWithLoadingState { - width: 84 + Layout.fillWidth: true font.pixelSize: Constants.addAccountPopup.labelFontSize1 text: { if (!root.store.addAccountModule.scanningForActivityIsOngoing) { @@ -171,7 +182,6 @@ StatusMenu { } StatusBaseText { - Layout.preferredWidth: 20 color: Theme.palette.baseColor1 font.pixelSize: Constants.addAccountPopup.labelFontSize1 text: model.addressDetails.order @@ -185,20 +195,10 @@ StatusMenu { icon.width: 16 icon.height: 16 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) - } - } } } diff --git a/ui/imports/shared/popups/addaccount/panels/DerivationPath.qml b/ui/imports/shared/popups/addaccount/panels/DerivationPath.qml index 62c296a307..cd8276e641 100644 --- a/ui/imports/shared/popups/addaccount/panels/DerivationPath.qml +++ b/ui/imports/shared/popups/addaccount/panels/DerivationPath.qml @@ -149,7 +149,7 @@ GridLayout { return qsTr("Select address") } - return "0x0000000000000000000000000000000000000000" + return Constants.zeroAddress } components: [