/* * 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 . */ #include "openuridialog.h" #include "ui_openuridialog.h" #include "guiutil.h" #include "walletmodel.h" #include OpenURIDialog::OpenURIDialog(QWidget *parent) : QDialog(parent), ui(new Ui::OpenURIDialog) { ui->setupUi(this); ui->uriEdit->setPlaceholderText(GUIUtil::uriPrefix() + ':'); } 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); ui->uriEdit->setText(GUIUtil::uriPrefix() + ":?r=" + QUrl::toPercentEncoding(fileUri.toString())); }