diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/bitcoin.cpp | 4 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 10 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 3 | ||||
-rw-r--r-- | src/qt/walletview.cpp | 4 |
4 files changed, 15 insertions, 6 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 12a620c57a..4313d6ee7f 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -361,7 +361,9 @@ void BitcoinApplication::initializeResult(bool success) if (paymentServer) { connect(paymentServer, &PaymentServer::receivedPaymentRequest, window, &BitcoinGUI::handlePaymentRequest); connect(window, &BitcoinGUI::receivedURI, paymentServer, &PaymentServer::handleURIOrFile); - connect(paymentServer, &PaymentServer::message, window, &BitcoinGUI::message); + connect(paymentServer, &PaymentServer::message, [this](const QString& title, const QString& message, unsigned int style) { + window->message(title, message, style); + }); QTimer::singleShot(100, paymentServer, &PaymentServer::uiReady); } #endif diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 6043e93f92..f22d33bf0a 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -564,7 +564,9 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel) connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks); // Receive and report messages from client model - connect(_clientModel, &ClientModel::message, this, &BitcoinGUI::message); + connect(_clientModel, &ClientModel::message, [this](const QString &title, const QString &message, unsigned int style){ + this->message(title, message, style); + }); // Show progress dialog connect(_clientModel, &ClientModel::showProgress, this, &BitcoinGUI::showProgress); @@ -1025,7 +1027,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer progressBar->setToolTip(tooltip); } -void BitcoinGUI::message(const QString& title, QString message, unsigned int style) +void BitcoinGUI::message(const QString& title, QString message, unsigned int style, bool* ret) { // Default title. On macOS, the window title is ignored (as required by the macOS Guidelines). QString strTitle{PACKAGE_NAME}; @@ -1079,7 +1081,9 @@ void BitcoinGUI::message(const QString& title, QString message, unsigned int sty showNormalIfMinimized(); QMessageBox mBox(static_cast<QMessageBox::Icon>(nMBoxIcon), strTitle, message, buttons, this); mBox.setTextFormat(Qt::PlainText); - mBox.exec(); + int r = mBox.exec(); + if (ret != nullptr) + *ret = r == QMessageBox::Ok; } else { notificator->notify(static_cast<Notificator::Class>(nNotifyIcon), strTitle, message); } diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 45fbb03aa4..809cf8b4ed 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -219,8 +219,9 @@ public Q_SLOTS: @param[in] message the displayed text @param[in] style modality and style definitions (icon and used buttons - buttons only for message boxes) @see CClientUIInterface::MessageBoxFlags + @param[in] ret pointer to a bool that will be modified to whether Ok was clicked (modal only) */ - void message(const QString& title, QString message, unsigned int style); + void message(const QString& title, QString message, unsigned int style, bool* ret = nullptr); #ifdef ENABLE_WALLET void setCurrentWallet(WalletModel* wallet_model); diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index d0a4a622a9..c777d633be 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -97,7 +97,9 @@ void WalletView::setBitcoinGUI(BitcoinGUI *gui) connect(sendCoinsPage, &SendCoinsDialog::coinsSent, gui, &BitcoinGUI::gotoHistoryPage); // Receive and report messages - connect(this, &WalletView::message, gui, &BitcoinGUI::message); + connect(this, &WalletView::message, [gui](const QString &title, const QString &message, unsigned int style) { + gui->message(title, message, style); + }); // Pass through encryption status changed signals connect(this, &WalletView::encryptionStatusChanged, gui, &BitcoinGUI::updateWalletStatus); |