diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 862bdd3bfe8..b4dedd0bd53 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -872,7 +872,7 @@ void BitcoinGUI::showHelpMessageClicked() #ifdef ENABLE_WALLET void BitcoinGUI::openClicked() { - OpenURIDialog dlg(this); + OpenURIDialog dlg(platformStyle, this); if(dlg.exec()) { Q_EMIT receivedURI(dlg.getURI()); diff --git a/src/qt/forms/openuridialog.ui b/src/qt/forms/openuridialog.ui index 1b7291ab9da..97399e59a20 100644 --- a/src/qt/forms/openuridialog.ui +++ b/src/qt/forms/openuridialog.ui @@ -30,6 +30,27 @@ + + + + Paste address from clipboard + + + + + + + :/icons/editpaste:/icons/editpaste + + + + + 22 + 22 + + + + diff --git a/src/qt/openuridialog.cpp b/src/qt/openuridialog.cpp index 10bf82d5320..a68eee718e6 100644 --- a/src/qt/openuridialog.cpp +++ b/src/qt/openuridialog.cpp @@ -6,15 +6,20 @@ #include #include +#include #include +#include +#include #include -OpenURIDialog::OpenURIDialog(QWidget *parent) : - QDialog(parent, GUIUtil::dialog_flags), - ui(new Ui::OpenURIDialog) +OpenURIDialog::OpenURIDialog(const PlatformStyle* platformStyle, QWidget* parent) : QDialog(parent, GUIUtil::dialog_flags), + ui(new Ui::OpenURIDialog), + m_platform_style(platformStyle) { ui->setupUi(this); + ui->pasteButton->setIcon(m_platform_style->SingleColorIcon(":/icons/editpaste")); + QObject::connect(ui->pasteButton, &QAbstractButton::clicked, ui->uriEdit, &QLineEdit::paste); GUIUtil::handleCloseWindowShortcut(this); } @@ -32,11 +37,19 @@ QString OpenURIDialog::getURI() void OpenURIDialog::accept() { SendCoinsRecipient rcp; - if(GUIUtil::parseBitcoinURI(getURI(), &rcp)) - { + if (GUIUtil::parseBitcoinURI(getURI(), &rcp)) { /* Only accept value URIs */ QDialog::accept(); } else { ui->uriEdit->setValid(false); } } + +void OpenURIDialog::changeEvent(QEvent* e) +{ + if (e->type() == QEvent::PaletteChange) { + ui->pasteButton->setIcon(m_platform_style->SingleColorIcon(":/icons/editpaste")); + } + + QDialog::changeEvent(e); +} diff --git a/src/qt/openuridialog.h b/src/qt/openuridialog.h index efe4b86f372..f3a8b0ba220 100644 --- a/src/qt/openuridialog.h +++ b/src/qt/openuridialog.h @@ -7,6 +7,8 @@ #include +class PlatformStyle; + namespace Ui { class OpenURIDialog; } @@ -16,16 +18,19 @@ class OpenURIDialog : public QDialog Q_OBJECT public: - explicit OpenURIDialog(QWidget *parent); + explicit OpenURIDialog(const PlatformStyle* platformStyle, QWidget* parent); ~OpenURIDialog(); QString getURI(); protected Q_SLOTS: void accept() override; + void changeEvent(QEvent* e) override; private: - Ui::OpenURIDialog *ui; + Ui::OpenURIDialog* ui; + + const PlatformStyle* m_platform_style; }; #endif // BITCOIN_QT_OPENURIDIALOG_H