MCPcopy Create free account
hub / github.com/LUX-Core/lux / editLabel

Method editLabel

src/qt/transactionview.cpp:484–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

482}
483
484void TransactionView::editLabel()
485{
486 if (!transactionView->selectionModel() || !model)
487 return;
488 QModelIndexList selection = transactionView->selectionModel()->selectedRows();
489 if (!selection.isEmpty()) {
490 AddressTableModel* addressBook = model->getAddressTableModel();
491 if (!addressBook)
492 return;
493 QString address = selection.at(0).data(TransactionTableModel::AddressRole).toString();
494 if (address.isEmpty()) {
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 // Edit sending / receiving address
503 QModelIndex modelIdx = addressBook->index(idx, 0, QModelIndex());
504 // Determine type of address, launch appropriate editor dialog type
505 QString type = modelIdx.data(AddressTableModel::TypeRole).toString();
506
507 EditAddressDialog dlg(
508 type == AddressTableModel::Receive ? EditAddressDialog::EditReceivingAddress : EditAddressDialog::EditSendingAddress, this);
509 dlg.setModel(addressBook);
510 dlg.loadRow(idx);
511 dlg.exec();
512 } else {
513 // Add sending address
514 EditAddressDialog dlg(EditAddressDialog::NewSendingAddress,
515 this);
516 dlg.setModel(addressBook);
517 dlg.setAddress(address);
518 dlg.exec();
519 }
520 }
521}
522
523void TransactionView::showDetails()
524{

Callers

nothing calls this directly

Calls 12

getAddressTableModelMethod · 0.80
QModelIndexClass · 0.70
isEmptyMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
atMethod · 0.45
lookupAddressMethod · 0.45
indexMethod · 0.45
setModelMethod · 0.45
loadRowMethod · 0.45
execMethod · 0.45
setAddressMethod · 0.45

Tested by

no test coverage detected