mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01:00
Merge bitcoin-core/gui#211: qt: Remove Transactionview Edit Label Action
8f9644890a
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 #209 and [#1168](https://github.com/bitcoin/bitcoin/issues/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](https://github.com/bitcoin-core/gui/issues/209#issuecomment-780922101), `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 ACK8f9644890a
Talkless: tACK8f9644890a
, tested on Debian Sid. Tree-SHA512: 70bbcc8be3364b0d4f476a9760aa14ad1ad1f53b0b130ce0ffe75190d76c386e6e26c530c0a55d1742402fe2b45c68a2af6dbfaf58ee9909ad93b06f0b6559d4
This commit is contained in:
commit
5e4a3ca2f4
2 changed files with 0 additions and 50 deletions
|
@ -172,7 +172,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
|||
QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this);
|
||||
QAction *copyTxHexAction = new QAction(tr("Copy raw transaction"), this);
|
||||
QAction *copyTxPlainText = new QAction(tr("Copy full transaction details"), this);
|
||||
QAction *editLabelAction = new QAction(tr("Edit label"), this);
|
||||
QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);
|
||||
|
||||
contextMenu = new QMenu(this);
|
||||
|
@ -187,7 +186,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
|||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(bumpFeeAction);
|
||||
contextMenu->addAction(abandonAction);
|
||||
contextMenu->addAction(editLabelAction);
|
||||
|
||||
connect(dateWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseDate);
|
||||
connect(typeWidget, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TransactionView::chooseType);
|
||||
|
@ -208,7 +206,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
|||
connect(copyTxIDAction, &QAction::triggered, this, &TransactionView::copyTxID);
|
||||
connect(copyTxHexAction, &QAction::triggered, this, &TransactionView::copyTxHex);
|
||||
connect(copyTxPlainText, &QAction::triggered, this, &TransactionView::copyTxPlainText);
|
||||
connect(editLabelAction, &QAction::triggered, this, &TransactionView::editLabel);
|
||||
connect(showDetailsAction, &QAction::triggered, this, &TransactionView::showDetails);
|
||||
// Double-clicking on a transaction on the transaction history page shows details
|
||||
connect(this, &TransactionView::doubleClicked, this, &TransactionView::showDetails);
|
||||
|
@ -477,52 +474,6 @@ void TransactionView::copyTxPlainText()
|
|||
GUIUtil::copyEntryData(transactionView, 0, TransactionTableModel::TxPlainTextRole);
|
||||
}
|
||||
|
||||
void TransactionView::editLabel()
|
||||
{
|
||||
if(!transactionView->selectionModel() ||!model)
|
||||
return;
|
||||
QModelIndexList selection = transactionView->selectionModel()->selectedRows();
|
||||
if(!selection.isEmpty())
|
||||
{
|
||||
AddressTableModel *addressBook = model->getAddressTableModel();
|
||||
if(!addressBook)
|
||||
return;
|
||||
QString address = selection.at(0).data(TransactionTableModel::AddressRole).toString();
|
||||
if(address.isEmpty())
|
||||
{
|
||||
// If this transaction has no associated address, exit
|
||||
return;
|
||||
}
|
||||
// Is address in address book? Address book can miss address when a transaction is
|
||||
// sent from outside the UI.
|
||||
int idx = addressBook->lookupAddress(address);
|
||||
if(idx != -1)
|
||||
{
|
||||
// Edit sending / receiving address
|
||||
QModelIndex modelIdx = addressBook->index(idx, 0, QModelIndex());
|
||||
// Determine type of address, launch appropriate editor dialog type
|
||||
QString type = modelIdx.data(AddressTableModel::TypeRole).toString();
|
||||
|
||||
EditAddressDialog dlg(
|
||||
type == AddressTableModel::Receive
|
||||
? EditAddressDialog::EditReceivingAddress
|
||||
: EditAddressDialog::EditSendingAddress, this);
|
||||
dlg.setModel(addressBook);
|
||||
dlg.loadRow(idx);
|
||||
dlg.exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add sending address
|
||||
EditAddressDialog dlg(EditAddressDialog::NewSendingAddress,
|
||||
this);
|
||||
dlg.setModel(addressBook);
|
||||
dlg.setAddress(address);
|
||||
dlg.exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TransactionView::showDetails()
|
||||
{
|
||||
if(!transactionView->selectionModel())
|
||||
|
|
|
@ -90,7 +90,6 @@ private Q_SLOTS:
|
|||
void dateRangeChanged();
|
||||
void showDetails();
|
||||
void copyAddress();
|
||||
void editLabel();
|
||||
void copyLabel();
|
||||
void copyAmount();
|
||||
void copyTxID();
|
||||
|
|
Loading…
Add table
Reference in a new issue