X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Fsendcoinsentry.cpp;h=85631795175ac48a4e71e7c1d0c9762ed4391fb9;hb=83e34b29071b58d6578b197430d12c55d277a515;hp=1802095b3aa6b14aa7e411b3220c660d0a3932ad;hpb=527137e3ee542da5ecd4d04364fac0eb0067a2a4;p=novacoin.git diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 1802095..8563179 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -22,7 +22,7 @@ SendCoinsEntry::SendCoinsEntry(QWidget *parent) : #endif #if QT_VERSION >= 0x040700 - ui->payTo->setPlaceholderText(tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)")); + ui->payTo->setPlaceholderText(tr("Enter a NovaCoin address (e.g. 4Zo1ga6xuKuQ7JV7M9rGDoxdbYwV5zgQJ5)")); ui->addAsLabel->setPlaceholderText(tr("Enter a label for this address to add it to your address book")); #endif setFocusPolicy(Qt::TabFocus); @@ -44,6 +44,8 @@ void SendCoinsEntry::on_pasteButton_clicked() void SendCoinsEntry::on_addressBookButton_clicked() { + if(!model) + return; AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab, this); dlg.setModel(model->getAddressTableModel()); if(dlg.exec()) @@ -55,12 +57,18 @@ void SendCoinsEntry::on_addressBookButton_clicked() void SendCoinsEntry::on_payTo_textChanged(const QString &address) { - ui->addAsLabel->setText(model->getAddressTableModel()->labelForAddress(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); } void SendCoinsEntry::setModel(WalletModel *model) { this->model = model; + clear(); } void SendCoinsEntry::setRemoveEnabled(bool enabled) @@ -74,7 +82,7 @@ void SendCoinsEntry::clear() ui->addAsLabel->clear(); ui->payAmount->clear(); ui->payTo->setFocus(); - if(model) + if(model && model->getOptionsModel()) { ui->payAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); } @@ -147,3 +155,8 @@ bool SendCoinsEntry::isClear() return ui->payTo->text().isEmpty(); } +void SendCoinsEntry::setFocus() +{ + ui->payTo->setFocus(); +} +