diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2014-08-07 09:37:21 +0200 |
---|---|---|
committer | Philip Kaufmann <phil.kaufmann@t-online.de> | 2014-08-08 12:13:39 +0200 |
commit | b197bf3270490068319d87e4b977b08f754a1307 (patch) | |
tree | 07d4dbfb1ed7d84276fe814adffd75bc26c1f493 /src | |
parent | 314fbd9ac7713e812e85960499474dcf453b563e (diff) |
[Qt] disable tray interactions when client model set to 0
- this prevents the ability to fiddle around with the system tray when
already shutting down (e.g. on slow shutdowns because of a proxy delay)
- extends solution for #4360
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/bitcoingui.cpp | 13 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 1 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 429b9a9fb3..e3665dfe6e 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -89,6 +89,7 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) : openAction(0), showHelpMessageAction(0), trayIcon(0), + trayIconMenu(0), notificator(0), rpcConsole(0), prevBlocks(0), @@ -449,8 +450,12 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel) walletFrame->setClientModel(clientModel); } #endif - - this->unitDisplayControl->setOptionsModel(clientModel->getOptionsModel()); + unitDisplayControl->setOptionsModel(clientModel->getOptionsModel()); + } else { + // Disable possibility to show main window via action + toggleHideAction->setEnabled(false); + // Disable context menu on tray icon + trayIconMenu->clear(); } } @@ -519,7 +524,6 @@ void BitcoinGUI::createTrayIcon(bool fIsTestnet) void BitcoinGUI::createTrayIconMenu() { - QMenu *trayIconMenu; #ifndef Q_OS_MAC // return if trayIcon is unset (only on non-Mac OSes) if (!trayIcon) @@ -560,7 +564,7 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason) if(reason == QSystemTrayIcon::Trigger) { // Click on system tray icon triggers show/hide of the main window - toggleHideAction->trigger(); + toggleHidden(); } } #endif @@ -946,6 +950,7 @@ void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden) { if(!clientModel) return; + // activateWindow() (sometimes) helps with keyboard focus on Windows if (isHidden()) { diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 7e45240f05..30b05cb7d9 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -103,6 +103,7 @@ private: QAction *showHelpMessageAction; QSystemTrayIcon *trayIcon; + QMenu *trayIconMenu; Notificator *notificator; RPCConsole *rpcConsole; |