Fabcoin Core  0.16.2
P2P Digital Currency
openuridialog.cpp
Go to the documentation of this file.
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.
4 
5 #include <openuridialog.h>
6 #include <ui_openuridialog.h>
7 
8 #include <guiutil.h>
9 #include <walletmodel.h>
10 #include <styleSheet.h>
11 
12 #include <QUrl>
13 
14 OpenURIDialog::OpenURIDialog(QWidget *parent) :
15  QDialog(parent),
16  ui(new Ui::OpenURIDialog)
17 {
18  ui->setupUi(this);
19 
20  SetObjectStyleSheet(ui->buttonBox->button(QDialogButtonBox::Cancel), StyleSheetNames::ButtonWhite);
21  SetObjectStyleSheet(ui->buttonBox->button(QDialogButtonBox::Ok), StyleSheetNames::ButtonBlue);
22 
23 #if QT_VERSION >= 0x040700
24  ui->uriEdit->setPlaceholderText("fabcoin:");
25 #endif
26 }
27 
29 {
30  delete ui;
31 }
32 
34 {
35  return ui->uriEdit->text();
36 }
37 
39 {
41  if(GUIUtil::parseFabcoinURI(getURI(), &rcp))
42  {
43  /* Only accept value URIs */
44  QDialog::accept();
45  } else {
46  ui->uriEdit->setValid(false);
47  }
48 }
49 
51 {
52  QString filename = GUIUtil::getOpenFileName(this, tr("Select payment request file to open"), "", "", nullptr);
53  if(filename.isEmpty())
54  return;
55  QUrl fileUri = QUrl::fromLocalFile(filename);
56  ui->uriEdit->setText("fabcoin:?r=" + QUrl::toPercentEncoding(fileUri.toString()));
57 }
#define SetObjectStyleSheet(object, name)
Definition: styleSheet.h:10
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:359
void setupUi(QDialog *OpenURIDialog)
Ui::OpenURIDialog * ui
Definition: openuridialog.h:31
OpenURIDialog(QWidget *parent)
QValidatedLineEdit * uriEdit
void on_selectFileButton_clicked()
bool parseFabcoinURI(const QUrl &uri, SendCoinsRecipient *out)
Definition: guiutil.cpp:146
QString getURI()
QDialogButtonBox * buttonBox
void setValid(bool valid)