@@ -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);
@@ -488,6 +492,11 @@ void BitcoinGUI::createActions()
488492 });
489493 connect (m_mask_values_action, &QAction::toggled, this , &BitcoinGUI::setPrivacy);
490494 connect (m_mask_values_action, &QAction::toggled, this , &BitcoinGUI::enableHistoryAction);
495+ connect (m_export_watchonly_action, &QAction::triggered, [this ] {
496+ QString destination = GUIUtil::getSaveFileName (this , tr (" Save Watch-only Wallet Export" ), QString (), QString (), nullptr );
497+ if (destination.isEmpty ()) return ;
498+ walletFrame->currentWalletModel ()->wallet ().exportWatchOnlyWallet (GUIUtil::QStringToPath (destination));
499+ });
491500 }
492501#endif // ENABLE_WALLET
493502
@@ -511,6 +520,7 @@ void BitcoinGUI::createMenuBar()
511520 file->addSeparator ();
512521 file->addAction (backupWalletAction);
513522 file->addAction (m_restore_wallet_action);
523+ file->addAction (m_export_watchonly_action);
514524 file->addSeparator ();
515525 file->addAction (openAction);
516526 file->addAction (signMessageAction);
@@ -719,6 +729,7 @@ void BitcoinGUI::setWalletController(WalletController* wallet_controller, bool s
719729 m_restore_wallet_action->setEnabled (true );
720730 m_migrate_wallet_action->setEnabled (true );
721731 m_migrate_wallet_action->setMenu (m_migrate_wallet_menu);
732+ m_export_watchonly_action->setEnabled (true );
722733
723734 GUIUtil::ExceptionSafeConnect (wallet_controller, &WalletController::walletAdded, this , &BitcoinGUI::addWallet);
724735 connect (wallet_controller, &WalletController::walletRemoved, this , &BitcoinGUI::removeWallet);
0 commit comments