Mercurial > hg > bitcoin
changeset 3176:da5161c0559f draft
replace some ugly code in addressbookpage.cpp
- add signals signMessage() and verifyMessage() in addressbookpage.cpp
- connect to them in bitcoingui.cpp to switch to the corresponding tab in the Sign/Verify Message dialog
- make gotoSignMessageTab() and gotoVerifyMessageTab() private slots
author | Philip Kaufmann <phil.kaufmann@t-online.de> |
---|---|
date | Sun, 08 Jul 2012 18:48:56 +0200 |
parents | 7d395f223d33 |
children | b79553e5f935 |
files | src/qt/addressbookpage.cpp src/qt/addressbookpage.h src/qt/bitcoingui.cpp src/qt/bitcoingui.h |
diffstat | 4 files changed, 16 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -190,10 +190,7 @@ addr = address.toString(); } - QObject *qoGUI = parent()->parent(); - BitcoinGUI *gui = qobject_cast<BitcoinGUI *>(qoGUI); - if (gui) - gui->gotoSignMessageTab(addr); + emit signMessage(addr); } void AddressBookPage::on_verifyMessage_clicked() @@ -208,10 +205,7 @@ addr = address.toString(); } - QObject *qoGUI = parent()->parent(); - BitcoinGUI *gui = qobject_cast<BitcoinGUI *>(qoGUI); - if (gui) - gui->gotoVerifyMessageTab(addr); + emit verifyMessage(addr); } void AddressBookPage::on_newAddressButton_clicked()
--- a/src/qt/addressbookpage.h +++ b/src/qt/addressbookpage.h @@ -76,6 +76,10 @@ /** New entry/entries were added to address table */ void selectNewAddress(const QModelIndex &parent, int begin, int end); + +signals: + void signMessage(QString addr); + void verifyMessage(QString addr); }; #endif // ADDRESSBOOKDIALOG_H
--- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -165,6 +165,11 @@ rpcConsole = new RPCConsole(this); connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); + // Clicking on "Verify Message" in the address book sends you to the verify message tab + connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString))); + // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab + connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString))); + gotoOverviewPage(); }
--- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -132,9 +132,6 @@ void askFee(qint64 nFeeRequired, bool *payFee); void handleURI(QString strURI); - void gotoSignMessageTab(QString addr = ""); - void gotoVerifyMessageTab(QString addr = ""); - private slots: /** Switch to overview (home) page */ void gotoOverviewPage(); @@ -147,6 +144,11 @@ /** Switch to send coins page */ void gotoSendCoinsPage(); + /** Show Sign/Verify Message dialog and switch to sign message tab */ + void gotoSignMessageTab(QString addr = ""); + /** Show Sign/Verify Message dialog and switch to verify message tab */ + void gotoVerifyMessageTab(QString addr = ""); + /** Show configuration dialog */ void optionsClicked(); /** Show about dialog */