Skip to content

Commit 84f23e8

Browse files
kristapskcvenglerpromaghebasto
committed
gui: Paste button in Open URI dialog
Co-authored-by: Emil Engler <[email protected]> Co-authored-by: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= <[email protected]> Co-authored-by: Hennadii Stepanov <[email protected]>
1 parent 00a9b06 commit 84f23e8

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

src/qt/bitcoingui.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2011-2020 The Bitcoin Core developers
1+
// Copyright (c) 2011-2021 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -853,7 +853,7 @@ void BitcoinGUI::showHelpMessageClicked()
853853
#ifdef ENABLE_WALLET
854854
void BitcoinGUI::openClicked()
855855
{
856-
OpenURIDialog dlg(this);
856+
OpenURIDialog dlg(platformStyle, this);
857857
if(dlg.exec())
858858
{
859859
Q_EMIT receivedURI(dlg.getURI());

src/qt/forms/openuridialog.ui

+21
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,27 @@
3030
</property>
3131
</widget>
3232
</item>
33+
<item>
34+
<widget class="QToolButton" name="pasteButton">
35+
<property name="toolTip">
36+
<string>Paste address from clipboard</string>
37+
</property>
38+
<property name="text">
39+
<string/>
40+
</property>
41+
<property name="icon">
42+
<iconset resource="../bitcoin.qrc">
43+
<normaloff>:/icons/editpaste</normaloff>:/icons/editpaste
44+
</iconset>
45+
</property>
46+
<property name="iconSize">
47+
<size>
48+
<width>22</width>
49+
<height>22</height>
50+
</size>
51+
</property>
52+
</widget>
53+
</item>
3354
</layout>
3455
</item>
3556
<item>

src/qt/openuridialog.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
// Copyright (c) 2011-2019 The Bitcoin Core developers
1+
// Copyright (c) 2011-2021 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <qt/openuridialog.h>
66
#include <qt/forms/ui_openuridialog.h>
77

88
#include <qt/guiutil.h>
9+
#include <qt/platformstyle.h>
910
#include <qt/sendcoinsrecipient.h>
1011

12+
#include <QAbstractButton>
13+
#include <QClipboard>
14+
#include <QLineEdit>
1115
#include <QUrl>
1216

13-
OpenURIDialog::OpenURIDialog(QWidget *parent) :
17+
OpenURIDialog::OpenURIDialog(const PlatformStyle* platformStyle, QWidget* parent) :
1418
QDialog(parent, GUIUtil::dialog_flags),
1519
ui(new Ui::OpenURIDialog)
1620
{
1721
ui->setupUi(this);
22+
ui->pasteButton->setIcon(platformStyle->SingleColorIcon(":/icons/editpaste"));
23+
QObject::connect(ui->pasteButton, &QAbstractButton::clicked, ui->uriEdit, &QLineEdit::paste);
1824

1925
GUIUtil::handleCloseWindowShortcut(this);
2026
}

src/qt/openuridialog.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2011-2020 The Bitcoin Core developers
1+
// Copyright (c) 2011-2021 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -7,6 +7,8 @@
77

88
#include <QDialog>
99

10+
class PlatformStyle;
11+
1012
namespace Ui {
1113
class OpenURIDialog;
1214
}
@@ -16,7 +18,7 @@ class OpenURIDialog : public QDialog
1618
Q_OBJECT
1719

1820
public:
19-
explicit OpenURIDialog(QWidget *parent);
21+
explicit OpenURIDialog(const PlatformStyle* platformStyle, QWidget* parent);
2022
~OpenURIDialog();
2123

2224
QString getURI();

0 commit comments

Comments
 (0)