diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2013-10-16 17:11:39 +0200 |
---|---|---|
committer | Philip Kaufmann <phil.kaufmann@t-online.de> | 2013-10-16 17:11:39 +0200 |
commit | 46b57eb500a9060f356967a9519101f14f876ffb (patch) | |
tree | 68db1436718daec36d894f39e77a633420c3d18e /src/qt/sendcoinsentry.cpp | |
parent | 0487cc4137a7a145a7030d65bc6320a01aaa9525 (diff) |
add SendCoinsEntry::updateLabel() function
- makes the code for updating a label reusable
- no functional changes
Diffstat (limited to 'src/qt/sendcoinsentry.cpp')
-rw-r--r-- | src/qt/sendcoinsentry.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index aa671e0540..188b8860a9 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -60,12 +60,7 @@ void SendCoinsEntry::on_addressBookButton_clicked() void SendCoinsEntry::on_payTo_textChanged(const QString &address) { - if(!model) - return; - // Fill in label from address book, if address has an associated label - QString associatedLabel = model->getAddressTableModel()->labelForAddress(address); - if(!associatedLabel.isEmpty()) - ui->addAsLabel->setText(associatedLabel); + updateLabel(address); } void SendCoinsEntry::setModel(WalletModel *model) @@ -204,3 +199,19 @@ void SendCoinsEntry::updateDisplayUnit() ui->payAmount_s->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); } } + +bool SendCoinsEntry::updateLabel(const QString &address) +{ + if(!model) + return false; + + // Fill in label from address book, if address has an associated label + QString associatedLabel = model->getAddressTableModel()->labelForAddress(address); + if(!associatedLabel.isEmpty()) + { + ui->addAsLabel->setText(associatedLabel); + return true; + } + + return false; +} |