From 9980f4aa5eaf3c0f62cf699d6a9c4677a1ea3365 Mon Sep 17 00:00:00 2001 From: Jarol Rodriguez Date: Thu, 23 Sep 2021 03:17:47 -0400 Subject: [PATCH 1/4] qt, refactor: simplify third-party tx url action through overload Simplify the creation, addition, and slot/signal connection of a third part tx url context menu action by using an overloaded addAction function. --- src/qt/transactionview.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 2f16e6edb44..02c0153389f 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -228,11 +228,9 @@ void TransactionView::setModel(WalletModel *_model) QString host = QUrl(url, QUrl::StrictMode).host(); if (!host.isEmpty()) { - QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label if (i == 0) contextMenu->addSeparator(); - contextMenu->addAction(thirdPartyTxUrlAction); - connect(thirdPartyTxUrlAction, &QAction::triggered, [this, url] { openThirdPartyTxUrl(url); }); + contextMenu->addAction(host, [this, url] { openThirdPartyTxUrl(url); }); } } } From a70a98075a0d258d41c1310553a2337538a1d80c Mon Sep 17 00:00:00 2001 From: Jarol Rodriguez Date: Thu, 23 Sep 2021 20:42:21 -0400 Subject: [PATCH 2/4] qt: improve text for open third-party tx url action The text for an open third-party tx URL action is improved by appending the host name with "Show in". This makes it self-explanatory what the action will do. --- src/qt/transactionview.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 02c0153389f..d9e770e2d4b 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -230,7 +230,10 @@ void TransactionView::setModel(WalletModel *_model) { if (i == 0) contextMenu->addSeparator(); - contextMenu->addAction(host, [this, url] { openThirdPartyTxUrl(url); }); + /*: Transactions table context menu action to show the + selected transaction in a third-party block explorer. + %1 is a stand-in argument for the URL of the explorer. */ + contextMenu->addAction(tr("Show in %1").arg(host), [this, url] { openThirdPartyTxUrl(url); }); } } } From 8177578b296adb82fb8ab6c64cd76b832ebcc132 Mon Sep 17 00:00:00 2001 From: Jarol Rodriguez Date: Fri, 24 Sep 2021 02:55:00 -0400 Subject: [PATCH 3/4] qt: ensure seperator when adding third-party transaction links This ensures that if we're going to add an action to open up a transaction in a third-party link (block explorer) that it is seperated into it's own section. --- src/qt/transactionview.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index d9e770e2d4b..1973c9de9aa 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -222,14 +222,17 @@ void TransactionView::setModel(WalletModel *_model) { // Add third party transaction URLs to context menu QStringList listUrls = GUIUtil::SplitSkipEmptyParts(_model->getOptionsModel()->getThirdPartyTxUrls(), "|"); + bool actions_created = false; for (int i = 0; i < listUrls.size(); ++i) { QString url = listUrls[i].trimmed(); QString host = QUrl(url, QUrl::StrictMode).host(); if (!host.isEmpty()) { - if (i == 0) + if (!actions_created) { contextMenu->addSeparator(); + actions_created = true; + } /*: Transactions table context menu action to show the selected transaction in a third-party block explorer. %1 is a stand-in argument for the URL of the explorer. */ From 2ccde2f9329d2685563b09ff0830f0d5916f57d5 Mon Sep 17 00:00:00 2001 From: Jarol Rodriguez Date: Mon, 27 Sep 2021 01:33:17 -0400 Subject: [PATCH 4/4] qt: hyphenate usage of third-party modifier Our usage of "third-party" should be hyphenated as it is being used as a modifier of both "URL" and "transaction URLs". --- src/qt/forms/optionsdialog.ui | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 59d220636d7..bff1c91d3f9 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -729,10 +729,10 @@ - Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |. + Third-party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |. - &Third party transaction URLs + &Third-party transaction URLs thirdPartyTxUrls @@ -742,7 +742,7 @@ - Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |. + Third-party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |. https://example.com/tx/%s