MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / editLabel

Method editLabel

src/qt/transactionview.cpp:447–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447void TransactionView::editLabel()
448{
449 if(!transactionView->selectionModel() ||!model)
450 return;
451 QModelIndexList selection = transactionView->selectionModel()->selectedRows();
452 if(!selection.isEmpty())
453 {
454 AddressTableModel *addressBook = model->getAddressTableModel();
455 if(!addressBook)
456 return;
457 QString address = selection.at(0).data(TransactionTableModel::AddressRole).toString();
458 if(address.isEmpty())
459 {
460 // If this transaction has no associated address, exit
461 return;
462 }
463 // Is address in address book? Address book can miss address when a transaction is
464 // sent from outside the UI.
465 int idx = addressBook->lookupAddress(address);
466 if(idx != -1)
467 {
468 // Edit sending / receiving address
469 QModelIndex modelIdx = addressBook->index(idx, 0, QModelIndex());
470 // Determine type of address, launch appropriate editor dialog type
471 QString type = modelIdx.data(AddressTableModel::TypeRole).toString();
472
473 auto dlg = new EditAddressDialog(
474 type == AddressTableModel::Receive
475 ? EditAddressDialog::EditReceivingAddress
476 : EditAddressDialog::EditSendingAddress, this);
477 dlg->setModel(addressBook);
478 dlg->loadRow(idx);
479 GUIUtil::ShowModalDialogAsynchronously(dlg);
480 }
481 else
482 {
483 // Add sending address
484 auto dlg = new EditAddressDialog(EditAddressDialog::NewSendingAddress,
485 this);
486 dlg->setModel(addressBook);
487 dlg->setAddress(address);
488 GUIUtil::ShowModalDialogAsynchronously(dlg);
489 }
490 }
491}
492
493void TransactionView::showDetails()
494{

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected