From 2ebae1ab89e2fe11bdde17efa2ed78af31725f0e Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 7 Jan 2019 14:44:20 +0000 Subject: [PATCH] GUI: SendCoinsEntry: Propagate asset types available to amount field --- src/qt/sendcoinsentry.cpp | 12 +++++++++++- src/qt/sendcoinsentry.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index b394ff3150..4d0df9e1a2 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -81,8 +81,10 @@ void SendCoinsEntry::setModel(WalletModel *_model) { this->model = _model; - if (_model && _model->getOptionsModel()) + if (_model && _model->getOptionsModel()) { connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsEntry::updateDisplayUnit); + connect(_model, SIGNAL(assetTypesChanged()), this, SLOT(updateAssetTypes())); + } clear(); } @@ -107,6 +109,7 @@ void SendCoinsEntry::clear() ui->payAmount_s->clear(); // update the display unit, to not use the default ("BTC") + updateAssetTypes(); updateDisplayUnit(); } @@ -251,6 +254,13 @@ void SendCoinsEntry::setFocus() ui->payTo->setFocus(); } +void SendCoinsEntry::updateAssetTypes() +{ + if (model) { + ui->payAmount->setAllowedAssets(model->getAssetTypes()); + } +} + void SendCoinsEntry::updateDisplayUnit() { if(model && model->getOptionsModel()) diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index 48ecd598d6..935f1622b0 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -64,6 +64,7 @@ private Q_SLOTS: void on_addressBookButton_clicked(); void on_pasteButton_clicked(); void updateDisplayUnit(); + void updateAssetTypes(); private: SendCoinsRecipient recipient;