@@ -314,7 +314,7 @@ bool SendCoinsDialog::PrepareSendText(QString& question_string, QString& informa
314
314
315
315
question_string.append (" <br /><span style='font-size:10pt;'>" );
316
316
if (model->wallet ().privateKeysDisabled ()) {
317
- question_string.append (tr (" Please, review your transaction proposal. This will produce a Partially Signed Bitcoin Transaction (PSBT) which you can copy and then sign with e.g. an offline %1 wallet, or a PSBT-compatible hardware wallet." ).arg (PACKAGE_NAME));
317
+ question_string.append (tr (" Please, review your transaction proposal. This will produce a Partially Signed Bitcoin Transaction (PSBT) which you can save or copy and then sign with e.g. an offline %1 wallet, or a PSBT-compatible hardware wallet." ).arg (PACKAGE_NAME));
318
318
} else {
319
319
question_string.append (tr (" Please, review your transaction." ));
320
320
}
@@ -380,7 +380,7 @@ void SendCoinsDialog::on_sendButton_clicked()
380
380
assert (m_current_transaction);
381
381
382
382
const QString confirmation = model->wallet ().privateKeysDisabled () ? tr (" Confirm transaction proposal" ) : tr (" Confirm send coins" );
383
- const QString confirmButtonText = model->wallet ().privateKeysDisabled () ? tr (" Copy PSBT to clipboard " ) : tr (" Send" );
383
+ const QString confirmButtonText = model->wallet ().privateKeysDisabled () ? tr (" Create Unsigned " ) : tr (" Send" );
384
384
SendConfirmationDialog confirmationDialog (confirmation, question_string, informative_text, detailed_text, SEND_CONFIRM_DELAY, confirmButtonText, this );
385
385
confirmationDialog.exec ();
386
386
QMessageBox::StandardButton retval = static_cast <QMessageBox::StandardButton>(confirmationDialog.result ());
@@ -403,7 +403,43 @@ void SendCoinsDialog::on_sendButton_clicked()
403
403
CDataStream ssTx (SER_NETWORK, PROTOCOL_VERSION);
404
404
ssTx << psbtx;
405
405
GUIUtil::setClipboard (EncodeBase64 (ssTx.str ()).c_str ());
406
- Q_EMIT message (tr (" PSBT copied" ), " Copied to clipboard" , CClientUIInterface::MSG_INFORMATION);
406
+ QMessageBox msgBox;
407
+ msgBox.setText (" Unsigned Transaction" );
408
+ msgBox.setInformativeText (" The PSBT has been copied to the clipboard. You can also save it." );
409
+ msgBox.setStandardButtons (QMessageBox::Save | QMessageBox::Discard);
410
+ msgBox.setDefaultButton (QMessageBox::Discard);
411
+ switch (msgBox.exec ()) {
412
+ case QMessageBox::Save: {
413
+ QString selectedFilter;
414
+ QString fileNameSuggestion = " " ;
415
+ bool first = true ;
416
+ for (const SendCoinsRecipient &rcp : m_current_transaction->getRecipients ()) {
417
+ if (!first) {
418
+ fileNameSuggestion.append (" - " );
419
+ }
420
+ QString labelOrAddress = rcp.label .isEmpty () ? rcp.address : rcp.label ;
421
+ QString amount = BitcoinUnits::formatWithUnit (model->getOptionsModel ()->getDisplayUnit (), rcp.amount );
422
+ fileNameSuggestion.append (labelOrAddress + " -" + amount);
423
+ first = false ;
424
+ }
425
+ fileNameSuggestion.append (" .psbt" );
426
+ QString filename = GUIUtil::getSaveFileName (this ,
427
+ tr (" Save Transaction Data" ), fileNameSuggestion,
428
+ tr (" Partially Signed Transaction (Binary) (*.psbt)" ), &selectedFilter);
429
+ if (filename.isEmpty ()) {
430
+ return ;
431
+ }
432
+ std::ofstream out (filename.toLocal8Bit ().data ());
433
+ out << ssTx.str ();
434
+ out.close ();
435
+ Q_EMIT message (tr (" PSBT saved" ), " PSBT saved to disk" , CClientUIInterface::MSG_INFORMATION);
436
+ break ;
437
+ }
438
+ case QMessageBox::Discard:
439
+ break ;
440
+ default :
441
+ assert (false );
442
+ }
407
443
} else {
408
444
// now send the prepared transaction
409
445
WalletModel::SendCoinsReturn sendStatus = model->sendCoins (*m_current_transaction);
@@ -422,10 +458,13 @@ void SendCoinsDialog::on_sendButton_clicked()
422
458
coinControlUpdateLabels ();
423
459
}
424
460
fNewRecipientAllowed = true ;
461
+ m_current_transaction.reset ();
425
462
}
426
463
427
464
void SendCoinsDialog::clear ()
428
465
{
466
+ m_current_transaction.reset ();
467
+
429
468
// Clear coin control settings
430
469
CoinControlDialog::coinControl ()->UnSelectAll ();
431
470
ui->checkBoxCoinControlChange ->setChecked (false );
0 commit comments