mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
refactor: Get rid of Wallet::IsWalletFlagSet method
Replace by privateKeysDisabled method to avoid need for GUI to reference internal wallet flags. Also remove adjacent WalletModel canGetAddresses wrapper that serves no purpose and make Wallet::canGetAddresses non-const so it can be implemented by IPC classes in #10102.
This commit is contained in:
@@ -187,7 +187,7 @@ void SendCoinsDialog::setModel(WalletModel *_model)
|
||||
// set default rbf checkbox state
|
||||
ui->optInRBF->setCheckState(Qt::Checked);
|
||||
|
||||
if (model->privateKeysDisabled()) {
|
||||
if (model->wallet().privateKeysDisabled()) {
|
||||
ui->sendButton->setText(tr("Cr&eate Unsigned"));
|
||||
ui->sendButton->setToolTip(tr("Creates a Partially Signed Bitcoin Transaction (PSBT) for use with e.g. an offline %1 wallet, or a PSBT-compatible hardware wallet.").arg(PACKAGE_NAME));
|
||||
}
|
||||
@@ -312,14 +312,14 @@ void SendCoinsDialog::on_sendButton_clicked()
|
||||
}
|
||||
|
||||
QString questionString;
|
||||
if (model->privateKeysDisabled()) {
|
||||
if (model->wallet().privateKeysDisabled()) {
|
||||
questionString.append(tr("Do you want to draft this transaction?"));
|
||||
} else {
|
||||
questionString.append(tr("Are you sure you want to send?"));
|
||||
}
|
||||
|
||||
questionString.append("<br /><span style='font-size:10pt;'>");
|
||||
if (model->privateKeysDisabled()) {
|
||||
if (model->wallet().privateKeysDisabled()) {
|
||||
questionString.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));
|
||||
} else {
|
||||
questionString.append(tr("Please, review your transaction."));
|
||||
@@ -374,8 +374,8 @@ void SendCoinsDialog::on_sendButton_clicked()
|
||||
} else {
|
||||
questionString = questionString.arg("<br /><br />" + formatted.at(0));
|
||||
}
|
||||
const QString confirmation = model->privateKeysDisabled() ? tr("Confirm transaction proposal") : tr("Confirm send coins");
|
||||
const QString confirmButtonText = model->privateKeysDisabled() ? tr("Copy PSBT to clipboard") : tr("Send");
|
||||
const QString confirmation = model->wallet().privateKeysDisabled() ? tr("Confirm transaction proposal") : tr("Confirm send coins");
|
||||
const QString confirmButtonText = model->wallet().privateKeysDisabled() ? tr("Copy PSBT to clipboard") : tr("Send");
|
||||
SendConfirmationDialog confirmationDialog(confirmation, questionString, informative_text, detailed_text, SEND_CONFIRM_DELAY, confirmButtonText, this);
|
||||
confirmationDialog.exec();
|
||||
QMessageBox::StandardButton retval = static_cast<QMessageBox::StandardButton>(confirmationDialog.result());
|
||||
@@ -387,7 +387,7 @@ void SendCoinsDialog::on_sendButton_clicked()
|
||||
}
|
||||
|
||||
bool send_failure = false;
|
||||
if (model->privateKeysDisabled()) {
|
||||
if (model->wallet().privateKeysDisabled()) {
|
||||
CMutableTransaction mtx = CMutableTransaction{*(currentTransaction.getWtx())};
|
||||
PartiallySignedTransaction psbtx(mtx);
|
||||
bool complete = false;
|
||||
@@ -562,7 +562,7 @@ void SendCoinsDialog::setBalance(const interfaces::WalletBalances& balances)
|
||||
if(model && model->getOptionsModel())
|
||||
{
|
||||
CAmount balance = balances.balance;
|
||||
if (model->privateKeysDisabled()) {
|
||||
if (model->wallet().privateKeysDisabled()) {
|
||||
balance = balances.watch_only_balance;
|
||||
ui->labelBalanceName->setText(tr("Watch-only balance:"));
|
||||
}
|
||||
@@ -652,7 +652,7 @@ void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry)
|
||||
}
|
||||
|
||||
// Include watch-only for wallets without private key
|
||||
coin_control.fAllowWatchOnly = model->privateKeysDisabled();
|
||||
coin_control.fAllowWatchOnly = model->wallet().privateKeysDisabled();
|
||||
|
||||
// Calculate available amount to send.
|
||||
CAmount amount = model->wallet().getAvailableBalance(coin_control);
|
||||
@@ -707,7 +707,7 @@ void SendCoinsDialog::updateCoinControlState(CCoinControl& ctrl)
|
||||
ctrl.m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex());
|
||||
ctrl.m_signal_bip125_rbf = ui->optInRBF->isChecked();
|
||||
// Include watch-only for wallets without private key
|
||||
ctrl.fAllowWatchOnly = model->privateKeysDisabled();
|
||||
ctrl.fAllowWatchOnly = model->wallet().privateKeysDisabled();
|
||||
}
|
||||
|
||||
void SendCoinsDialog::updateSmartFeeLabel()
|
||||
|
||||
Reference in New Issue
Block a user