Skip to content

Commit

Permalink
Merge pull request #3144 from Diapolo/message_sendcoinsdialog
Browse files Browse the repository at this point in the history
allow emit message() in sendcoinsdialog and walletview
  • Loading branch information
laanwj committed Oct 25, 2013
2 parents 3b70282 + 2384a28 commit 0d09b3e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
12 changes: 10 additions & 2 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,17 @@ bool BitcoinGUI::eventFilter(QObject *object, QEvent *event)
return QMainWindow::eventFilter(object, event);
}

void BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient)
bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient)
{
walletFrame->handlePaymentRequest(recipient);
// URI has to be valid
if (walletFrame->handlePaymentRequest(recipient))
{
showNormalIfMinimized();
gotoSendCoinsPage();
return true;
}
else
return false;
}

void BitcoinGUI::setEncryptionStatus(int status)
Expand Down
2 changes: 1 addition & 1 deletion src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public slots:
*/
void askFee(qint64 nFeeRequired, bool *payFee);

void handlePaymentRequest(const SendCoinsRecipient& recipient);
bool handlePaymentRequest(const SendCoinsRecipient& recipient);

/** Show incoming transaction notification for new transactions. */
void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address);
Expand Down
4 changes: 4 additions & 0 deletions src/qt/sendcoinsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ private slots:
void on_sendButton_clicked();
void removeEntry(SendCoinsEntry* entry);
void updateDisplayUnit();

signals:
// Fired when a message should be reported to the user
void message(const QString &title, const QString &message, unsigned int style);
};

#endif // SENDCOINSDIALOG_H
26 changes: 12 additions & 14 deletions src/qt/walletview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,15 @@ WalletView::~WalletView()
void WalletView::setBitcoinGUI(BitcoinGUI *gui)
{
this->gui = gui;
if(gui)

if (gui)
{
// Clicking on a transaction on the overview page sends you to the transactions tab
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), gui, SLOT(gotoHistoryPage()));

// Receive and report messages
connect(this, SIGNAL(message(QString,QString,unsigned int)), gui, SLOT(message(QString,QString,unsigned int)));
connect(sendCoinsPage, SIGNAL(message(QString,QString,unsigned int)), gui, SLOT(message(QString,QString,unsigned int)));
}
}

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

bool WalletView::handlePaymentRequest(const SendCoinsRecipient& recipient)
{
// URI has to be valid
if (sendCoinsPage->handlePaymentRequest(recipient))
{
gotoSendCoinsPage();
emit showNormalIfMinimized();
return true;
}
else
return false;
return sendCoinsPage->handlePaymentRequest(recipient);
}

void WalletView::showOutOfSyncWarning(bool fShow)
Expand Down Expand Up @@ -227,12 +225,12 @@ void WalletView::backupWallet()
QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)"));
if (!filename.isEmpty()) {
if (!walletModel->backupWallet(filename)) {
gui->message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."),
CClientUIInterface::MSG_ERROR);
emit message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."),
CClientUIInterface::MSG_ERROR);
}
else
gui->message(tr("Backup Successful"), tr("The wallet data was successfully saved to the new location."),
CClientUIInterface::MSG_INFORMATION);
emit message(tr("Backup Successful"), tr("The wallet data was successfully saved to the new location."),
CClientUIInterface::MSG_INFORMATION);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/qt/walletview.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ public slots:
signals:
/** Signal that we want to show the main window */
void showNormalIfMinimized();

/** Fired when a message should be reported to the user */
void message(const QString &title, const QString &message, unsigned int style);
};

#endif // WALLETVIEW_H

0 comments on commit 0d09b3e

Please sign in to comment.