Skip to content

Commit 878ea69

Browse files
committed
Merge pull request #6594
5ffaaba Disallow duplicate windows. (Casey Rodarmor)
2 parents 1d133d9 + 5ffaaba commit 878ea69

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

src/qt/bitcoingui.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
9797
trayIconMenu(0),
9898
notificator(0),
9999
rpcConsole(0),
100+
helpMessageDialog(0),
100101
prevBlocks(0),
101102
spinnerFrame(0),
102103
platformStyle(platformStyle)
@@ -132,6 +133,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
132133
#endif
133134

134135
rpcConsole = new RPCConsole(platformStyle, 0);
136+
helpMessageDialog = new HelpMessageDialog(this, false);
135137
#ifdef ENABLE_WALLET
136138
if(enableWallet)
137139
{
@@ -590,9 +592,7 @@ void BitcoinGUI::aboutClicked()
590592

591593
void BitcoinGUI::showHelpMessageClicked()
592594
{
593-
HelpMessageDialog *help = new HelpMessageDialog(this, false);
594-
help->setAttribute(Qt::WA_DeleteOnClose);
595-
help->show();
595+
helpMessageDialog->show();
596596
}
597597

598598
#ifdef ENABLE_WALLET

src/qt/bitcoingui.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class SendCoinsRecipient;
2828
class UnitDisplayStatusBarControl;
2929
class WalletFrame;
3030
class WalletModel;
31+
class HelpMessageDialog;
3132

3233
class CWallet;
3334

@@ -113,6 +114,7 @@ class BitcoinGUI : public QMainWindow
113114
QMenu *trayIconMenu;
114115
Notificator *notificator;
115116
RPCConsole *rpcConsole;
117+
HelpMessageDialog *helpMessageDialog;
116118

117119
/** Keep track of previous number of blocks, to detect progress */
118120
int prevBlocks;

src/qt/walletview.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ WalletView::WalletView(const PlatformStyle *platformStyle, QWidget *parent):
5656
receiveCoinsPage = new ReceiveCoinsDialog(platformStyle);
5757
sendCoinsPage = new SendCoinsDialog(platformStyle);
5858

59+
usedSendingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::SendingTab, this);
60+
usedReceivingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this);
61+
5962
addWidget(overviewPage);
6063
addWidget(transactionsPage);
6164
addWidget(receiveCoinsPage);
@@ -115,6 +118,8 @@ void WalletView::setWalletModel(WalletModel *walletModel)
115118
overviewPage->setWalletModel(walletModel);
116119
receiveCoinsPage->setModel(walletModel);
117120
sendCoinsPage->setModel(walletModel);
121+
usedReceivingAddressesPage->setModel(walletModel->getAddressTableModel());
122+
usedSendingAddressesPage->setModel(walletModel->getAddressTableModel());
118123

119124
if (walletModel)
120125
{
@@ -273,20 +278,20 @@ void WalletView::usedSendingAddresses()
273278
{
274279
if(!walletModel)
275280
return;
276-
AddressBookPage *dlg = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::SendingTab, this);
277-
dlg->setAttribute(Qt::WA_DeleteOnClose);
278-
dlg->setModel(walletModel->getAddressTableModel());
279-
dlg->show();
281+
282+
usedSendingAddressesPage->show();
283+
usedSendingAddressesPage->raise();
284+
usedSendingAddressesPage->activateWindow();
280285
}
281286

282287
void WalletView::usedReceivingAddresses()
283288
{
284289
if(!walletModel)
285290
return;
286-
AddressBookPage *dlg = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this);
287-
dlg->setAttribute(Qt::WA_DeleteOnClose);
288-
dlg->setModel(walletModel->getAddressTableModel());
289-
dlg->show();
291+
292+
usedReceivingAddressesPage->show();
293+
usedReceivingAddressesPage->raise();
294+
usedReceivingAddressesPage->activateWindow();
290295
}
291296

292297
void WalletView::showProgress(const QString &title, int nProgress)

src/qt/walletview.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class SendCoinsDialog;
1818
class SendCoinsRecipient;
1919
class TransactionView;
2020
class WalletModel;
21+
class AddressBookPage;
2122

2223
QT_BEGIN_NAMESPACE
2324
class QModelIndex;
@@ -61,6 +62,8 @@ class WalletView : public QStackedWidget
6162
QWidget *transactionsPage;
6263
ReceiveCoinsDialog *receiveCoinsPage;
6364
SendCoinsDialog *sendCoinsPage;
65+
AddressBookPage *usedSendingAddressesPage;
66+
AddressBookPage *usedReceivingAddressesPage;
6467

6568
TransactionView *transactionView;
6669

0 commit comments

Comments
 (0)