| 440 | } |
| 441 | |
| 442 | void MigrateWalletActivity::do_migrate(const std::string& name) |
| 443 | { |
| 444 | SecureString passphrase; |
| 445 | if (node().walletLoader().isEncrypted(name)) { |
| 446 | // Get the passphrase for the wallet |
| 447 | AskPassphraseDialog dlg(AskPassphraseDialog::UnlockMigration, m_parent_widget, &passphrase); |
| 448 | if (dlg.exec() == QDialog::Rejected) return; |
| 449 | } |
| 450 | |
| 451 | showProgressDialog(tr("Migrate Wallet"), tr("Migrating Wallet <b>%1</b>…").arg(GUIUtil::HtmlEscape(name))); |
| 452 | |
| 453 | QTimer::singleShot(0, worker(), [this, name, passphrase] { |
| 454 | auto res{node().walletLoader().migrateWallet(name, passphrase)}; |
| 455 | |
| 456 | if (res) { |
| 457 | m_success_message = tr("The wallet '%1' was migrated successfully.").arg(GUIUtil::HtmlEscape(GUIUtil::WalletDisplayName(name))); |
| 458 | if (res->watchonly_wallet_name) { |
| 459 | m_success_message += QChar(' ') + tr("Watchonly scripts have been migrated to a new wallet named '%1'.").arg(GUIUtil::HtmlEscape(GUIUtil::WalletDisplayName(res->watchonly_wallet_name.value()))); |
| 460 | } |
| 461 | if (res->solvables_wallet_name) { |
| 462 | m_success_message += QChar(' ') + tr("Solvable but not watched scripts have been migrated to a new wallet named '%1'.").arg(GUIUtil::HtmlEscape(GUIUtil::WalletDisplayName(res->solvables_wallet_name.value()))); |
| 463 | } |
| 464 | m_wallet_model = m_wallet_controller->getOrCreateWallet(std::move(res->wallet)); |
| 465 | } else { |
| 466 | m_error_message = util::ErrorString(res); |
| 467 | } |
| 468 | |
| 469 | QTimer::singleShot(0, this, &MigrateWalletActivity::finish); |
| 470 | }); |
| 471 | } |
| 472 | |
| 473 | void MigrateWalletActivity::migrate(const std::string& name) |
| 474 | { |
nothing calls this directly
no test coverage detected