diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-10-18 07:04:49 -0700 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-10-18 07:04:49 -0700 |
commit | 81cab378cc351eb0e176dd7733a29df931d4f877 (patch) | |
tree | c463461906f459032667bd80d26a6cde8926a650 | |
parent | 13b1ecf0d08fffc8093f3e669c1d5c33b8b69a3f (diff) | |
parent | 46b57eb500a9060f356967a9519101f14f876ffb (diff) |
Merge pull request #3101 from Diapolo/sendcoinsentry
add SendCoinsEntry::updateLabel() function
-rw-r--r-- | src/qt/sendcoinsentry.cpp | 23 | ||||
-rw-r--r-- | src/qt/sendcoinsentry.h | 2 |
2 files changed, 19 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; +} diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index 49e622daf1..66d9752909 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -58,6 +58,8 @@ private: SendCoinsRecipient recipient; Ui::SendCoinsEntry *ui; WalletModel *model; + + bool updateLabel(const QString &address); }; #endif // SENDCOINSENTRY_H |