Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bitcoingui.cpp
Show First 20 Lines • Show All 391 Lines • ▼ Show 20 Lines | #endif // ENABLE_WALLET | ||||
openAction->setStatusTip( | openAction->setStatusTip( | ||||
tr("Open a %1: URI or payment request") | tr("Open a %1: URI or payment request") | ||||
.arg(QString::fromStdString( | .arg(QString::fromStdString( | ||||
config->GetChainParams().CashAddrPrefix()))); | config->GetChainParams().CashAddrPrefix()))); | ||||
m_open_wallet_action = new QAction(tr("Open Wallet"), this); | m_open_wallet_action = new QAction(tr("Open Wallet"), this); | ||||
m_open_wallet_action->setEnabled(false); | m_open_wallet_action->setEnabled(false); | ||||
m_open_wallet_action->setStatusTip(tr("Open a wallet")); | m_open_wallet_action->setStatusTip(tr("Open a wallet")); | ||||
m_open_wallet_menu = new QMenu(this); | |||||
m_close_wallet_action = new QAction(tr("Close Wallet..."), this); | m_close_wallet_action = new QAction(tr("Close Wallet..."), this); | ||||
m_close_wallet_action->setStatusTip(tr("Close wallet")); | m_close_wallet_action->setStatusTip(tr("Close wallet")); | ||||
showHelpMessageAction = | showHelpMessageAction = | ||||
new QAction(platformStyle->TextColorIcon(":/icons/info"), | new QAction(platformStyle->TextColorIcon(":/icons/info"), | ||||
tr("&Command-line options"), this); | tr("&Command-line options"), this); | ||||
showHelpMessageAction->setMenuRole(QAction::NoRole); | showHelpMessageAction->setMenuRole(QAction::NoRole); | ||||
Show All 34 Lines | if (walletFrame) { | ||||
connect(verifyMessageAction, &QAction::triggered, | connect(verifyMessageAction, &QAction::triggered, | ||||
[this] { gotoVerifyMessageTab(); }); | [this] { gotoVerifyMessageTab(); }); | ||||
connect(usedSendingAddressesAction, &QAction::triggered, walletFrame, | connect(usedSendingAddressesAction, &QAction::triggered, walletFrame, | ||||
&WalletFrame::usedSendingAddresses); | &WalletFrame::usedSendingAddresses); | ||||
connect(usedReceivingAddressesAction, &QAction::triggered, walletFrame, | connect(usedReceivingAddressesAction, &QAction::triggered, walletFrame, | ||||
&WalletFrame::usedReceivingAddresses); | &WalletFrame::usedReceivingAddresses); | ||||
connect(openAction, &QAction::triggered, this, | connect(openAction, &QAction::triggered, this, | ||||
&BitcoinGUI::openClicked); | &BitcoinGUI::openClicked); | ||||
connect(m_open_wallet_action->menu(), &QMenu::aboutToShow, [this] { | connect(m_open_wallet_menu, &QMenu::aboutToShow, [this] { | ||||
m_open_wallet_action->menu()->clear(); | m_open_wallet_menu->clear(); | ||||
std::vector<std::string> available_wallets = | std::vector<std::string> available_wallets = | ||||
m_wallet_controller->getWalletsAvailableToOpen(); | m_wallet_controller->getWalletsAvailableToOpen(); | ||||
std::vector<std::string> wallets = m_node.listWalletDir(); | std::vector<std::string> wallets = m_node.listWalletDir(); | ||||
for (const auto &path : wallets) { | for (const auto &path : wallets) { | ||||
QString name = path.empty() | QString name = path.empty() | ||||
? QString("[" + tr("default wallet") + "]") | ? QString("[" + tr("default wallet") + "]") | ||||
: QString::fromStdString(path); | : QString::fromStdString(path); | ||||
QAction *action = m_open_wallet_action->menu()->addAction(name); | QAction *action = m_open_wallet_menu->addAction(name); | ||||
if (std::find(available_wallets.begin(), | if (std::find(available_wallets.begin(), | ||||
available_wallets.end(), | available_wallets.end(), | ||||
path) == available_wallets.end()) { | path) == available_wallets.end()) { | ||||
// This wallet is already loaded | // This wallet is already loaded | ||||
action->setEnabled(false); | action->setEnabled(false); | ||||
continue; | continue; | ||||
} | } | ||||
Show All 27 Lines | if (walletFrame) { | ||||
&BitcoinGUI::setCurrentWallet); | &BitcoinGUI::setCurrentWallet); | ||||
connect(activity, &OpenWalletActivity::finished, activity, | connect(activity, &OpenWalletActivity::finished, activity, | ||||
&QObject::deleteLater); | &QObject::deleteLater); | ||||
connect(activity, &OpenWalletActivity::finished, dialog, | connect(activity, &OpenWalletActivity::finished, dialog, | ||||
&QObject::deleteLater); | &QObject::deleteLater); | ||||
}); | }); | ||||
} | } | ||||
if (wallets.empty()) { | if (wallets.empty()) { | ||||
QAction *action = m_open_wallet_action->menu()->addAction( | QAction *action = | ||||
tr("No wallets available")); | m_open_wallet_menu->addAction(tr("No wallets available")); | ||||
action->setEnabled(false); | action->setEnabled(false); | ||||
} | } | ||||
}); | }); | ||||
connect(m_close_wallet_action, &QAction::triggered, [this] { | connect(m_close_wallet_action, &QAction::triggered, [this] { | ||||
m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), | m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), | ||||
this); | this); | ||||
}); | }); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | |||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
void BitcoinGUI::setWalletController(WalletController *wallet_controller) { | void BitcoinGUI::setWalletController(WalletController *wallet_controller) { | ||||
assert(!m_wallet_controller); | assert(!m_wallet_controller); | ||||
assert(wallet_controller); | assert(wallet_controller); | ||||
m_wallet_controller = wallet_controller; | m_wallet_controller = wallet_controller; | ||||
m_open_wallet_action->setEnabled(true); | m_open_wallet_action->setEnabled(true); | ||||
m_open_wallet_action->setMenu(new QMenu(this)); | m_open_wallet_action->setMenu(m_open_wallet_menu); | ||||
connect(wallet_controller, &WalletController::walletAdded, this, | connect(wallet_controller, &WalletController::walletAdded, this, | ||||
&BitcoinGUI::addWallet); | &BitcoinGUI::addWallet); | ||||
connect(wallet_controller, &WalletController::walletRemoved, this, | connect(wallet_controller, &WalletController::walletRemoved, this, | ||||
&BitcoinGUI::removeWallet); | &BitcoinGUI::removeWallet); | ||||
for (WalletModel *wallet_model : m_wallet_controller->getWallets()) { | for (WalletModel *wallet_model : m_wallet_controller->getWallets()) { | ||||
addWallet(wallet_model); | addWallet(wallet_model); | ||||
▲ Show 20 Lines • Show All 862 Lines • Show Last 20 Lines |