Bitcoin ABC
0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
src
qt
openuridialog.cpp
Go to the documentation of this file.
1
// Copyright (c) 2011-2014 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/forms/ui_openuridialog.h>
6
#include <
qt/openuridialog.h
>
7
8
#include <chainparams.h>
9
#include <
qt/guiutil.h
>
10
#include <
qt/sendcoinsrecipient.h
>
11
12
#include <QUrl>
13
14
OpenURIDialog::OpenURIDialog
(
const
CChainParams
¶ms, QWidget *parent)
15
: QDialog(parent), ui(
new
Ui
::
OpenURIDialog
),
16
uriScheme(
QString
::
fromStdString
(params.CashAddrPrefix())) {
17
ui
->setupUi(
this
);
18
ui
->uriEdit->setPlaceholderText(
uriScheme
+
":"
);
19
20
GUIUtil::handleCloseWindowShortcut
(
this
);
21
}
22
23
OpenURIDialog::~OpenURIDialog
() {
24
delete
ui
;
25
}
26
27
QString
OpenURIDialog::getURI
() {
28
return
ui
->uriEdit->text();
29
}
30
31
void
OpenURIDialog::accept
() {
32
SendCoinsRecipient
rcp
;
33
if
(
GUIUtil::parseBitcoinURI
(
uriScheme
,
getURI
(), &
rcp
)) {
34
/* Only accept value URIs */
35
QDialog::accept();
36
}
else
{
37
ui
->uriEdit->setValid(
false
);
38
}
39
}
40
41
void
OpenURIDialog::on_selectFileButton_clicked
() {
42
QString
filename =
GUIUtil::getOpenFileName
(
43
this
,
tr
(
"Select payment request file to open"
),
""
,
""
,
nullptr
);
44
if
(filename.isEmpty()) {
45
return
;
46
}
47
QUrl
fileUri
= QUrl::fromLocalFile(filename);
48
ui
->uriEdit->setText(
uriScheme
+
49
":?r="
+ QUrl::toPercentEncoding(
fileUri
.toString()));
50
}
CChainParams
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Definition
chainparams.h:80
OpenURIDialog
Definition
openuridialog.h:16
OpenURIDialog::accept
void accept() override
Definition
openuridialog.cpp:31
OpenURIDialog::ui
Ui::OpenURIDialog * ui
Definition
openuridialog.h:32
OpenURIDialog::getURI
QString getURI()
Definition
openuridialog.cpp:27
OpenURIDialog::~OpenURIDialog
~OpenURIDialog()
Definition
openuridialog.cpp:23
OpenURIDialog::on_selectFileButton_clicked
void on_selectFileButton_clicked()
Definition
openuridialog.cpp:41
OpenURIDialog::uriScheme
const QString uriScheme
Definition
openuridialog.h:33
OpenURIDialog::OpenURIDialog
OpenURIDialog(const CChainParams ¶ms, QWidget *parent)
Definition
openuridialog.cpp:14
SendCoinsRecipient
Definition
sendcoinsrecipient.h:23
guiutil.h
GUIUtil::parseBitcoinURI
bool parseBitcoinURI(const QString &scheme, const QUrl &uri, SendCoinsRecipient *out)
Definition
guiutil.cpp:144
GUIUtil::handleCloseWindowShortcut
void handleCloseWindowShortcut(QWidget *w)
Definition
guiutil.cpp:407
GUIUtil::getOpenFileName
QString getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get open filename, convenience wrapper for QFileDialog::getOpenFileName.
Definition
guiutil.cpp:337
Ui
Definition
addressbookpage.h:14
openuridialog.h
GetRand
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition
random.h:85
sendcoinsrecipient.h
Generated on Sat Nov 23 2024 02:37:59 for Bitcoin ABC by
1.9.8