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)
This commit is contained in:
Wladimir J. van der Laan 2014-08-26 17:38:11 +02:00
commit b9bd6282c5
No known key found for this signature in database
GPG key ID: 74810B012346C9A6
3 changed files with 40 additions and 9 deletions

View file

@ -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)));

View file

@ -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());
}
}

View file

@ -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. */