Browse Source

Merge pull request #3567

22a5120 [Qt] Show and store message of normal bitcoin:URI (Cozz Lovan)
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
7dbe9ac1f3
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 17
      src/qt/forms/sendcoinsentry.ui
  2. 9
      src/qt/sendcoinsentry.cpp
  3. 5
      src/qt/transactiondesc.cpp
  4. 2
      src/qt/walletmodel.cpp

17
src/qt/forms/sendcoinsentry.ui

@ -141,6 +141,23 @@
<item row="2" column="1"> <item row="2" column="1">
<widget class="BitcoinAmountField" name="payAmount"/> <widget class="BitcoinAmountField" name="payAmount"/>
</item> </item>
<item row="3" column="0">
<widget class="QLabel" name="messageLabel">
<property name="text">
<string>Message:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="messageTextLabel">
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QFrame" name="SendCoins_InsecurePaymentRequest"> <widget class="QFrame" name="SendCoins_InsecurePaymentRequest">

9
src/qt/sendcoinsentry.cpp

@ -88,6 +88,9 @@ void SendCoinsEntry::clear()
ui->payTo->clear(); ui->payTo->clear();
ui->addAsLabel->clear(); ui->addAsLabel->clear();
ui->payAmount->clear(); ui->payAmount->clear();
ui->messageTextLabel->clear();
ui->messageTextLabel->hide();
ui->messageLabel->hide();
// clear UI elements for insecure payment request // clear UI elements for insecure payment request
ui->payTo_is->clear(); ui->payTo_is->clear();
ui->memoTextLabel_is->clear(); ui->memoTextLabel_is->clear();
@ -148,6 +151,7 @@ SendCoinsRecipient SendCoinsEntry::getValue()
recipient.address = ui->payTo->text(); recipient.address = ui->payTo->text();
recipient.label = ui->addAsLabel->text(); recipient.label = ui->addAsLabel->text();
recipient.amount = ui->payAmount->value(); recipient.amount = ui->payAmount->value();
recipient.message = ui->messageTextLabel->text();
return recipient; return recipient;
} }
@ -188,6 +192,11 @@ void SendCoinsEntry::setValue(const SendCoinsRecipient &value)
} }
else // normal payment else // normal payment
{ {
// message
ui->messageTextLabel->setText(recipient.message);
ui->messageTextLabel->setVisible(!recipient.message.isEmpty());
ui->messageLabel->setVisible(!recipient.message.isEmpty());
ui->payTo->setText(recipient.address); ui->payTo->setText(recipient.address);
ui->addAsLabel->setText(recipient.label); ui->addAsLabel->setText(recipient.label);
ui->payAmount->setValue(recipient.amount); ui->payAmount->setValue(recipient.amount);

5
src/qt/transactiondesc.cpp

@ -224,6 +224,11 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, int vout, int u
strHTML += "<b>" + tr("Transaction ID") + ":</b> " + TransactionRecord::formatSubTxId(wtx.GetHash(), vout) + "<br>"; strHTML += "<b>" + tr("Transaction ID") + ":</b> " + TransactionRecord::formatSubTxId(wtx.GetHash(), vout) + "<br>";
// Message from normal bitcoin:URI (bitcoin:123...?message=example)
foreach (const PAIRTYPE(string, string)& r, wtx.vOrderForm)
if (r.first == "Message")
strHTML += "<br><b>" + tr("Message") + ":</b><br>" + GUIUtil::HtmlEscape(r.second, true) + "<br>";
// //
// PaymentRequest info: // PaymentRequest info:
// //

2
src/qt/walletmodel.cpp

@ -269,6 +269,8 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
rcp.paymentRequest.SerializeToString(&value); rcp.paymentRequest.SerializeToString(&value);
newTx->vOrderForm.push_back(make_pair(key, value)); newTx->vOrderForm.push_back(make_pair(key, value));
} }
else if (!rcp.message.isEmpty()) // Message from normal bitcoin:URI (bitcoin:123...?message=example)
newTx->vOrderForm.push_back(make_pair("Message", rcp.message.toStdString()));
} }
CReserveKey *keyChange = transaction.getPossibleKeyChange(); CReserveKey *keyChange = transaction.getPossibleKeyChange();

Loading…
Cancel
Save