Raven Core
3.0.0
P2P Digital Currency
src
qt
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
24
OpenURIDialog::~OpenURIDialog
()
25
{
26
delete
ui
;
27
}
28
29
QString
OpenURIDialog::getURI
()
30
{
31
return
ui
->uriEdit->text();
32
}
33
34
void
OpenURIDialog::accept
()
35
{
36
SendCoinsRecipient
rcp;
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
46
void
OpenURIDialog::on_selectFileButton_clicked
()
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
}
OpenURIDialog::accept
void accept()
Definition:
openuridialog.cpp:34
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:425
OpenURIDialog::ui
Ui::OpenURIDialog * ui
Definition:
openuridialog.h:32
walletmodel.h
OpenURIDialog::OpenURIDialog
OpenURIDialog(QWidget *parent)
Definition:
openuridialog.cpp:14
GUIUtil::parseRavenURI
bool parseRavenURI(const QUrl &uri, SendCoinsRecipient *out)
Definition:
guiutil.cpp:225
Ui
Definition:
addressbookpage.h:14
OpenURIDialog::on_selectFileButton_clicked
void on_selectFileButton_clicked()
Definition:
openuridialog.cpp:46
guiutil.h
OpenURIDialog::~OpenURIDialog
~OpenURIDialog()
Definition:
openuridialog.cpp:24
SendCoinsRecipient
Definition:
walletmodel.h:41
OpenURIDialog::getURI
QString getURI()
Definition:
openuridialog.cpp:29
openuridialog.h
OpenURIDialog
Definition:
openuridialog.h:15
Generated on Mon Jul 29 2019 02:32:20 for Raven Core by
1.8.13