Skip to content

Commit afd8d63

Browse files
MarcoFalkethelazier
MarcoFalke
authored andcommitted
Merge bitcoin-core/gui#211: qt: Remove Transactionview Edit Label Action
8f96448 qt: Remove Transactionview Edit Label Action (Jarol Rodriguez) Pull request description: This PR removes the `Edit Label` action from the `transactionview` context menu. Since the `Edit Label` action will no longer be utilized in the `transactionview`, the `Edit Label` function logic is also removed. | Master | PR | | ----------- | ----------- | |<img width="248" alt="Screen Shot 2021-02-17 at 8 34 34 PM" src="https://user-images.githubusercontent.com/23396902/108292189-9b86c800-7161-11eb-9e80-6238523bc27e.png">|<img width="248" alt="Screen Shot 2021-02-17 at 8 35 10 PM" src="https://user-images.githubusercontent.com/23396902/108292204-a17ca900-7161-11eb-8582-7f33d3e2ba8f.png">| Among the context menu actions for each transaction in the `transactionview` is the `Edit Label` action. While all other actions apply directly to the selected transaction, the `Edit Label` action applies to the selected transaction's address. As documented in issue dashpay#209 and [dashpay#1168](bitcoin#1168) , this is an "unfortunate" placement for such an action. The current placement creates a confusing UX scenario where the outcome of the action is ambiguous. **Example of Ambiguous Behavior:** The context menu gives the wrong impression that the `Edit Label` action will edit a `Label` for the specific transaction that has been right-clicked on. This impression can be because all other actions in this menu will relate to the specific transaction and the misconception between `Comment` and `Label`. <img width="1062" alt="editlabel-start" src="https://user-images.githubusercontent.com/23396902/108296385-6da48200-7167-11eb-89f0-b21ccc58f6f4.png"> Let's say I wanted to give the transaction selected in the screenshot above a comment of "2-17[17:43]". Given all the context clues, it will be reasonable to assume that the `Edit Label` function will give a label to this transaction. Instead, it edits the `Label` for the address behind this transaction. Thus, changing the `Label` for all transactions associated with this address. <img width="971" alt="editlabel-end" src="https://user-images.githubusercontent.com/23396902/108297179-e35d1d80-7168-11eb-86a9-0d2796c51829.png"> **Maintaining `Edit Label` Functionality:** The action of Editing a Label should instead be reserved for the respective address tables of the `Send` and `Receive` tabs. As documented in this [comment](bitcoin-core/gui#209 (comment)), `Edit Label` is currently implemented in the `Send` tab and is missing in the `Receive` tab. A follow-up PR can add the `Edit Label` functionality to the `Receive` tab. ACKs for top commit: MarcoFalke: review ACK 8f96448 Talkless: tACK 8f96448, tested on Debian Sid. Tree-SHA512: 70bbcc8be3364b0d4f476a9760aa14ad1ad1f53b0b130ce0ffe75190d76c386e6e26c530c0a55d1742402fe2b45c68a2af6dbfaf58ee9909ad93b06f0b6559d4
1 parent 108022b commit afd8d63

File tree

2 files changed

+0
-50
lines changed

2 files changed

+0
-50
lines changed

src/qt/transactionview.cpp

-49
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ transactionView(nullptr), abandonAction(nullptr), columnResizingFixer(nullptr)
155155
QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this);
156156
QAction *copyTxHexAction = new QAction(tr("Copy raw transaction"), this);
157157
QAction *copyTxPlainText = new QAction(tr("Copy full transaction details"), this);
158-
QAction *editLabelAction = new QAction(tr("Edit label"), this);
159158
QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);
160159
QAction *showAddressQRCodeAction = new QAction(tr("Show address QR code"), this);
161160

@@ -171,7 +170,6 @@ transactionView(nullptr), abandonAction(nullptr), columnResizingFixer(nullptr)
171170
contextMenu->addAction(showAddressQRCodeAction);
172171
contextMenu->addSeparator();
173172
contextMenu->addAction(abandonAction);
174-
contextMenu->addAction(editLabelAction);
175173

176174
mapperThirdPartyTxUrls = new QSignalMapper(this);
177175

@@ -197,7 +195,6 @@ transactionView(nullptr), abandonAction(nullptr), columnResizingFixer(nullptr)
197195
connect(copyTxIDAction, &QAction::triggered, this, &TransactionView::copyTxID);
198196
connect(copyTxHexAction, &QAction::triggered, this, &TransactionView::copyTxHex);
199197
connect(copyTxPlainText, &QAction::triggered, this, &TransactionView::copyTxPlainText);
200-
connect(editLabelAction, &QAction::triggered, this, &TransactionView::editLabel);
201198
connect(showDetailsAction, &QAction::triggered, this, &TransactionView::showDetails);
202199
connect(showAddressQRCodeAction, &QAction::triggered, this, &TransactionView::showAddressQRCode);
203200
// Double-clicking on a transaction on the transaction history page shows details
@@ -479,52 +476,6 @@ void TransactionView::copyTxPlainText()
479476
GUIUtil::copyEntryData(transactionView, 0, TransactionTableModel::TxPlainTextRole);
480477
}
481478

482-
void TransactionView::editLabel()
483-
{
484-
if(!transactionView->selectionModel() ||!model)
485-
return;
486-
QModelIndexList selection = transactionView->selectionModel()->selectedRows();
487-
if(!selection.isEmpty())
488-
{
489-
AddressTableModel *addressBook = model->getAddressTableModel();
490-
if(!addressBook)
491-
return;
492-
QString address = selection.at(0).data(TransactionTableModel::AddressRole).toString();
493-
if(address.isEmpty())
494-
{
495-
// If this transaction has no associated address, exit
496-
return;
497-
}
498-
// Is address in address book? Address book can miss address when a transaction is
499-
// sent from outside the UI.
500-
int idx = addressBook->lookupAddress(address);
501-
if(idx != -1)
502-
{
503-
// Edit sending / receiving address
504-
QModelIndex modelIdx = addressBook->index(idx, 0, QModelIndex());
505-
// Determine type of address, launch appropriate editor dialog type
506-
QString type = modelIdx.data(AddressTableModel::TypeRole).toString();
507-
508-
EditAddressDialog dlg(
509-
type == AddressTableModel::Receive
510-
? EditAddressDialog::EditReceivingAddress
511-
: EditAddressDialog::EditSendingAddress, this);
512-
dlg.setModel(addressBook);
513-
dlg.loadRow(idx);
514-
dlg.exec();
515-
}
516-
else
517-
{
518-
// Add sending address
519-
EditAddressDialog dlg(EditAddressDialog::NewSendingAddress,
520-
this);
521-
dlg.setModel(addressBook);
522-
dlg.setAddress(address);
523-
dlg.exec();
524-
}
525-
}
526-
}
527-
528479
void TransactionView::showDetails()
529480
{
530481
if(!transactionView->selectionModel())

src/qt/transactionview.h

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ private Q_SLOTS:
9494
void showDetails();
9595
void showAddressQRCode();
9696
void copyAddress();
97-
void editLabel();
9897
void copyLabel();
9998
void copyAmount();
10099
void copyTxID();

0 commit comments

Comments
 (0)