Bitcoin ABC  0.24.7
P2P Digital Currency
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 &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 
24  delete ui;
25 }
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 
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 }
OpenURIDialog
Definition: openuridialog.h:16
OpenURIDialog::~OpenURIDialog
~OpenURIDialog()
Definition: openuridialog.cpp:23
OpenURIDialog::OpenURIDialog
OpenURIDialog(const CChainParams &params, QWidget *parent)
Definition: openuridialog.cpp:14
OpenURIDialog::uriScheme
const QString uriScheme
Definition: openuridialog.h:33
CChainParams
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Definition: chainparams.h:47
chainparams.h
SendCoinsRecipient
Definition: sendcoinsrecipient.h:23
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:326
OpenURIDialog::ui
Ui::OpenURIDialog * ui
Definition: openuridialog.h:32
guiutil.h
OpenURIDialog::accept
void accept() override
Definition: openuridialog.cpp:31
OpenURIDialog::on_selectFileButton_clicked
void on_selectFileButton_clicked()
Definition: openuridialog.cpp:41
Ui
Definition: addressbookpage.h:14
OpenURIDialog::getURI
QString getURI()
Definition: openuridialog.cpp:27
GUIUtil::handleCloseWindowShortcut
void handleCloseWindowShortcut(QWidget *w)
Definition: guiutil.cpp:396
GUIUtil::parseBitcoinURI
bool parseBitcoinURI(const QString &scheme, const QUrl &uri, SendCoinsRecipient *out)
Definition: guiutil.cpp:133
openuridialog.h
sendcoinsrecipient.h