Skip to content

Commit 0d09b3e

Browse files
committed
Merge pull request #3144 from Diapolo/message_sendcoinsdialog
allow emit message() in sendcoinsdialog and walletview
2 parents 3b70282 + 2384a28 commit 0d09b3e

File tree

5 files changed

+30
-17
lines changed

5 files changed

+30
-17
lines changed

src/qt/bitcoingui.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,17 @@ bool BitcoinGUI::eventFilter(QObject *object, QEvent *event)
752752
return QMainWindow::eventFilter(object, event);
753753
}
754754

755-
void BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient)
755+
bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient)
756756
{
757-
walletFrame->handlePaymentRequest(recipient);
757+
// URI has to be valid
758+
if (walletFrame->handlePaymentRequest(recipient))
759+
{
760+
showNormalIfMinimized();
761+
gotoSendCoinsPage();
762+
return true;
763+
}
764+
else
765+
return false;
758766
}
759767

760768
void BitcoinGUI::setEncryptionStatus(int status)

src/qt/bitcoingui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public slots:
146146
*/
147147
void askFee(qint64 nFeeRequired, bool *payFee);
148148

149-
void handlePaymentRequest(const SendCoinsRecipient& recipient);
149+
bool handlePaymentRequest(const SendCoinsRecipient& recipient);
150150

151151
/** Show incoming transaction notification for new transactions. */
152152
void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address);

src/qt/sendcoinsdialog.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ private slots:
5252
void on_sendButton_clicked();
5353
void removeEntry(SendCoinsEntry* entry);
5454
void updateDisplayUnit();
55+
56+
signals:
57+
// Fired when a message should be reported to the user
58+
void message(const QString &title, const QString &message, unsigned int style);
5559
};
5660

5761
#endif // SENDCOINSDIALOG_H

src/qt/walletview.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,15 @@ WalletView::~WalletView()
7979
void WalletView::setBitcoinGUI(BitcoinGUI *gui)
8080
{
8181
this->gui = gui;
82-
if(gui)
82+
83+
if (gui)
8384
{
85+
// Clicking on a transaction on the overview page sends you to the transactions tab
8486
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), gui, SLOT(gotoHistoryPage()));
87+
88+
// Receive and report messages
89+
connect(this, SIGNAL(message(QString,QString,unsigned int)), gui, SLOT(message(QString,QString,unsigned int)));
90+
connect(sendCoinsPage, SIGNAL(message(QString,QString,unsigned int)), gui, SLOT(message(QString,QString,unsigned int)));
8591
}
8692
}
8793

@@ -185,15 +191,7 @@ void WalletView::gotoVerifyMessageTab(QString addr)
185191

186192
bool WalletView::handlePaymentRequest(const SendCoinsRecipient& recipient)
187193
{
188-
// URI has to be valid
189-
if (sendCoinsPage->handlePaymentRequest(recipient))
190-
{
191-
gotoSendCoinsPage();
192-
emit showNormalIfMinimized();
193-
return true;
194-
}
195-
else
196-
return false;
194+
return sendCoinsPage->handlePaymentRequest(recipient);
197195
}
198196

199197
void WalletView::showOutOfSyncWarning(bool fShow)
@@ -227,12 +225,12 @@ void WalletView::backupWallet()
227225
QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)"));
228226
if (!filename.isEmpty()) {
229227
if (!walletModel->backupWallet(filename)) {
230-
gui->message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."),
231-
CClientUIInterface::MSG_ERROR);
228+
emit message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."),
229+
CClientUIInterface::MSG_ERROR);
232230
}
233231
else
234-
gui->message(tr("Backup Successful"), tr("The wallet data was successfully saved to the new location."),
235-
CClientUIInterface::MSG_INFORMATION);
232+
emit message(tr("Backup Successful"), tr("The wallet data was successfully saved to the new location."),
233+
CClientUIInterface::MSG_INFORMATION);
236234
}
237235
}
238236

src/qt/walletview.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ public slots:
105105
signals:
106106
/** Signal that we want to show the main window */
107107
void showNormalIfMinimized();
108+
109+
/** Fired when a message should be reported to the user */
110+
void message(const QString &title, const QString &message, unsigned int style);
108111
};
109112

110113
#endif // WALLETVIEW_H

0 commit comments

Comments
 (0)