aboutsummaryrefslogtreecommitdiff
path: root/src/qt/sendcoinsentry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/sendcoinsentry.cpp')
-rw-r--r--src/qt/sendcoinsentry.cpp35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp
index 1c54850a03..75610f199e 100644
--- a/src/qt/sendcoinsentry.cpp
+++ b/src/qt/sendcoinsentry.cpp
@@ -12,12 +12,14 @@
#include <QClipboard>
SendCoinsEntry::SendCoinsEntry(QWidget *parent) :
- QFrame(parent),
+ QStackedWidget(parent),
ui(new Ui::SendCoinsEntry),
model(0)
{
ui->setupUi(this);
+ setCurrentWidget(ui->SendCoinsInsecure);
+
#ifdef Q_OS_MAC
ui->payToLayout->setSpacing(4);
#endif
@@ -101,6 +103,9 @@ bool SendCoinsEntry::validate()
// Check input validity
bool retval = true;
+ if (!recipient.authenticatedMerchant.isEmpty())
+ return retval;
+
if(!ui->payTo->hasAcceptableInput() ||
(model && !model->validateAddress(ui->payTo->text())))
{
@@ -124,13 +129,15 @@ bool SendCoinsEntry::validate()
SendCoinsRecipient SendCoinsEntry::getValue()
{
- SendCoinsRecipient rv;
+ if (!recipient.authenticatedMerchant.isEmpty())
+ return recipient;
- rv.address = ui->payTo->text();
- rv.label = ui->addAsLabel->text();
- rv.amount = ui->payAmount->value();
+ // User-entered or non-authenticated:
+ recipient.address = ui->payTo->text();
+ recipient.label = ui->addAsLabel->text();
+ recipient.amount = ui->payAmount->value();
- return rv;
+ return recipient;
}
QWidget *SendCoinsEntry::setupTabChain(QWidget *prev)
@@ -145,9 +152,22 @@ QWidget *SendCoinsEntry::setupTabChain(QWidget *prev)
void SendCoinsEntry::setValue(const SendCoinsRecipient &value)
{
+ recipient = value;
+
ui->payTo->setText(value.address);
ui->addAsLabel->setText(value.label);
ui->payAmount->setValue(value.amount);
+
+ if (!recipient.authenticatedMerchant.isEmpty())
+ {
+ const payments::PaymentDetails& details = value.paymentRequest.getDetails();
+
+ ui->payTo_s->setText(value.authenticatedMerchant);
+ ui->memo_s->setTextFormat(Qt::PlainText);
+ ui->memo_s->setText(QString::fromStdString(details.memo()));
+ ui->payAmount_s->setValue(value.amount);
+ setCurrentWidget(ui->SendCoinsSecure);
+ }
}
void SendCoinsEntry::setAddress(const QString &address)
@@ -158,7 +178,7 @@ void SendCoinsEntry::setAddress(const QString &address)
bool SendCoinsEntry::isClear()
{
- return ui->payTo->text().isEmpty();
+ return ui->payTo->text().isEmpty() && ui->payTo_s->text().isEmpty();
}
void SendCoinsEntry::setFocus()
@@ -172,5 +192,6 @@ void SendCoinsEntry::updateDisplayUnit()
{
// Update payAmount with the current unit
ui->payAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
+ ui->payAmount_s->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
}
}