aboutsummaryrefslogtreecommitdiff
path: root/src/qt/sendcoinsdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/sendcoinsdialog.cpp')
-rw-r--r--src/qt/sendcoinsdialog.cpp47
1 files changed, 36 insertions, 11 deletions
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index 2c7bab2045..09d83b1a29 100644
--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -93,11 +93,26 @@ void SendCoinsDialog::on_sendButton_clicked()
QStringList formatted;
foreach(const SendCoinsRecipient &rcp, recipients)
{
+ QString amount = BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount);
+ if (rcp.authenticatedMerchant.isEmpty())
+ {
+ QString address = rcp.address;
#if QT_VERSION < 0x050000
- formatted.append(tr("<b>%1</b> to %2 (%3)").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount), Qt::escape(rcp.label), rcp.address));
+ QString to = Qt::escape(rcp.label);
#else
- formatted.append(tr("<b>%1</b> to %2 (%3)").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount), rcp.label.toHtmlEscaped(), rcp.address));
+ QString to = rcp.label.toHtmlEscaped();
#endif
+ formatted.append(tr("<b>%1</b> to %2 (%3)").arg(amount, to, address));
+ }
+ else
+ {
+#if QT_VERSION < 0x050000
+ QString merchant = Qt::escape(rcp.authenticatedMerchant);
+#else
+ QString merchant = rcp.authenticatedMerchant.toHtmlEscaped();
+#endif
+ formatted.append(tr("<b>%1</b> to %2").arg(amount, merchant));
+ }
}
fNewRecipientAllowed = false;
@@ -292,20 +307,30 @@ void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv)
entry->setValue(rv);
}
-bool SendCoinsDialog::handleURI(const QString &uri)
+bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv)
{
- SendCoinsRecipient rv;
- // URI has to be valid
- if (GUIUtil::parseBitcoinURI(uri, &rv))
- {
+ if (!rv.authenticatedMerchant.isEmpty()) {
+ // Expired payment request?
+ const payments::PaymentDetails& details = rv.paymentRequest.getDetails();
+ if (details.has_expires() && (int64)details.expires() < GetTime())
+ {
+ QMessageBox::warning(this, tr("Send Coins"),
+ tr("Payment request expired"));
+ return false;
+ }
+ }
+ else {
CBitcoinAddress address(rv.address.toStdString());
- if (!address.IsValid())
+ if (!address.IsValid()) {
+ QString strAddress(address.ToString().c_str());
+ QMessageBox::warning(this, tr("Send Coins"),
+ tr("Invalid payment address %1").arg(strAddress));
return false;
- pasteEntry(rv);
- return true;
+ }
}
- return false;
+ pasteEntry(rv);
+ return true;
}
void SendCoinsDialog::setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance)