MCPcopy Create free account
hub / github.com/ElementsProject/elements / editLabel

Method editLabel

src/qt/transactionview.cpp:483–527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

getAddressTableModelMethod · 0.80
loadRowMethod · 0.80
QModelIndexClass · 0.70
dataMethod · 0.45
lookupAddressMethod · 0.45
indexMethod · 0.45
setModelMethod · 0.45
setAddressMethod · 0.45

Tested by

no test coverage detected