@@ -371,6 +371,10 @@ void BitcoinGUI::createActions()
371371 m_mask_values_action->setStatusTip (tr (" Mask the values in the Overview tab" ));
372372 m_mask_values_action->setCheckable (true );
373373
374+ m_export_watchonly_action = new QAction (tr (" Export watch-only wallet" ), this );
375+ m_export_watchonly_action->setEnabled (false );
376+ m_export_watchonly_action->setStatusTip (tr (" Export a watch-only version of the current wallet that can be restored onto another node." ));
377+
374378 connect (quitAction, &QAction::triggered, this , &BitcoinGUI::quitRequested);
375379 connect (aboutAction, &QAction::triggered, this , &BitcoinGUI::aboutClicked);
376380 connect (aboutQtAction, &QAction::triggered, qApp, QApplication::aboutQt);
@@ -484,6 +488,11 @@ void BitcoinGUI::createActions()
484488 });
485489 connect (m_mask_values_action, &QAction::toggled, this , &BitcoinGUI::setPrivacy);
486490 connect (m_mask_values_action, &QAction::toggled, this , &BitcoinGUI::enableHistoryAction);
491+ connect (m_export_watchonly_action, &QAction::triggered, [this ] {
492+ QString destination = GUIUtil::getSaveFileName (this , tr (" Save Watch-only Wallet Export" ), QString (), QString (), nullptr );
493+ if (destination.isEmpty ()) return ;
494+ walletFrame->currentWalletModel ()->wallet ().exportWatchOnlyWallet (GUIUtil::QStringToPath (destination));
495+ });
487496 }
488497#endif // ENABLE_WALLET
489498
@@ -507,6 +516,7 @@ void BitcoinGUI::createMenuBar()
507516 file->addSeparator ();
508517 file->addAction (backupWalletAction);
509518 file->addAction (m_restore_wallet_action);
519+ file->addAction (m_export_watchonly_action);
510520 file->addSeparator ();
511521 file->addAction (openAction);
512522 file->addAction (signMessageAction);
@@ -715,6 +725,7 @@ void BitcoinGUI::setWalletController(WalletController* wallet_controller, bool s
715725 m_restore_wallet_action->setEnabled (true );
716726 m_migrate_wallet_action->setEnabled (true );
717727 m_migrate_wallet_action->setMenu (m_migrate_wallet_menu);
728+ m_export_watchonly_action->setEnabled (true );
718729
719730 GUIUtil::ExceptionSafeConnect (wallet_controller, &WalletController::walletAdded, this , &BitcoinGUI::addWallet);
720731 connect (wallet_controller, &WalletController::walletRemoved, this , &BitcoinGUI::removeWallet);
0 commit comments