Bitcoin Core 28.99.0
P2P Digital Currency
openuridialog.cpp
Go to the documentation of this file.
1// Copyright (c) 2011-2021 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#include <qt/openuridialog.h>
6#include <qt/forms/ui_openuridialog.h>
7
8#include <qt/guiutil.h>
9#include <qt/platformstyle.h>
11
12#include <QAbstractButton>
13#include <QLineEdit>
14#include <QUrl>
15
16OpenURIDialog::OpenURIDialog(const PlatformStyle* platformStyle, QWidget* parent) : QDialog(parent, GUIUtil::dialog_flags),
17 ui(new Ui::OpenURIDialog),
18 m_platform_style(platformStyle)
19{
20 ui->setupUi(this);
21 ui->pasteButton->setIcon(m_platform_style->SingleColorIcon(":/icons/editpaste"));
22 QObject::connect(ui->pasteButton, &QAbstractButton::clicked, ui->uriEdit, &QLineEdit::paste);
23
25}
26
28{
29 delete ui;
30}
31
33{
34 return ui->uriEdit->text();
35}
36
38{
40 if (GUIUtil::parseBitcoinURI(getURI(), &rcp)) {
41 /* Only accept value URIs */
42 QDialog::accept();
43 } else {
44 ui->uriEdit->setValid(false);
45 }
46}
47
49{
50 if (e->type() == QEvent::PaletteChange) {
51 ui->pasteButton->setIcon(m_platform_style->SingleColorIcon(":/icons/editpaste"));
52 }
53
54 QDialog::changeEvent(e);
55}
const PlatformStyle * m_platform_style
Definition: openuridialog.h:33
void accept() override
Ui::OpenURIDialog * ui
Definition: openuridialog.h:31
QString getURI()
void changeEvent(QEvent *e) override
OpenURIDialog(const PlatformStyle *platformStyle, QWidget *parent)
QIcon SingleColorIcon(const QString &filename) const
Colorize an icon (given filename) with the icon color.
Utility functions used by the Bitcoin Qt UI.
Definition: bitcoingui.h:58
void handleCloseWindowShortcut(QWidget *w)
Definition: guiutil.cpp:431
constexpr auto dialog_flags
Definition: guiutil.h:60
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
Definition: guiutil.cpp:149