Payment Protocol: X509-validated payment requests
Add support for a Payment Protocol to Bitcoin-Qt. Payment messages are protocol-buffer encoded and communicated over http(s), so this adds a dependency on the Google protocol buffer library, and requires Qt with OpenSSL support.
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user