Browse Source

sendcoinsentry: small clear() and setValue() changes

- clear(): clear all UI elements (for secure and insecure payments)
- setValue(): only modify UI elements, which need to be set (for secure
  or insecure payments)
0.10
Philip Kaufmann 11 years ago
parent
commit
057bf35bc5
  1. 25
      src/qt/sendcoinsentry.cpp

25
src/qt/sendcoinsentry.cpp

@ -85,10 +85,17 @@ void SendCoinsEntry::setRemoveEnabled(bool enabled)
void SendCoinsEntry::clear() void SendCoinsEntry::clear()
{ {
// clear UI elements for insecure payments
ui->payTo->clear(); ui->payTo->clear();
ui->addAsLabel->clear(); ui->addAsLabel->clear();
ui->payAmount->clear(); ui->payAmount->clear();
// and the ones for secure payments just to be sure
ui->payTo_s->clear();
ui->memoTextLabel_s->clear();
ui->payAmount_s->clear();
ui->payTo->setFocus(); ui->payTo->setFocus();
// update the display unit, to not use the default ("BTC") // update the display unit, to not use the default ("BTC")
updateDisplayUnit(); updateDisplayUnit();
} }
@ -154,17 +161,19 @@ void SendCoinsEntry::setValue(const SendCoinsRecipient &value)
{ {
recipient = value; recipient = value;
ui->payTo->setText(value.address); if (recipient.authenticatedMerchant.isEmpty())
ui->addAsLabel->setText(value.label); {
ui->payAmount->setValue(value.amount); ui->payTo->setText(recipient.address);
ui->addAsLabel->setText(recipient.label);
if (!recipient.authenticatedMerchant.isEmpty()) ui->payAmount->setValue(recipient.amount);
}
else
{ {
const payments::PaymentDetails& details = value.paymentRequest.getDetails(); const payments::PaymentDetails& details = recipient.paymentRequest.getDetails();
ui->payTo_s->setText(value.authenticatedMerchant); ui->payTo_s->setText(recipient.authenticatedMerchant);
ui->memoTextLabel_s->setText(QString::fromStdString(details.memo())); ui->memoTextLabel_s->setText(QString::fromStdString(details.memo()));
ui->payAmount_s->setValue(value.amount); ui->payAmount_s->setValue(recipient.amount);
setCurrentWidget(ui->SendCoinsSecure); setCurrentWidget(ui->SendCoinsSecure);
} }
} }

Loading…
Cancel
Save