Wladimir J. van der Laan
11 years ago
11 changed files with 289 additions and 19 deletions
@ -0,0 +1,116 @@
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<ui version="4.0"> |
||||
<class>OpenURIDialog</class> |
||||
<widget class="QDialog" name="OpenURIDialog"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>564</width> |
||||
<height>109</height> |
||||
</rect> |
||||
</property> |
||||
<property name="windowTitle"> |
||||
<string>Open URI</string> |
||||
</property> |
||||
<layout class="QVBoxLayout" name="verticalLayout"> |
||||
<item> |
||||
<widget class="QLabel" name="label_2"> |
||||
<property name="text"> |
||||
<string>Open payment request from URI or file</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<layout class="QHBoxLayout" name="horizontalLayout"> |
||||
<item> |
||||
<widget class="QLabel" name="label"> |
||||
<property name="text"> |
||||
<string>URI:</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QValidatedLineEdit" name="uriEdit"> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QPushButton" name="selectFileButton"> |
||||
<property name="toolTip"> |
||||
<string>Select payment request file</string> |
||||
</property> |
||||
<property name="text"> |
||||
<string notr="true">…</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
<item> |
||||
<spacer name="verticalSpacer"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Vertical</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>20</width> |
||||
<height>40</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
<item> |
||||
<widget class="QDialogButtonBox" name="buttonBox"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="standardButtons"> |
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
<customwidgets> |
||||
<customwidget> |
||||
<class>QValidatedLineEdit</class> |
||||
<extends>QLineEdit</extends> |
||||
<header>qvalidatedlineedit.h</header> |
||||
</customwidget> |
||||
</customwidgets> |
||||
<resources/> |
||||
<connections> |
||||
<connection> |
||||
<sender>buttonBox</sender> |
||||
<signal>accepted()</signal> |
||||
<receiver>OpenURIDialog</receiver> |
||||
<slot>accept()</slot> |
||||
<hints> |
||||
<hint type="sourcelabel"> |
||||
<x>248</x> |
||||
<y>254</y> |
||||
</hint> |
||||
<hint type="destinationlabel"> |
||||
<x>157</x> |
||||
<y>274</y> |
||||
</hint> |
||||
</hints> |
||||
</connection> |
||||
<connection> |
||||
<sender>buttonBox</sender> |
||||
<signal>rejected()</signal> |
||||
<receiver>OpenURIDialog</receiver> |
||||
<slot>reject()</slot> |
||||
<hints> |
||||
<hint type="sourcelabel"> |
||||
<x>316</x> |
||||
<y>260</y> |
||||
</hint> |
||||
<hint type="destinationlabel"> |
||||
<x>286</x> |
||||
<y>274</y> |
||||
</hint> |
||||
</hints> |
||||
</connection> |
||||
</connections> |
||||
</ui> |
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2011-2013 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#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); |
||||
#if QT_VERSION >= 0x040700 |
||||
ui->uriEdit->setPlaceholderText("bitcoin:"); |
||||
#endif |
||||
} |
||||
|
||||
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("bitcoin:?request=" + QUrl::toPercentEncoding(fileUri.toString())); |
||||
} |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2011-2013 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef OPENURIDIALOG_H |
||||
#define OPENURIDIALOG_H |
||||
|
||||
#include <QDialog> |
||||
|
||||
namespace Ui { |
||||
class OpenURIDialog; |
||||
} |
||||
|
||||
class OpenURIDialog : public QDialog |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
explicit OpenURIDialog(QWidget *parent = 0); |
||||
~OpenURIDialog(); |
||||
|
||||
QString getURI(); |
||||
|
||||
protected slots: |
||||
void accept(); |
||||
|
||||
private slots: |
||||
void on_selectFileButton_clicked(); |
||||
|
||||
private: |
||||
Ui::OpenURIDialog *ui; |
||||
}; |
||||
|
||||
#endif // OPENURIDIALOG_H
|
Loading…
Reference in new issue