Browse Source

add SendCoinsEntry::updateLabel() function

- makes the code for updating a label reusable
- no functional changes
0.10
Philip Kaufmann 11 years ago
parent
commit
46b57eb500
  1. 23
      src/qt/sendcoinsentry.cpp
  2. 2
      src/qt/sendcoinsentry.h

23
src/qt/sendcoinsentry.cpp

@ -60,12 +60,7 @@ void SendCoinsEntry::on_addressBookButton_clicked() @@ -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() @@ -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;
}

2
src/qt/sendcoinsentry.h

@ -58,6 +58,8 @@ private: @@ -58,6 +58,8 @@ private:
SendCoinsRecipient recipient;
Ui::SendCoinsEntry *ui;
WalletModel *model;
bool updateLabel(const QString &address);
};
#endif // SENDCOINSENTRY_H

Loading…
Cancel
Save