|
|
|
@ -410,6 +410,7 @@ SendCoinsEntry *SendCoinsDialog::addEntry()
@@ -410,6 +410,7 @@ SendCoinsEntry *SendCoinsDialog::addEntry()
|
|
|
|
|
entry->setModel(model); |
|
|
|
|
ui->entries->addWidget(entry); |
|
|
|
|
connect(entry, SIGNAL(removeEntry(SendCoinsEntry*)), this, SLOT(removeEntry(SendCoinsEntry*))); |
|
|
|
|
connect(entry, SIGNAL(useAvailableBalance(SendCoinsEntry*)), this, SLOT(useAvailableBalance(SendCoinsEntry*))); |
|
|
|
|
connect(entry, SIGNAL(payAmountChanged()), this, SLOT(coinControlUpdateLabels())); |
|
|
|
|
connect(entry, SIGNAL(subtractFeeFromAmountChanged()), this, SLOT(coinControlUpdateLabels())); |
|
|
|
|
|
|
|
|
@ -607,6 +608,31 @@ void SendCoinsDialog::on_buttonMinimizeFee_clicked()
@@ -607,6 +608,31 @@ void SendCoinsDialog::on_buttonMinimizeFee_clicked()
|
|
|
|
|
minimizeFeeSection(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry) |
|
|
|
|
{ |
|
|
|
|
// Get CCoinControl instance if CoinControl is enabled or create a new one.
|
|
|
|
|
CCoinControl coin_control; |
|
|
|
|
if (model->getOptionsModel()->getCoinControlFeatures()) { |
|
|
|
|
coin_control = *CoinControlDialog::coinControl; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Calculate available amount to send.
|
|
|
|
|
CAmount amount = model->getBalance(&coin_control); |
|
|
|
|
for (int i = 0; i < ui->entries->count(); ++i) { |
|
|
|
|
SendCoinsEntry* e = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget()); |
|
|
|
|
if (e && !e->isHidden() && e != entry) { |
|
|
|
|
amount -= e->getValue().amount; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (amount > 0) { |
|
|
|
|
entry->checkSubtractFeeFromAmount(); |
|
|
|
|
entry->setAmount(amount); |
|
|
|
|
} else { |
|
|
|
|
entry->setAmount(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SendCoinsDialog::setMinimumFee() |
|
|
|
|
{ |
|
|
|
|
ui->radioCustomPerKilobyte->setChecked(true); |
|
|
|
|