| 445 | } |
| 446 | |
| 447 | void 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 | |
| 493 | void TransactionView::showDetails() |
| 494 | { |
nothing calls this directly
no test coverage detected