Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bitcoingui.cpp
Show First 20 Lines • Show All 446 Lines • ▼ Show 20 Lines | if (walletFrame) { | ||||
connect(m_open_wallet_action->menu(), &QMenu::aboutToShow, [this] { | connect(m_open_wallet_action->menu(), &QMenu::aboutToShow, [this] { | ||||
m_open_wallet_action->menu()->clear(); | m_open_wallet_action->menu()->clear(); | ||||
for (std::string path : | for (std::string path : | ||||
m_wallet_controller->getWalletsAvailableToOpen()) { | m_wallet_controller->getWalletsAvailableToOpen()) { | ||||
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_action->menu()->addAction(name); | ||||
connect(action, &QAction::triggered, [this, path] { | connect(action, &QAction::triggered, [this, name, path] { | ||||
OpenWalletActivity *activity = | OpenWalletActivity *activity = | ||||
m_wallet_controller->openWallet( | m_wallet_controller->openWallet( | ||||
config->GetChainParams(), path); | config->GetChainParams(), path); | ||||
QProgressDialog *dialog = new QProgressDialog(this); | |||||
dialog->setLabelText(tr("Opening Wallet <b>%1</b>...") | |||||
.arg(name.toHtmlEscaped())); | |||||
dialog->setRange(0, 0); | |||||
dialog->setCancelButton(nullptr); | |||||
dialog->setWindowModality(Qt::ApplicationModal); | |||||
dialog->show(); | |||||
connect(activity, &OpenWalletActivity::message, this, | |||||
[this](QMessageBox::Icon icon, QString text) { | |||||
QMessageBox box; | |||||
box.setIcon(icon); | |||||
box.setText(tr("Open Wallet Failed")); | |||||
box.setInformativeText(text); | |||||
box.setStandardButtons(QMessageBox::Ok); | |||||
box.setDefaultButton(QMessageBox::Ok); | |||||
connect(this, &QObject::destroyed, &box, | |||||
&QDialog::accept); | |||||
box.exec(); | |||||
}); | |||||
connect(activity, &OpenWalletActivity::opened, this, | connect(activity, &OpenWalletActivity::opened, this, | ||||
&BitcoinGUI::setCurrentWallet); | &BitcoinGUI::setCurrentWallet); | ||||
connect(activity, &OpenWalletActivity::finished, activity, | connect(activity, &OpenWalletActivity::finished, activity, | ||||
&QObject::deleteLater); | &QObject::deleteLater); | ||||
connect(activity, &OpenWalletActivity::finished, dialog, | |||||
&QObject::deleteLater); | |||||
}); | }); | ||||
} | } | ||||
}); | }); | ||||
} | } | ||||
#endif // ENABLE_WALLET | #endif // ENABLE_WALLET | ||||
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this), | connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this), | ||||
&QShortcut::activated, this, | &QShortcut::activated, this, | ||||
▲ Show 20 Lines • Show All 1,036 Lines • Show Last 20 Lines |