LCOV - code coverage report
Current view: top level - src/qt - openuridialog.cpp (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 0 24 0.0 %
Date: 2015-10-12 22:39:14 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2011-2013 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             : 
      11             : #include <QUrl>
      12             : 
      13           0 : OpenURIDialog::OpenURIDialog(QWidget *parent) :
      14             :     QDialog(parent),
      15           0 :     ui(new Ui::OpenURIDialog)
      16             : {
      17           0 :     ui->setupUi(this);
      18             : #if QT_VERSION >= 0x040700
      19           0 :     ui->uriEdit->setPlaceholderText("bitcoin:");
      20             : #endif
      21           0 : }
      22             : 
      23           0 : OpenURIDialog::~OpenURIDialog()
      24             : {
      25           0 :     delete ui;
      26           0 : }
      27             : 
      28           0 : QString OpenURIDialog::getURI()
      29             : {
      30           0 :     return ui->uriEdit->text();
      31             : }
      32             : 
      33           0 : void OpenURIDialog::accept()
      34             : {
      35           0 :     SendCoinsRecipient rcp;
      36           0 :     if(GUIUtil::parseBitcoinURI(getURI(), &rcp))
      37             :     {
      38             :         /* Only accept value URIs */
      39           0 :         QDialog::accept();
      40             :     } else {
      41           0 :         ui->uriEdit->setValid(false);
      42           0 :     }
      43           0 : }
      44             : 
      45           0 : void OpenURIDialog::on_selectFileButton_clicked()
      46             : {
      47           0 :     QString filename = GUIUtil::getOpenFileName(this, tr("Select payment request file to open"), "", "", NULL);
      48           0 :     if(filename.isEmpty())
      49           0 :         return;
      50           0 :     QUrl fileUri = QUrl::fromLocalFile(filename);
      51           0 :     ui->uriEdit->setText("bitcoin:?r=" + QUrl::toPercentEncoding(fileUri.toString()));
      52           0 : }

Generated by: LCOV version 1.11