Merge #15886: qt, wallet: Revamp SendConfirmationDialog
78f9b5160f
Do not show list for the only recipient. (Hennadii Stepanov)2ee756f041
Show recipient list as detailedText of QMessageBox (Hennadii Stepanov)654e419549
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 ACK78f9b5160f
Tree-SHA512: f868d78d01b0898aff2277fa3a7e8c6f936acbbcfa8a0323cddcd9daba4a998030c667bd803ae67c2b9179ed8082a48a67568e9ba3c8d14e3a2d88d93ada94fa
This commit is contained in:
commit
9fccdd4ed4
2 changed files with 29 additions and 17 deletions
|
@ -279,18 +279,16 @@ void SendCoinsDialog::on_sendButton_clicked()
|
|||
QStringList formatted;
|
||||
for (const SendCoinsRecipient &rcp : currentTransaction.getRecipients())
|
||||
{
|
||||
// generate bold amount string with wallet name in case of multiwallet
|
||||
QString amount = "<b>" + BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount);
|
||||
// generate amount string with wallet name in case of multiwallet
|
||||
QString amount = BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount);
|
||||
if (model->isMultiwallet()) {
|
||||
amount.append(" <u>"+tr("from wallet %1").arg(GUIUtil::HtmlEscape(model->getWalletName()))+"</u> ");
|
||||
amount.append(tr(" from wallet '%1'").arg(model->getWalletName()));
|
||||
}
|
||||
amount.append("</b>");
|
||||
// generate monospace address string
|
||||
QString address = "<span style='font-family: monospace;'>" + rcp.address;
|
||||
address.append("</span>");
|
||||
|
||||
// generate address string
|
||||
QString address = rcp.address;
|
||||
|
||||
QString recipientElement;
|
||||
recipientElement = "<br />";
|
||||
|
||||
#ifdef ENABLE_BIP70
|
||||
if (!rcp.paymentRequest.IsInitialized()) // normal payment
|
||||
|
@ -298,7 +296,7 @@ void SendCoinsDialog::on_sendButton_clicked()
|
|||
{
|
||||
if(rcp.label.length() > 0) // label with address
|
||||
{
|
||||
recipientElement.append(tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.label)));
|
||||
recipientElement.append(tr("%1 to '%2'").arg(amount, rcp.label));
|
||||
recipientElement.append(QString(" (%1)").arg(address));
|
||||
}
|
||||
else // just address
|
||||
|
@ -309,7 +307,7 @@ void SendCoinsDialog::on_sendButton_clicked()
|
|||
#ifdef ENABLE_BIP70
|
||||
else if(!rcp.authenticatedMerchant.isEmpty()) // authenticated payment request
|
||||
{
|
||||
recipientElement.append(tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.authenticatedMerchant)));
|
||||
recipientElement.append(tr("%1 to '%2'").arg(amount, rcp.authenticatedMerchant));
|
||||
}
|
||||
else // unauthenticated payment request
|
||||
{
|
||||
|
@ -323,7 +321,7 @@ void SendCoinsDialog::on_sendButton_clicked()
|
|||
QString questionString = tr("Are you sure you want to send?");
|
||||
questionString.append("<br /><span style='font-size:10pt;'>");
|
||||
questionString.append(tr("Please, review your transaction."));
|
||||
questionString.append("</span><br />%1");
|
||||
questionString.append("</span>%1");
|
||||
|
||||
if(txFee > 0)
|
||||
{
|
||||
|
@ -364,8 +362,17 @@ void SendCoinsDialog::on_sendButton_clicked()
|
|||
questionString.append(QString("<br /><span style='font-size:10pt; font-weight:normal;'>(=%1)</span>")
|
||||
.arg(alternativeUnits.join(" " + tr("or") + " ")));
|
||||
|
||||
SendConfirmationDialog confirmationDialog(tr("Confirm send coins"),
|
||||
questionString.arg(formatted.join("<br />")), SEND_CONFIRM_DELAY, this);
|
||||
QString informative_text;
|
||||
QString detailed_text;
|
||||
if (formatted.size() > 1) {
|
||||
questionString = questionString.arg("");
|
||||
informative_text = tr("To review recipient list click \"Show Details...\"");
|
||||
detailed_text = formatted.join("\n\n");
|
||||
} else {
|
||||
questionString = questionString.arg("<br /><br />" + formatted.at(0));
|
||||
}
|
||||
|
||||
SendConfirmationDialog confirmationDialog(tr("Confirm send coins"), questionString, informative_text, detailed_text, SEND_CONFIRM_DELAY, this);
|
||||
confirmationDialog.exec();
|
||||
QMessageBox::StandardButton retval = static_cast<QMessageBox::StandardButton>(confirmationDialog.result());
|
||||
|
||||
|
@ -881,10 +888,15 @@ void SendCoinsDialog::coinControlUpdateLabels()
|
|||
}
|
||||
}
|
||||
|
||||
SendConfirmationDialog::SendConfirmationDialog(const QString &title, const QString &text, int _secDelay,
|
||||
QWidget *parent) :
|
||||
QMessageBox(QMessageBox::Question, title, text, QMessageBox::Yes | QMessageBox::Cancel, parent), secDelay(_secDelay)
|
||||
SendConfirmationDialog::SendConfirmationDialog(const QString& title, const QString& text, const QString& informative_text, const QString& detailed_text, int _secDelay, QWidget* parent)
|
||||
: QMessageBox(parent), secDelay(_secDelay)
|
||||
{
|
||||
setIcon(QMessageBox::Question);
|
||||
setWindowTitle(title); // On macOS, the window title is ignored (as required by the macOS Guidelines).
|
||||
setText(text);
|
||||
setInformativeText(informative_text);
|
||||
setDetailedText(detailed_text);
|
||||
setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
|
||||
setDefaultButton(QMessageBox::Cancel);
|
||||
yesButton = button(QMessageBox::Yes);
|
||||
updateYesButton();
|
||||
|
|
|
@ -108,7 +108,7 @@ class SendConfirmationDialog : public QMessageBox
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SendConfirmationDialog(const QString &title, const QString &text, int secDelay = SEND_CONFIRM_DELAY, QWidget *parent = nullptr);
|
||||
SendConfirmationDialog(const QString& title, const QString& text, const QString& informative_text = "", const QString& detailed_text = "", int secDelay = SEND_CONFIRM_DELAY, QWidget* parent = nullptr);
|
||||
int exec();
|
||||
|
||||
private Q_SLOTS:
|
||||
|
|
Loading…
Reference in a new issue