bitcoin-core / gui

Bitcoin Core GUI staging repository
https://github.com/bitcoin/bitcoin
MIT License
604 stars 266 forks source link

Bugfix - don't allow multiple dialogs for same tx in TransactionView #817

Open pablomartin4btc opened 7 months ago

pablomartin4btc commented 7 months ago

Limit to one the transaction details dialogs that a user can open.

Currently a user can open unlimited tx details dialogs for the same tx id. ![Peek 2024-04-12 00-50](https://github.com/bitcoin-core/gui/assets/110166421/ba5a261b-9234-437f-b496-2f01320f14ce)
This PR fixes the issue. ![Peek 2024-04-12 00-37](https://github.com/bitcoin-core/gui/assets/110166421/22f0f9e4-ec58-4ee2-bff4-6793435dd6d5)
DrahtBot commented 7 months ago

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
Stale ACK BrandonOdiwuor, alfonsoromanz

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

DrahtBot commented 7 months ago

🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the documentation.

Possibly this is due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

Leave a comment here, if you need help tracking down a confusing failure.

Debug: https://github.com/bitcoin-core/gui/runs/23737775174

flack commented 7 months ago

would be nice if a click on a row where the dialog is already open would bring that dialog to the foreground

pablomartin4btc commented 7 months ago

would be nice if a click on a row where the dialog is already open would bring that dialog to the foreground

Great suggestion! I'll try that since I have to fix a lint. Thanks!

pablomartin4btc commented 7 months ago

Updates:

luke-jr commented 6 months ago

Why?

pablomartin4btc commented 6 months ago

Why?

Discussed a bit offline... Please feel free to add more context here and any concerns you have.

pablomartin4btc commented 6 months ago

Updates:

hebasto commented 4 months ago

Currently a user can open unlimited tx details dialogs for the same tx id.

Concept ACK. Such a behavior can confuse the user.

hebasto commented 4 months ago

Tested successfully on Ubuntu 22.04.4 LTS. Only one dialogue is created per transaction and the clicked transaction is brought to the foreground

Tested on Ubuntu 24.04. It works with QT_QPA_PLATFORM=xcb, but fails with QT_QPA_PLATFORM=wayland.

pablomartin4btc commented 4 months ago

Tested on Ubuntu 24.04. It works with QT_QPA_PLATFORM=xcb, but fails with QT_QPA_PLATFORM=wayland.

I'll take a look, thanks!

pablomartin4btc commented 4 months ago

@hebasto it seems there are some issues with Wayland on how these actions are being handled (this one specific to KDE but found some old ones in gnome).

As a workaround (tried other things as well), might be not elegant, but this works fine on both X11/Xorg and Wayland:

--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -671,8 +671,11 @@ bool TransactionView::detailsAlreadyShown(const QModelIndex &idx)
 {
     for (TransactionDescDialog* dlg : m_opened_dialogs) {
         if (dlg->getTransactionId() == idx.data(TransactionTableModel::TxHashRole).toString()) {
-            dlg->activateWindow();
-            dlg->raise();
+            auto eFlags = dlg->windowFlags();
+            dlg->setWindowFlags(eFlags|Qt::WindowStaysOnTopHint);
+            dlg->show();
+            dlg->setWindowFlags(eFlags);
+            dlg->show();
             return true;
         }
     }

I can update the code with that snippet above or we can do it on a follow-up.

hebasto commented 3 months ago

@hebasto it seems there are some issues with Wayland on how these actions are being handled (this one specific to KDE but found some old ones in gnome).

As a workaround (tried other things as well), might be not elegant, but this works fine on both X11/Xorg and Wayland:

The approach you suggested works for me.

Here are other references to this workaround:

I can update the code with that snippet above or we can do it on a follow-up.

I think we should first fix our GUIUtil::bringToFront() first in a separate PR, which will also address similar issues in other cases.

Then we can apply the fixed GUIUtil::bringToFront() in this PR.

pablomartin4btc commented 3 months ago

I think we should first fix our GUIUtil::bringToFront() first in a separate PR, which will also address similar issues in other cases.

Then we can apply the fixed GUIUtil::bringToFront() in this PR.

Ok, I'll open a new PR for GUIUtil::bringToFront() and will put this one on draft in the meantime.

pablomartin4btc commented 3 months ago

Updates: