Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
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>
11
12#include <QUrl>
13
14OpenURIDialog::OpenURIDialog(const CChainParams &params, 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
21}
22
26
28 return ui->uriEdit->text();
29}
30
34 /* Only accept value URIs */
35 QDialog::accept();
36 } else {
37 ui->uriEdit->setValid(false);
38 }
39}
40
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 defines various tweakable parameters of a given instance of the Bitcoin system.
Definition chainparams.h:80
void accept() override
Ui::OpenURIDialog * ui
void on_selectFileButton_clicked()
const QString uriScheme
OpenURIDialog(const CChainParams &params, QWidget *parent)
bool parseBitcoinURI(const QString &scheme, const QUrl &uri, SendCoinsRecipient *out)
Definition guiutil.cpp:144
void handleCloseWindowShortcut(QWidget *w)
Definition guiutil.cpp:407
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
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