Skip to content

Commit 36ebb13

Browse files
luke-jrinstagibbs
authored andcommitted
GUI: Disable "Subtract fee from amount" checkbox when a non-pegged asset is selected
Fixes: greenaddress#4
1 parent 1f0b688 commit 36ebb13

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/qt/sendcoinsentry.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *par
4444
// Connect signals
4545
connect(ui->payAmount, &BitcoinAmountField::valueChanged, this, &SendCoinsEntry::payAmountChanged);
4646
connect(ui->checkboxSubtractFeeFromAmount, &QCheckBox::toggled, this, &SendCoinsEntry::subtractFeeFromAmountChanged);
47+
connect(ui->payAmount, SIGNAL(valueChanged()), this, SLOT(payAmountChangedInternal()));
4748
connect(ui->deleteButton, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked);
4849
connect(ui->deleteButton_is, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked);
4950
connect(ui->deleteButton_s, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked);
@@ -115,6 +116,17 @@ void SendCoinsEntry::clear()
115116
updateDisplayUnit();
116117
}
117118

119+
void SendCoinsEntry::payAmountChangedInternal()
120+
{
121+
const auto send_assets = ui->payAmount->fullValue();
122+
if (send_assets.first == Params().GetConsensus().pegged_asset) {
123+
ui->checkboxSubtractFeeFromAmount->setEnabled(true);
124+
} else {
125+
ui->checkboxSubtractFeeFromAmount->setCheckState(Qt::Unchecked);
126+
ui->checkboxSubtractFeeFromAmount->setEnabled(false);
127+
}
128+
}
129+
118130
void SendCoinsEntry::checkSubtractFeeFromAmount()
119131
{
120132
ui->checkboxSubtractFeeFromAmount->setChecked(true);

src/qt/sendcoinsentry.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public Q_SLOTS:
5858
void subtractFeeFromAmountChanged();
5959

6060
private Q_SLOTS:
61+
void payAmountChangedInternal();
6162
void deleteClicked();
6263
void useAvailableBalanceClicked();
6364
void on_payTo_textChanged(const QString &address);

0 commit comments

Comments
 (0)