diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-02-08 17:24:42 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-02-12 23:00:44 +0200 |
commit | 8c0eb80f41bca7b08c94de0f08692fac23e3e9f0 (patch) | |
tree | bcf848cfce0512c6d87581c831060986efcb5b73 | |
parent | 92427354dd5f80cb5c042e7afbcd386968161be4 (diff) | |
download | bitcoin-8c0eb80f41bca7b08c94de0f08692fac23e3e9f0.tar.xz |
qt: Disable tray icon menu when a modal dialog is active
-rw-r--r-- | src/qt/bitcoingui.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 52764bbf08..c34be0ff77 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -818,16 +818,26 @@ void BitcoinGUI::createTrayIconMenu() // Using QSystemTrayIcon::Context is not reliable. // See https://bugreports.qt.io/browse/QTBUG-91697 trayIconMenu.get(), &QMenu::aboutToShow, - [this, show_hide_action, send_action, receive_action, sign_action, verify_action] { + [this, show_hide_action, send_action, receive_action, sign_action, verify_action, options_action, node_window_action, quit_action] { if (show_hide_action) show_hide_action->setText( (!isHidden() && !isMinimized() && !GUIUtil::isObscured(this)) ? tr("&Hide") : tr("S&how")); - if (enableWallet) { - send_action->setEnabled(sendCoinsAction->isEnabled()); - receive_action->setEnabled(receiveCoinsAction->isEnabled()); - sign_action->setEnabled(signMessageAction->isEnabled()); - verify_action->setEnabled(verifyMessageAction->isEnabled()); + if (QApplication::activeModalWidget()) { + for (QAction* a : trayIconMenu.get()->actions()) { + a->setEnabled(false); + } + } else { + if (show_hide_action) show_hide_action->setEnabled(true); + if (enableWallet) { + send_action->setEnabled(sendCoinsAction->isEnabled()); + receive_action->setEnabled(receiveCoinsAction->isEnabled()); + sign_action->setEnabled(signMessageAction->isEnabled()); + verify_action->setEnabled(verifyMessageAction->isEnabled()); + } + options_action->setEnabled(optionsAction->isEnabled()); + node_window_action->setEnabled(openRPCConsoleAction->isEnabled()); + if (quit_action) quit_action->setEnabled(true); } }); } |