Changeset View
Changeset View
Standalone View
Standalone View
src/qt/openuridialog.cpp
Show All 22 Lines | |||||
} | } | ||||
QString OpenURIDialog::getURI() { | QString OpenURIDialog::getURI() { | ||||
return ui->uriEdit->text(); | return ui->uriEdit->text(); | ||||
} | } | ||||
void OpenURIDialog::accept() { | void OpenURIDialog::accept() { | ||||
SendCoinsRecipient rcp; | SendCoinsRecipient rcp; | ||||
if (GUIUtil::parseBitcoinURI(getURI(), &rcp)) { | if (GUIUtil::parseBitcoinURI(GUIUtil::URI_SCHEME, getURI(), &rcp)) { | ||||
/* Only accept value URIs */ | /* Only accept value URIs */ | ||||
QDialog::accept(); | QDialog::accept(); | ||||
} else { | } else { | ||||
ui->uriEdit->setValid(false); | ui->uriEdit->setValid(false); | ||||
} | } | ||||
} | } | ||||
void OpenURIDialog::on_selectFileButton_clicked() { | void OpenURIDialog::on_selectFileButton_clicked() { | ||||
QString filename = GUIUtil::getOpenFileName( | QString filename = GUIUtil::getOpenFileName( | ||||
this, tr("Select payment request file to open"), "", "", nullptr); | this, tr("Select payment request file to open"), "", "", nullptr); | ||||
if (filename.isEmpty()) return; | if (filename.isEmpty()) return; | ||||
QUrl fileUri = QUrl::fromLocalFile(filename); | QUrl fileUri = QUrl::fromLocalFile(filename); | ||||
ui->uriEdit->setText(GUIUtil::URI_SCHEME + ":?r=" + | ui->uriEdit->setText(GUIUtil::URI_SCHEME + ":?r=" + | ||||
QUrl::toPercentEncoding(fileUri.toString())); | QUrl::toPercentEncoding(fileUri.toString())); | ||||
} | } |