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