From 057bf35bc5c9e1fa3baaef41435984fc46516880 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Fri, 11 Oct 2013 14:22:43 +0200 Subject: [PATCH 1/3] 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) --- src/qt/sendcoinsentry.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index ee84f7bc11..59724c94f4 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -85,10 +85,17 @@ void SendCoinsEntry::setRemoveEnabled(bool enabled) void SendCoinsEntry::clear() { + // clear UI elements for insecure payments ui->payTo->clear(); ui->addAsLabel->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(); + // update the display unit, to not use the default ("BTC") updateDisplayUnit(); } @@ -154,17 +161,19 @@ 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()) + if (recipient.authenticatedMerchant.isEmpty()) { - const payments::PaymentDetails& details = value.paymentRequest.getDetails(); + ui->payTo->setText(recipient.address); + ui->addAsLabel->setText(recipient.label); + ui->payAmount->setValue(recipient.amount); + } + else + { + 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->payAmount_s->setValue(value.amount); + ui->payAmount_s->setValue(recipient.amount); setCurrentWidget(ui->SendCoinsSecure); } } From 8a041f494fd04f86a7813716919140bc3c664642 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Fri, 11 Oct 2013 14:29:09 +0200 Subject: [PATCH 2/3] sendcoinsdialog: display real failed address string - display the real string (faulty address), which causes the valid address check to fail, instead of a stringified "nonsense" CBitcoinAddress --- src/qt/sendcoinsdialog.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 00cea463ef..3fd4a26e76 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -365,9 +365,8 @@ bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv) else { CBitcoinAddress address(rv.address.toStdString()); if (!address.IsValid()) { - QString strAddress(address.ToString().c_str()); QMessageBox::warning(this, strSendCoins, - tr("Invalid payment address %1").arg(strAddress)); + tr("Invalid payment address %1").arg(rv.address)); return false; } } From 06dfd23d4106de6672ac451b29ae16c97d7fb76b Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Fri, 11 Oct 2013 14:40:08 +0200 Subject: [PATCH 3/3] paymentserver: use own HTML-esc / add new header const - make processPaymentRequest() use our own HTML-escaping function from GUIUtil - make string "application/bitcoin-payment" a constant (below similar constant strings in the .cpp file) --- src/qt/paymentserver.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 72f75b42e6..96ba997943 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -48,6 +48,7 @@ const int BITCOIN_IPC_CONNECT_TIMEOUT = 1000; // milliseconds const QString BITCOIN_IPC_PREFIX("bitcoin:"); const char* BITCOIN_REQUEST_MIMETYPE = "application/bitcoin-paymentrequest"; const char* BITCOIN_PAYMENTACK_MIMETYPE = "application/bitcoin-paymentack"; +const char* BITCOIN_PAYMENTACK_CONTENTTYPE = "application/bitcoin-payment"; X509_STORE* PaymentServer::certStore = NULL; void PaymentServer::freeCertStore() @@ -471,11 +472,7 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, QList