From d4fa715c7ea3a7108946a31aa6387753140f783e Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Tue, 9 Apr 2024 10:24:10 +0200 Subject: [PATCH] fix(wallet): changes in account order in settings are not applied in wallet Fixed an issue with dropping a draggable item outside the bounds of the DropArea. Fixes #13836 --- .../Components/StatusDraggableListItem.qml | 21 ++++++++++++++++--- .../Profile/views/wallet/AccountOrderView.qml | 16 +++++++------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ui/StatusQ/src/StatusQ/Components/StatusDraggableListItem.qml b/ui/StatusQ/src/StatusQ/Components/StatusDraggableListItem.qml index a3382f8d5e..f95b63850f 100644 --- a/ui/StatusQ/src/StatusQ/Components/StatusDraggableListItem.qml +++ b/ui/StatusQ/src/StatusQ/Components/StatusDraggableListItem.qml @@ -236,12 +236,27 @@ ItemDelegate { */ readonly property bool dragActive: dragHandler.drag.active onDragActiveChanged: { - if (dragActive) + if (dragActive) { Drag.start() - else - Drag.drop() + root.dragStarted() + return + } + Drag.drop() + root.dragFinished() } + /*! + \qmlsignal + This signal is emitted when dragging the StatusDraggableListItem item started. + */ + signal dragStarted() + + /*! + \qmlsignal + This signal is emitted when dragging the StatusDraggableListItem item finished. + */ + signal dragFinished() + states: [ State { when: root.dragActive diff --git a/ui/app/AppLayouts/Profile/views/wallet/AccountOrderView.qml b/ui/app/AppLayouts/Profile/views/wallet/AccountOrderView.qml index 0189e2d3e8..446567711d 100644 --- a/ui/app/AppLayouts/Profile/views/wallet/AccountOrderView.qml +++ b/ui/app/AppLayouts/Profile/views/wallet/AccountOrderView.qml @@ -74,14 +74,6 @@ ColumnLayout { drag.accept() } - onDropped: function(drop) { - let from = d.indexMoveFrom - let to = d.indexMoveTo - d.indexMoveFrom = -1 - d.indexMoveTo = -1 - root.walletStore.moveAccountFinally(from, to) - } - StatusDraggableListItem { id: draggableDelegate anchors.horizontalCenter: parent.horizontalCenter @@ -102,6 +94,14 @@ ColumnLayout { icon.height: 40 icon.name: model.emoji icon.color: Utils.getColorForId(model.colorId) + + onDragFinished: { + let from = d.indexMoveFrom + let to = d.indexMoveTo + d.indexMoveFrom = -1 + d.indexMoveTo = -1 + root.walletStore.moveAccountFinally(from, to) + } } } }