| 806 | } |
| 807 | |
| 808 | void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry) |
| 809 | { |
| 810 | // Include watch-only for wallets without private key |
| 811 | m_coin_control->fAllowWatchOnly = model->wallet().privateKeysDisabled() && !model->wallet().hasExternalSigner(); |
| 812 | |
| 813 | SendAssetsRecipient recipient = entry->getValue(); |
| 814 | // Calculate available amount to send. |
| 815 | CAmount amount = valueFor(model->wallet().getAvailableBalance(*m_coin_control), recipient.asset); |
| 816 | for (int i = 0; i < ui->entries->count(); ++i) { |
| 817 | SendCoinsEntry* e = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget()); |
| 818 | if (e && !e->isHidden() && e != entry && e->getValue().asset == recipient.asset) { |
| 819 | amount -= e->getValue().asset_amount; |
| 820 | } |
| 821 | } |
| 822 | |
| 823 | if (amount > 0) { |
| 824 | if (recipient.asset == ::policyAsset) { |
| 825 | entry->checkSubtractFeeFromAmount(); |
| 826 | } |
| 827 | recipient.asset_amount = amount; |
| 828 | } else { |
| 829 | recipient.asset_amount = 0; |
| 830 | } |
| 831 | entry->setValue(recipient); |
| 832 | } |
| 833 | |
| 834 | void SendCoinsDialog::updateFeeSectionControls() |
| 835 | { |
nothing calls this directly
no test coverage detected