gui icon indicating copy to clipboard operation
gui copied to clipboard

Improve 'Requested Payments History' Multiselect

Open john-moffett opened this issue 2 years ago • 9 comments
trafficstars

The "Requested payments history" list has somewhat broken functionality. You can only select contiguous rows. Sorting the list unexpectedly modifies any selection you made:

Initially sorted by date and multiple items selected:

image

Now sort by label ->

image

The context menu appears when multiple rows are selected despite the actions only affecting the first in the list:

image

These issues are all corrected.

First, a QSortFilterProxyModel is inserted to take care of sorting instead of sorting the model manually. (This is the same approach taken for all other sortable lists in the GUI.) This also preserves any selections the user had made prior to sorting. Second, the selection model is changed to ExtendedSelection to allow for non-contiguous multi-select. ~~Third, the context menu is disabled when multiple rows are selected, as none of the context menu options operate on multiple selected items.~~ Update: now the context menu operates on multiple rows. It will copy the data to the clipboard separated by newlines.

image

john-moffett avatar Dec 05 '22 14:12 john-moffett

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK hebasto, pablomartin4btc

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

No conflicts as of last run.

DrahtBot avatar Dec 05 '22 14:12 DrahtBot

First, a QSortFilterProxyModel is inserted to take care of sorting instead of sorting the model manually.

Concept ACK on it.

Second, the selection model is changed to ExtendedSelection to allow for non-contiguous multi-select.

Why? There are no use cases for multi-select, aren't there?

Third, the context menu is disabled when multiple rows are selected, as none of the context menu options operate on multiple selected items.

Not sure if such a behavior is a user-friendly one.

hebasto avatar Dec 06 '22 17:12 hebasto

Why? There are no use cases for multi-select, aren't there?

The "Show" and "Remove" buttons act on multiple selections. If you want to select multiple entries to delete, for instance, non-contiguous multi-select could be useful. Right now you can only delete single or contiguous items.

Not sure if such a behavior is a user-friendly one.

I was unsure whether to disable the context menu completely or show it but have everything disabled. I chose the former option, but the latter is easily possible. I think the current behavior (only acting on the first in the selection) is arguably the worst.

It's also possible to change it to work with multiple items. For instance, "Copy address" could change to "Copy addresses" upon multiple selection and copy a comma-separated list of addresses that you've selected to the clipboard.

Happy for feedback on this point!

john-moffett avatar Dec 06 '22 17:12 john-moffett

Updated to now show the context menu with multiple selections. The data is copied to the clipboard separated by newlines.

Example:

image

Results in the following copied to the clipboard:

bitcoin:TB1QETGUVSJCM80365PQ2GFT8NASVYYPMCG8FEWN3W?message=Message%20with%20no%20label%20or%20amount
bitcoin:mt2nX2QuRkWkRd2ewbE1mTZ1zaKUeBDEZs?amount=10.00000000&label=Legacy%20Address&message=For%20More%20Testing
bitcoin:2N1Qu4pSpTbCud8ToT9NJWW2PiDm7V97TSq?label=P2SH%20Segwit%20Address&message=For%20testing

The individual context actions are enabled only if all selected items have data for that category. For example, if only two of the three selected items have a "label", then the "Copy labels" context menu action is disabled. The "Copy URIs" and "Copy addresses" actions will always be active.

john-moffett avatar Dec 15 '22 19:12 john-moffett

Would prefer the refactoring split into a different commit

luke-jr avatar Jun 29 '23 23:06 luke-jr

Propose these changes: https://github.com/john-moffett/bitcoin-gui/compare/2022_12_FixReceiveCoinsMultiselect...luke-jr:bitcoin-core-gui:qt_reqs_multiselect_pr684

luke-jr avatar Sep 15 '23 02:09 luke-jr

🤔 There hasn't been much activity lately and the CI seems to be failing.

If no one reviewed the current pull request by commit hash, a rebase can be considered. While the CI failure may be a false positive, the CI hasn't been running for some time, so there may be a real issue hiding as well. A rebase triggers the latest CI and makes sure that no silent merge conflicts have snuck in.

DrahtBot avatar Feb 05 '24 14:02 DrahtBot

@john-moffett Are you still working on this PR?

hebasto avatar Feb 11 '24 22:02 hebasto

I could take this to move it forward @john-moffett, if you are not able to, please let me know.

pablomartin4btc avatar Apr 12 '24 18:04 pablomartin4btc

🤔 There hasn't been much activity lately and the CI seems to be failing.

If no one reviewed the current pull request by commit hash, a rebase can be considered. While the CI failure may be a false positive, the CI hasn't been running for some time, so there may be a real issue hiding as well. A rebase triggers the latest CI and makes sure that no silent merge conflicts have snuck in.

DrahtBot avatar Jul 11 '24 01:07 DrahtBot

Closing due to author's inactivity. Labeled "Up for grabs".

hebasto avatar Jul 30 '24 15:07 hebasto