Mercurial > hg > bitcoin
changeset 2893:39871d44177a draft
Bugfix: Replace "URL" with "URI" where we aren't actually working with URLs
author | Luke Dashjr <luke-jr+git@utopios.org> |
---|---|
date | Sun, 25 Mar 2012 17:25:10 -0400 |
parents | 03c9dac98a44 |
children | eb231c32e0c2 |
files | src/qt/bitcoingui.cpp src/qt/guiutil.cpp src/qt/guiutil.h src/qt/sendcoinsdialog.cpp src/qt/sendcoinsdialog.h |
diffstat | 5 files changed, 24 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -659,7 +659,7 @@ void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event) { - // Accept only URLs + // Accept only URIs if(event->mimeData()->hasUrls()) event->acceptProposedAction(); } @@ -669,10 +669,10 @@ 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); } }
--- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -47,16 +47,16 @@ 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 @@ 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,
--- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -26,10 +26,10 @@ 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.
--- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -255,20 +255,20 @@ } -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; }
--- a/src/qt/sendcoinsdialog.h +++ b/src/qt/sendcoinsdialog.h @@ -29,8 +29,8 @@ 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();