Merge #11683: tests: Remove unused mininode functions {ser,deser}_int_vector(......
[bitcoinplatinum.git] / src / qt / openuridialog.cpp
blob40671922f4c97a68e2ae81aaf312b5df0582c615
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.
5 #include <qt/openuridialog.h>
6 #include <qt/forms/ui_openuridialog.h>
8 #include <qt/guiutil.h>
9 #include <qt/walletmodel.h>
11 #include <QUrl>
13 OpenURIDialog::OpenURIDialog(QWidget *parent) :
14 QDialog(parent),
15 ui(new Ui::OpenURIDialog)
17 ui->setupUi(this);
18 #if QT_VERSION >= 0x040700
19 ui->uriEdit->setPlaceholderText("bitcoin:");
20 #endif
23 OpenURIDialog::~OpenURIDialog()
25 delete ui;
28 QString OpenURIDialog::getURI()
30 return ui->uriEdit->text();
33 void OpenURIDialog::accept()
35 SendCoinsRecipient rcp;
36 if(GUIUtil::parseBitcoinURI(getURI(), &rcp))
38 /* Only accept value URIs */
39 QDialog::accept();
40 } else {
41 ui->uriEdit->setValid(false);
45 void OpenURIDialog::on_selectFileButton_clicked()
47 QString filename = GUIUtil::getOpenFileName(this, tr("Select payment request file to open"), "", "", nullptr);
48 if(filename.isEmpty())
49 return;
50 QUrl fileUri = QUrl::fromLocalFile(filename);
51 ui->uriEdit->setText("bitcoin:?r=" + QUrl::toPercentEncoding(fileUri.toString()));