mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-03 22:03:01 +01:00
Bugfix: Replace "URL" with "URI" where we aren't actually working with URLs
This commit is contained in:
@@ -659,7 +659,7 @@ void BitcoinGUI::gotoSendCoinsPage()
|
||||
|
||||
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
// Accept only URLs
|
||||
// Accept only URIs
|
||||
if(event->mimeData()->hasUrls())
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
@@ -669,10 +669,10 @@ void BitcoinGUI::dropEvent(QDropEvent *event)
|
||||
if(event->mimeData()->hasUrls())
|
||||
{
|
||||
gotoSendCoinsPage();
|
||||
QList<QUrl> urls = event->mimeData()->urls();
|
||||
foreach(const QUrl &url, urls)
|
||||
QList<QUrl> uris = event->mimeData()->urls();
|
||||
foreach(const QUrl &uri, uris)
|
||||
{
|
||||
sendCoinsPage->handleURL(&url);
|
||||
sendCoinsPage->handleURI(&uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,16 +47,16 @@ void GUIUtil::setupAmountWidget(QLineEdit *widget, QWidget *parent)
|
||||
widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
bool GUIUtil::parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out)
|
||||
bool GUIUtil::parseBitcoinURI(const QUrl *uri, SendCoinsRecipient *out)
|
||||
{
|
||||
if(url->scheme() != QString("bitcoin"))
|
||||
if(uri->scheme() != QString("bitcoin"))
|
||||
return false;
|
||||
|
||||
SendCoinsRecipient rv;
|
||||
rv.address = url->path();
|
||||
rv.label = url->queryItemValue("label");
|
||||
rv.address = uri->path();
|
||||
rv.label = uri->queryItemValue("label");
|
||||
|
||||
QString amount = url->queryItemValue("amount");
|
||||
QString amount = uri->queryItemValue("amount");
|
||||
if(amount.isEmpty())
|
||||
{
|
||||
rv.amount = 0;
|
||||
@@ -75,18 +75,18 @@ bool GUIUtil::parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GUIUtil::parseBitcoinURL(QString url, SendCoinsRecipient *out)
|
||||
bool GUIUtil::parseBitcoinURI(QString uri, SendCoinsRecipient *out)
|
||||
{
|
||||
// Convert bitcoin:// to bitcoin:
|
||||
//
|
||||
// Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,
|
||||
// which will lowercase it (and thus invalidate the address).
|
||||
if(url.startsWith("bitcoin://"))
|
||||
if(uri.startsWith("bitcoin://"))
|
||||
{
|
||||
url.replace(0, 10, "bitcoin:");
|
||||
uri.replace(0, 10, "bitcoin:");
|
||||
}
|
||||
QUrl urlInstance(url);
|
||||
return parseBitcoinURL(&urlInstance, out);
|
||||
QUrl uriInstance(uri);
|
||||
return parseBitcoinURI(&uriInstance, out);
|
||||
}
|
||||
|
||||
QString GUIUtil::getSaveFileName(QWidget *parent, const QString &caption,
|
||||
|
||||
@@ -26,10 +26,10 @@ public:
|
||||
static void setupAddressWidget(QLineEdit *widget, QWidget *parent);
|
||||
static void setupAmountWidget(QLineEdit *widget, QWidget *parent);
|
||||
|
||||
// Parse "bitcoin:" URL into recipient object, return true on succesful parsing
|
||||
// See Bitcoin URL definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
|
||||
static bool parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out);
|
||||
static bool parseBitcoinURL(QString url, SendCoinsRecipient *out);
|
||||
// Parse "bitcoin:" URI into recipient object, return true on succesful parsing
|
||||
// See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0
|
||||
static bool parseBitcoinURI(const QUrl *, SendCoinsRecipient *out);
|
||||
static bool parseBitcoinURI(QString uri, SendCoinsRecipient *out);
|
||||
|
||||
/** Get save file name, mimics QFileDialog::getSaveFileName, except that it appends a default suffix
|
||||
when no suffix is provided by the user.
|
||||
|
||||
@@ -255,20 +255,20 @@ void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv)
|
||||
}
|
||||
|
||||
|
||||
void SendCoinsDialog::handleURL(const QUrl *url)
|
||||
void SendCoinsDialog::handleURI(const QUrl *uri)
|
||||
{
|
||||
SendCoinsRecipient rv;
|
||||
if(!GUIUtil::parseBitcoinURL(url, &rv))
|
||||
if(!GUIUtil::parseBitcoinURI(uri, &rv))
|
||||
{
|
||||
return;
|
||||
}
|
||||
pasteEntry(rv);
|
||||
}
|
||||
|
||||
void SendCoinsDialog::handleURL(const QString &url)
|
||||
void SendCoinsDialog::handleURI(const QString &uri)
|
||||
{
|
||||
SendCoinsRecipient rv;
|
||||
if(!GUIUtil::parseBitcoinURL(url, &rv))
|
||||
if(!GUIUtil::parseBitcoinURI(uri, &rv))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ public:
|
||||
QWidget *setupTabChain(QWidget *prev);
|
||||
|
||||
void pasteEntry(const SendCoinsRecipient &rv);
|
||||
void handleURL(const QUrl *url);
|
||||
void handleURL(const QString &url);
|
||||
void handleURI(const QUrl *uri);
|
||||
void handleURI(const QString &uri);
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
|
||||
Reference in New Issue
Block a user