Skip to content

Commit 9fccdd4

Browse files
committed
Merge #15886: qt, wallet: Revamp SendConfirmationDialog
78f9b51 Do not show list for the only recipient. (Hennadii Stepanov) 2ee756f Show recipient list as detailedText of QMessageBox (Hennadii Stepanov) 654e419 Make SendConfirmationDialog fully fledged (Hennadii Stepanov) Pull request description: Fix #15667 With this PR: ![Screenshot from 2019-04-24 23-47-30](https://user-images.githubusercontent.com/32963518/56692672-63400b00-66eb-11e9-87f6-15957c6e81f7.png) ![Screenshot from 2019-04-24 23-47-40](https://user-images.githubusercontent.com/32963518/56692681-663afb80-66eb-11e9-8b04-8a342026ada6.png) ACKs for commit 78f9b5: laanwj: code review ACK 78f9b51 Tree-SHA512: f868d78d01b0898aff2277fa3a7e8c6f936acbbcfa8a0323cddcd9daba4a998030c667bd803ae67c2b9179ed8082a48a67568e9ba3c8d14e3a2d88d93ada94fa
2 parents 26a0d07 + 78f9b51 commit 9fccdd4

File tree

2 files changed

+29
-17
lines changed

2 files changed

+29
-17
lines changed

src/qt/sendcoinsdialog.cpp

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -279,26 +279,24 @@ void SendCoinsDialog::on_sendButton_clicked()
279279
QStringList formatted;
280280
for (const SendCoinsRecipient &rcp : currentTransaction.getRecipients())
281281
{
282-
// generate bold amount string with wallet name in case of multiwallet
283-
QString amount = "<b>" + BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount);
282+
// generate amount string with wallet name in case of multiwallet
283+
QString amount = BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount);
284284
if (model->isMultiwallet()) {
285-
amount.append(" <u>"+tr("from wallet %1").arg(GUIUtil::HtmlEscape(model->getWalletName()))+"</u> ");
285+
amount.append(tr(" from wallet '%1'").arg(model->getWalletName()));
286286
}
287-
amount.append("</b>");
288-
// generate monospace address string
289-
QString address = "<span style='font-family: monospace;'>" + rcp.address;
290-
address.append("</span>");
287+
288+
// generate address string
289+
QString address = rcp.address;
291290

292291
QString recipientElement;
293-
recipientElement = "<br />";
294292

295293
#ifdef ENABLE_BIP70
296294
if (!rcp.paymentRequest.IsInitialized()) // normal payment
297295
#endif
298296
{
299297
if(rcp.label.length() > 0) // label with address
300298
{
301-
recipientElement.append(tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.label)));
299+
recipientElement.append(tr("%1 to '%2'").arg(amount, rcp.label));
302300
recipientElement.append(QString(" (%1)").arg(address));
303301
}
304302
else // just address
@@ -309,7 +307,7 @@ void SendCoinsDialog::on_sendButton_clicked()
309307
#ifdef ENABLE_BIP70
310308
else if(!rcp.authenticatedMerchant.isEmpty()) // authenticated payment request
311309
{
312-
recipientElement.append(tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.authenticatedMerchant)));
310+
recipientElement.append(tr("%1 to '%2'").arg(amount, rcp.authenticatedMerchant));
313311
}
314312
else // unauthenticated payment request
315313
{
@@ -323,7 +321,7 @@ void SendCoinsDialog::on_sendButton_clicked()
323321
QString questionString = tr("Are you sure you want to send?");
324322
questionString.append("<br /><span style='font-size:10pt;'>");
325323
questionString.append(tr("Please, review your transaction."));
326-
questionString.append("</span><br />%1");
324+
questionString.append("</span>%1");
327325

328326
if(txFee > 0)
329327
{
@@ -364,8 +362,17 @@ void SendCoinsDialog::on_sendButton_clicked()
364362
questionString.append(QString("<br /><span style='font-size:10pt; font-weight:normal;'>(=%1)</span>")
365363
.arg(alternativeUnits.join(" " + tr("or") + " ")));
366364

367-
SendConfirmationDialog confirmationDialog(tr("Confirm send coins"),
368-
questionString.arg(formatted.join("<br />")), SEND_CONFIRM_DELAY, this);
365+
QString informative_text;
366+
QString detailed_text;
367+
if (formatted.size() > 1) {
368+
questionString = questionString.arg("");
369+
informative_text = tr("To review recipient list click \"Show Details...\"");
370+
detailed_text = formatted.join("\n\n");
371+
} else {
372+
questionString = questionString.arg("<br /><br />" + formatted.at(0));
373+
}
374+
375+
SendConfirmationDialog confirmationDialog(tr("Confirm send coins"), questionString, informative_text, detailed_text, SEND_CONFIRM_DELAY, this);
369376
confirmationDialog.exec();
370377
QMessageBox::StandardButton retval = static_cast<QMessageBox::StandardButton>(confirmationDialog.result());
371378

@@ -881,10 +888,15 @@ void SendCoinsDialog::coinControlUpdateLabels()
881888
}
882889
}
883890

884-
SendConfirmationDialog::SendConfirmationDialog(const QString &title, const QString &text, int _secDelay,
885-
QWidget *parent) :
886-
QMessageBox(QMessageBox::Question, title, text, QMessageBox::Yes | QMessageBox::Cancel, parent), secDelay(_secDelay)
891+
SendConfirmationDialog::SendConfirmationDialog(const QString& title, const QString& text, const QString& informative_text, const QString& detailed_text, int _secDelay, QWidget* parent)
892+
: QMessageBox(parent), secDelay(_secDelay)
887893
{
894+
setIcon(QMessageBox::Question);
895+
setWindowTitle(title); // On macOS, the window title is ignored (as required by the macOS Guidelines).
896+
setText(text);
897+
setInformativeText(informative_text);
898+
setDetailedText(detailed_text);
899+
setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
888900
setDefaultButton(QMessageBox::Cancel);
889901
yesButton = button(QMessageBox::Yes);
890902
updateYesButton();

src/qt/sendcoinsdialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class SendConfirmationDialog : public QMessageBox
108108
Q_OBJECT
109109

110110
public:
111-
SendConfirmationDialog(const QString &title, const QString &text, int secDelay = SEND_CONFIRM_DELAY, QWidget *parent = nullptr);
111+
SendConfirmationDialog(const QString& title, const QString& text, const QString& informative_text = "", const QString& detailed_text = "", int secDelay = SEND_CONFIRM_DELAY, QWidget* parent = nullptr);
112112
int exec();
113113

114114
private Q_SLOTS:

0 commit comments

Comments
 (0)