| 481 | } |
| 482 | |
| 483 | void 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 | |
| 529 | void TransactionView::showDetails() |
| 530 | { |
nothing calls this directly
no test coverage detected