Qt: show wallet name in request dlg in case of multiwallet

This commit is contained in:
Jonas Schnelli 2018-03-06 13:17:36 +08:00
parent 4826ca4b84
commit dc6f150f35
No known key found for this signature in database
GPG key ID: 1EB776BB03C7922D
3 changed files with 10 additions and 9 deletions

View file

@ -153,7 +153,7 @@ void ReceiveCoinsDialog::on_receiveButton_clicked()
ui->reqAmount->value(), ui->reqMessage->text()); ui->reqAmount->value(), ui->reqMessage->text());
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this); ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModel(model->getOptionsModel()); dialog->setModel(model);
dialog->setInfo(info); dialog->setInfo(info);
dialog->show(); dialog->show();
clear(); clear();
@ -166,7 +166,7 @@ void ReceiveCoinsDialog::on_recentRequestsView_doubleClicked(const QModelIndex &
{ {
const RecentRequestsTableModel *submodel = model->getRecentRequestsTableModel(); const RecentRequestsTableModel *submodel = model->getRecentRequestsTableModel();
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this); ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this);
dialog->setModel(model->getOptionsModel()); dialog->setModel(model);
dialog->setInfo(submodel->entry(index.row()).recipient); dialog->setInfo(submodel->entry(index.row()).recipient);
dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show(); dialog->show();

View file

@ -108,12 +108,12 @@ ReceiveRequestDialog::~ReceiveRequestDialog()
delete ui; delete ui;
} }
void ReceiveRequestDialog::setModel(OptionsModel *_model) void ReceiveRequestDialog::setModel(WalletModel *_model)
{ {
this->model = _model; this->model = _model;
if (_model) if (_model)
connect(_model, SIGNAL(displayUnitChanged(int)), this, SLOT(update())); connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(update()));
// update the display unit if necessary // update the display unit if necessary
update(); update();
@ -143,11 +143,14 @@ void ReceiveRequestDialog::update()
html += "<a href=\""+uri+"\">" + GUIUtil::HtmlEscape(uri) + "</a><br>"; html += "<a href=\""+uri+"\">" + GUIUtil::HtmlEscape(uri) + "</a><br>";
html += "<b>"+tr("Address")+"</b>: " + GUIUtil::HtmlEscape(info.address) + "<br>"; html += "<b>"+tr("Address")+"</b>: " + GUIUtil::HtmlEscape(info.address) + "<br>";
if(info.amount) if(info.amount)
html += "<b>"+tr("Amount")+"</b>: " + BitcoinUnits::formatHtmlWithUnit(model->getDisplayUnit(), info.amount) + "<br>"; html += "<b>"+tr("Amount")+"</b>: " + BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), info.amount) + "<br>";
if(!info.label.isEmpty()) if(!info.label.isEmpty())
html += "<b>"+tr("Label")+"</b>: " + GUIUtil::HtmlEscape(info.label) + "<br>"; html += "<b>"+tr("Label")+"</b>: " + GUIUtil::HtmlEscape(info.label) + "<br>";
if(!info.message.isEmpty()) if(!info.message.isEmpty())
html += "<b>"+tr("Message")+"</b>: " + GUIUtil::HtmlEscape(info.message) + "<br>"; html += "<b>"+tr("Message")+"</b>: " + GUIUtil::HtmlEscape(info.message) + "<br>";
if(model->isMultiwallet()) {
html += "<b>"+tr("Wallet")+"</b>: " + GUIUtil::HtmlEscape(model->getWalletName()) + "<br>";
}
ui->outUri->setText(html); ui->outUri->setText(html);
#ifdef USE_QRCODE #ifdef USE_QRCODE

View file

@ -12,8 +12,6 @@
#include <QLabel> #include <QLabel>
#include <QPainter> #include <QPainter>
class OptionsModel;
namespace Ui { namespace Ui {
class ReceiveRequestDialog; class ReceiveRequestDialog;
} }
@ -53,7 +51,7 @@ public:
explicit ReceiveRequestDialog(QWidget *parent = 0); explicit ReceiveRequestDialog(QWidget *parent = 0);
~ReceiveRequestDialog(); ~ReceiveRequestDialog();
void setModel(OptionsModel *model); void setModel(WalletModel *model);
void setInfo(const SendCoinsRecipient &info); void setInfo(const SendCoinsRecipient &info);
private Q_SLOTS: private Q_SLOTS:
@ -64,7 +62,7 @@ private Q_SLOTS:
private: private:
Ui::ReceiveRequestDialog *ui; Ui::ReceiveRequestDialog *ui;
OptionsModel *model; WalletModel *model;
SendCoinsRecipient info; SendCoinsRecipient info;
}; };