Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

openuridialog.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2014 The Bitcoin Core developers
2 // Copyright (c) 2014-2019 The Dash 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 <qt/openuridialog.h>
7 #include <qt/forms/ui_openuridialog.h>
8 
9 #include <qt/guiutil.h>
10 #include <qt/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);
21 #if QT_VERSION >= 0x040700
22  ui->uriEdit->setPlaceholderText("dash:");
23 #endif
24 }
25 
27 {
28  delete ui;
29 }
30 
32 {
33  return ui->uriEdit->text();
34 }
35 
37 {
39  if(GUIUtil::parseBitcoinURI(getURI(), &rcp))
40  {
41  /* Only accept value URIs */
42  QDialog::accept();
43  } else {
44  ui->uriEdit->setValid(false);
45  }
46 }
47 
49 {
50  QString filename = GUIUtil::getOpenFileName(this, tr("Select payment request file to open"), "", "", nullptr);
51  if(filename.isEmpty())
52  return;
53  QUrl fileUri = QUrl::fromLocalFile(filename);
54  ui->uriEdit->setText("dash:?r=" + QUrl::toPercentEncoding(fileUri.toString()));
55 }
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:571
Ui::OpenURIDialog * ui
Definition: openuridialog.h:31
OpenURIDialog(QWidget *parent)
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
Definition: guiutil.cpp:358
void on_selectFileButton_clicked()
void updateFonts()
Update the font of all widgets where a custom font has been set with GUIUtil::setFont.
Definition: guiutil.cpp:1563
void disableMacFocusRect(const QWidget *w)
Disable the OS default focus rect for macOS because we have custom focus rects set in the css files...
Definition: guiutil.cpp:1789
QString getURI()
Released under the MIT license