Merge pull request #3101 from Diapolo/sendcoinsentry
add SendCoinsEntry::updateLabel() function
This commit is contained in:
commit
81cab378cc
2 changed files with 19 additions and 6 deletions
|
@ -60,12 +60,7 @@ void SendCoinsEntry::on_addressBookButton_clicked()
|
||||||
|
|
||||||
void SendCoinsEntry::on_payTo_textChanged(const QString &address)
|
void SendCoinsEntry::on_payTo_textChanged(const QString &address)
|
||||||
{
|
{
|
||||||
if(!model)
|
updateLabel(address);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendCoinsEntry::setModel(WalletModel *model)
|
void SendCoinsEntry::setModel(WalletModel *model)
|
||||||
|
@ -204,3 +199,19 @@ void SendCoinsEntry::updateDisplayUnit()
|
||||||
ui->payAmount_s->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -58,6 +58,8 @@ private:
|
||||||
SendCoinsRecipient recipient;
|
SendCoinsRecipient recipient;
|
||||||
Ui::SendCoinsEntry *ui;
|
Ui::SendCoinsEntry *ui;
|
||||||
WalletModel *model;
|
WalletModel *model;
|
||||||
|
|
||||||
|
bool updateLabel(const QString &address);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SENDCOINSENTRY_H
|
#endif // SENDCOINSENTRY_H
|
||||||
|
|
Loading…
Reference in a new issue