X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Fsendcoinsentry.cpp;h=0b5db26a2cf5e4dd5241b229a7bf82b6a9a366ed;hb=9ca8b78544b413ed875ff9bb6ef376e21922e6ac;hp=caffaaeff283c467eb6e78ebc7f273781ff74fec;hpb=aa3d4c0221f7cd1cba6f8f70d58f52521e15a1e6;p=novacoin.git diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index caffaae..0b5db26 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -17,13 +17,13 @@ SendCoinsEntry::SendCoinsEntry(QWidget *parent) : { ui->setupUi(this); -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC ui->payToLayout->setSpacing(4); #endif - #if QT_VERSION >= 0x040700 - ui->payTo->setPlaceholderText(tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)")); + /* Do not move this to the XML file, Qt before 4.7 will choke on it */ ui->addAsLabel->setPlaceholderText(tr("Enter a label for this address to add it to your address book")); + ui->payTo->setPlaceholderText(tr("Enter a NovaCoin address (e.g. 4Zo1ga6xuKuQ7JV7M9rGDoxdbYwV5zgQJ5)")); #endif setFocusPolicy(Qt::TabFocus); setFocusProxy(ui->payTo); @@ -59,13 +59,21 @@ void SendCoinsEntry::on_payTo_textChanged(const QString &address) { if(!model) return; - // Fill in label from address book, if no label is filled in yet - if(ui->addAsLabel->text().isEmpty()) - ui->addAsLabel->setText(model->getAddressTableModel()->labelForAddress(address));} + // 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; + + if(model && model->getOptionsModel()) + connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); + + connect(ui->payAmount, SIGNAL(textChanged()), this, SIGNAL(payAmountChanged())); + clear(); } @@ -80,10 +88,8 @@ void SendCoinsEntry::clear() ui->addAsLabel->clear(); ui->payAmount->clear(); ui->payTo->setFocus(); - if(model && model->getOptionsModel()) - { - ui->payAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); - } + // update the display unit, to not use the default ("BTC") + updateDisplayUnit(); } void SendCoinsEntry::on_deleteButton_clicked() @@ -158,3 +164,11 @@ void SendCoinsEntry::setFocus() ui->payTo->setFocus(); } +void SendCoinsEntry::updateDisplayUnit() +{ + if(model && model->getOptionsModel()) + { + // Update payAmount with the current unit + ui->payAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); + } +}