diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-08-26 17:38:11 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-08-26 17:39:16 +0200 |
commit | b9bd6282c5d1d8c72c8731df202b3e4f7d60f340 (patch) | |
tree | 671dc202d38f299fc5316a94c1fcb6de6172278b /src | |
parent | 3da58b216b5726461b45685aa99cab9deb78c6fd (diff) | |
parent | b197bf3270490068319d87e4b977b08f754a1307 (diff) |
Merge pull request #4649
b197bf3 [Qt] disable tray interactions when client model set to 0 (Philip Kaufmann)
314fbd9 [Qt] use BitcoinGUI::DEFAULT_WALLET constant in bitcoin.cpp (Philip Kaufmann)
8ca6a16 [Qt] ensure all class attributes are init to 0 (Philip Kaufmann)
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/bitcoin.cpp | 4 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 43 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 2 |
3 files changed, 40 insertions, 9 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 12277a8ad0..6cc6b99ceb 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -415,8 +415,8 @@ void BitcoinApplication::initializeResult(int retval) { walletModel = new WalletModel(pwalletMain, optionsModel); - window->addWallet("~Default", walletModel); - window->setCurrentWallet("~Default"); + window->addWallet(BitcoinGUI::DEFAULT_WALLET, walletModel); + window->setCurrentWallet(BitcoinGUI::DEFAULT_WALLET); connect(walletModel, SIGNAL(coinsSent(CWallet*,SendCoinsRecipient,QByteArray)), paymentServer, SLOT(fetchPaymentACK(CWallet*,const SendCoinsRecipient&,QByteArray))); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index d0a5ff13c3..68d42ce64b 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -62,10 +62,35 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) : QMainWindow(parent), clientModel(0), walletFrame(0), + unitDisplayControl(0), + labelEncryptionIcon(0), + labelConnectionsIcon(0), + labelBlocksIcon(0), + progressBarLabel(0), + progressBar(0), + progressDialog(0), + appMenuBar(0), + overviewAction(0), + historyAction(0), + quitAction(0), + sendCoinsAction(0), + usedSendingAddressesAction(0), + usedReceivingAddressesAction(0), + signMessageAction(0), + verifyMessageAction(0), + aboutAction(0), + receiveCoinsAction(0), + optionsAction(0), + toggleHideAction(0), encryptWalletAction(0), + backupWalletAction(0), changePassphraseAction(0), aboutQtAction(0), + openRPCConsoleAction(0), + openAction(0), + showHelpMessageAction(0), trayIcon(0), + trayIconMenu(0), notificator(0), rpcConsole(0), prevBlocks(0), @@ -426,8 +451,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(); } } @@ -496,7 +525,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) @@ -537,7 +565,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 @@ -923,6 +951,7 @@ void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden) { if(!clientModel) return; + // activateWindow() (sometimes) helps with keyboard focus on Windows if (isHidden()) { @@ -1007,9 +1036,10 @@ void BitcoinGUI::unsubscribeFromCoreSignals() uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3)); } -UnitDisplayStatusBarControl::UnitDisplayStatusBarControl():QLabel() +UnitDisplayStatusBarControl::UnitDisplayStatusBarControl() : + optionsModel(0), + menu(0) { - optionsModel = 0; createContextMenu(); setToolTip(tr("Unit to show amounts in. Click to select another unit.")); } @@ -1069,4 +1099,3 @@ void UnitDisplayStatusBarControl::onMenuSelection(QAction* action) optionsModel->setDisplayUnit(action->data()); } } - diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 30dd7ae317..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; @@ -219,6 +220,7 @@ protected: private: OptionsModel *optionsModel; QMenu* menu; + /** Shows context menu with Display Unit options by the mouse coordinates */ void onDisplayUnitsClicked(const QPoint& point); /** Creates context menu, its actions, and wires up all the relevant signals for mouse events. */ |