Raven Core  3.0.0
P2P Digital Currency
openuridialog.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2014 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #include "openuridialog.h"
7 #include "ui_openuridialog.h"
8 
9 #include "guiutil.h"
10 #include "walletmodel.h"
11 
12 #include <QUrl>
13 
14 OpenURIDialog::OpenURIDialog(QWidget *parent) :
15  QDialog(parent),
16  ui(new Ui::OpenURIDialog)
17 {
18  ui->setupUi(this);
19 #if QT_VERSION >= 0x040700
20  ui->uriEdit->setPlaceholderText("raven:");
21 #endif
22 }
23 
25 {
26  delete ui;
27 }
28 
30 {
31  return ui->uriEdit->text();
32 }
33 
35 {
37  if(GUIUtil::parseRavenURI(getURI(), &rcp))
38  {
39  /* Only accept value URIs */
40  QDialog::accept();
41  } else {
42  ui->uriEdit->setValid(false);
43  }
44 }
45 
47 {
48  QString filename = GUIUtil::getOpenFileName(this, tr("Select payment request file to open"), "", "", nullptr);
49  if(filename.isEmpty())
50  return;
51  QUrl fileUri = QUrl::fromLocalFile(filename);
52  ui->uriEdit->setText("raven:?r=" + QUrl::toPercentEncoding(fileUri.toString()));
53 }
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:425
Ui::OpenURIDialog * ui
Definition: openuridialog.h:32
OpenURIDialog(QWidget *parent)
bool parseRavenURI(const QUrl &uri, SendCoinsRecipient *out)
Definition: guiutil.cpp:225
void on_selectFileButton_clicked()
QString getURI()