Bitcoin ABC  0.22.13
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 }
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:317
Ui::OpenURIDialog * ui
Definition: openuridialog.h:32
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system...
Definition: chainparams.h:47
void on_selectFileButton_clicked()
const QString uriScheme
Definition: openuridialog.h:33
void handleCloseWindowShortcut(QWidget *w)
Definition: guiutil.cpp:387
void accept() override
bool parseBitcoinURI(const QString &scheme, const QUrl &uri, SendCoinsRecipient *out)
Definition: guiutil.cpp:132
OpenURIDialog(const CChainParams &params, QWidget *parent)
QString getURI()