2017-11-09 19:34:51 +01:00
|
|
|
/*
|
|
|
|
|
* This file is part of the Flowee project
|
|
|
|
|
* Copyright (C) 2011-2013 The Bitcoin Core developers
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
2013-11-06 15:08:56 +01:00
|
|
|
|
|
|
|
|
#include "openuridialog.h"
|
|
|
|
|
#include "ui_openuridialog.h"
|
|
|
|
|
|
|
|
|
|
#include "guiutil.h"
|
|
|
|
|
#include "walletmodel.h"
|
|
|
|
|
|
|
|
|
|
#include <QUrl>
|
|
|
|
|
|
|
|
|
|
OpenURIDialog::OpenURIDialog(QWidget *parent) :
|
|
|
|
|
QDialog(parent),
|
|
|
|
|
ui(new Ui::OpenURIDialog)
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
2017-08-11 18:03:36 +02:00
|
|
|
ui->uriEdit->setPlaceholderText(GUIUtil::uriPrefix() + ':');
|
2013-11-06 15:08:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OpenURIDialog::~OpenURIDialog()
|
|
|
|
|
{
|
|
|
|
|
delete ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString OpenURIDialog::getURI()
|
|
|
|
|
{
|
|
|
|
|
return ui->uriEdit->text();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OpenURIDialog::accept()
|
|
|
|
|
{
|
|
|
|
|
SendCoinsRecipient rcp;
|
|
|
|
|
if(GUIUtil::parseBitcoinURI(getURI(), &rcp))
|
|
|
|
|
{
|
|
|
|
|
/* Only accept value URIs */
|
|
|
|
|
QDialog::accept();
|
|
|
|
|
} else {
|
|
|
|
|
ui->uriEdit->setValid(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OpenURIDialog::on_selectFileButton_clicked()
|
|
|
|
|
{
|
|
|
|
|
QString filename = GUIUtil::getOpenFileName(this, tr("Select payment request file to open"), "", "", NULL);
|
|
|
|
|
if(filename.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
QUrl fileUri = QUrl::fromLocalFile(filename);
|
2017-08-11 18:03:36 +02:00
|
|
|
ui->uriEdit->setText(GUIUtil::uriPrefix() + ":?r=" + QUrl::toPercentEncoding(fileUri.toString()));
|
2013-11-06 15:08:56 +01:00
|
|
|
}
|